Re: [osg-users] Getting the List of Triangles from an osg model

2010-09-12 Thread Sanat Talmaki
Hi, I was able to apply the matrix transforms. Although I simply derived a ModifiedTriangleFunctor class from the original TriangleFunctor class and used function over-ride on the this->operator() therein. Is there a more elegant way to achieve this ? Thanks Sanat -- Read thi

Re: [osg-users] Getting the List of Triangles from an osg model

2010-09-12 Thread Sanat Talmaki
Hi, I was able to get a matrix for every geode in my model using the path variable in nodevisitor. However at present I am printing out the triangle vertices to a file using the printTriangles() and a struct, similar to the method show in the osggeometry example. I'm a little confused about h

Re: [osg-users] Getting the List of Triangles from an osg model

2010-09-06 Thread Gordon Tomlinson
:12 PM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Getting the List of Triangles from an osg model Hi Tom, Do you know if any of the examples with the source code use this ? I understand the principle but will be helpful if there is some sort of implemetation. Thanks. Sanat

Re: [osg-users] Getting the List of Triangles from an osg model

2010-09-06 Thread Sanat Talmaki
Hi Tom, Do you know if any of the examples with the source code use this ? I understand the principle but will be helpful if there is some sort of implemetation. Thanks. Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31353#31353 _

Re: [osg-users] Getting the List of Triangles from an osg model

2010-09-05 Thread Tom Pearce
Hi Sanat, When you find geometry (triangles) with your node visitor, apply the accumulated transform that you traversed to the triangles. NodeVisitors have a NodeList, which you can use with osg::ComputeLocalToWorld (I think) to get the accumulated matrix you need. Then each triangle will be

Re: [osg-users] Getting the List of Triangles from an osg model

2010-09-05 Thread Sanat Talmaki
Hi Jean, Nick, Paul Thanks for all your suggestions thus far. I was able to extract the triangles and after using the nodeVisitor as suggested by Jean, it is much easier than using a for loop as the code is generic using a visitor. My problem is that I am collecting triangles from a complex m

Re: [osg-users] Getting the List of Triangles from an osg model

2010-09-01 Thread Trajce (Nick) Nikolov
good :) -Nick On Wed, Sep 1, 2010 at 8:31 PM, Sanat Talmaki wrote: > Hi Nick, > > Yes, Windows and VS 2008. I had to do exactly that. The debugger works > normally (as expected) now > > Thanks, > > Sanat. > > -- > Read this topic online here: > http://forum.openscenegraph.org/vi

Re: [osg-users] Getting the List of Triangles from an osg model

2010-09-01 Thread Sanat Talmaki
Hi Nick, Yes, Windows and VS 2008. I had to do exactly that. The debugger works normally (as expected) now Thanks, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31245#31245 ___ osg-users m

Re: [osg-users] Getting the List of Triangles from an osg model

2010-08-31 Thread Trajce (Nick) Nikolov
I assume you are on Windows, as from what are you experiencing sounds familiar to me, all these stl issues. What I would do is, make sure Debug links to debug libraries, Relase to release. And do a clean build. -Nick On Wed, Sep 1, 2010 at 2:57 AM, Sanat Talmaki wrote: > Hi Nick, Jean > > The p

Re: [osg-users] Getting the List of Triangles from an osg model

2010-08-31 Thread Sanat Talmaki
Hi Nick, Jean The problem was because I was using the Release version of osg. I used the Debug instead and both size and numElements give the same value. I had turned optimization off but it seems as though you cannot run through the code even then. Thanks Sincerely, Sanat -

Re: [osg-users] Getting the List of Triangles from an osg model

2010-08-31 Thread Trajce (Nick) Nikolov
to me looks like you are trying to debug in release -Nick On Tue, Aug 31, 2010 at 10:46 PM, Sanat Talmaki wrote: > Hi Jean, > > I was not able to understand this behavior: > > When I had a vec3Array and I queried it using > vec3 = vec3Array->at(0) I would get an exception. Why does it give that

Re: [osg-users] Getting the List of Triangles from an osg model

2010-08-31 Thread Jean-Sébastien Guay
Hello Sanat, I was not able to understand this behavior: When I had a vec3Array and I queried it using vec3 = vec3Array->at(0) I would get an exception. Why does it give that exception ? Check the C++ standard, osg::Vec3Array::at() eventually calls std::vector::at() which throws an exceptio

Re: [osg-users] Getting the List of Triangles from an osg model

2010-08-31 Thread Sanat Talmaki
Hi Jean, I was not able to understand this behavior: When I had a vec3Array and I queried it using vec3 = vec3Array->at(0) I would get an exception. Why does it give that exception ? I needed to use (*Vec3Array)[i] to get each Vec3. But then at i = 14113, I got an Unhandled exception: at 0x0

Re: [osg-users] Getting the List of Triangles from an osg model

2010-08-31 Thread Tim Moore
On Mon, Aug 30, 2010 at 7:55 PM, Paul Martz wrote: > > I'm about to write some code that needs to convert tri strips and fans to > triangles, and I figured I'd use TriangleFunctor for that task. > > By the way, osgUtils::IndexMeshVisitor does that, pretty much. Tim _

Re: [osg-users] Getting the List of Triangles from an osg model

2010-08-30 Thread Sanat Talmaki
Hi Jean, Yes, I realize my mistake. I went through that section in the Quick Start Guide to refresh my memory. Thanks. Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31178#31178 ___ osg-use

Re: [osg-users] Getting the List of Triangles from an osg model

2010-08-30 Thread Jean-Sébastien Guay
Hello Sanat, num1 = cow->asGroup()->getChild(0)->asGeode()->getNumDrawables(); num2 = cow->asGroup()->getNumChildren(); num3 = cow->asGeode()->getNumDrawables(); This line makes no sense. You have confirmed in the line before that cow is a Group, why do you then try to cast cow as a

Re: [osg-users] Getting the List of Triangles from an osg model

2010-08-30 Thread Sanat Talmaki
Hi, I was running a small test program to understand the concept a little better: Code: int main() { int numChildren, num1, num2, num3; const char* geodeName; const char* cowChildrenName; osg::Group* root = new osg::Group(); osg::Node* cow = osgDB::readNodeFile("cow.osg"); root->a

Re: [osg-users] Getting the List of Triangles from an osg model

2010-08-30 Thread Sanat Talmaki
Hi Paul, Thanks for your suggestion. I take a look at tiranglefunctor. I am trying to get the list of vertices like this: (the algorithm that I'm trying to use, uses a file type called TRI or TRIS which is basically a list of triangle vertices that it then uses to compare with another model's v

Re: [osg-users] Getting the List of Triangles from an osg model

2010-08-30 Thread Paul Martz
Sanat Talmaki wrote: Hi, I am having trouble figuring out how I can get the list of triangles (vertices) that make up an osg object to use in another algorithm that needs a list of triangle vertices that make up the model. (I have seen the models I intend to use in osgviewer using the 'w' key

Re: [osg-users] Getting the List of Triangles from an osg model

2010-08-30 Thread Trajce (Nick) Nikolov
you need to write a node visitor and when you hit a Geode, then go over the drawables. There is a functor somewhere that gets you triangles from the drawables (have a look at TriangleFunctor) -Nick On Mon, Aug 30, 2010 at 9:07 PM, Sanat Talmaki wrote: > Hi, > > I am having trouble figuring out h

[osg-users] Getting the List of Triangles from an osg model

2010-08-30 Thread Sanat Talmaki
Hi, I am having trouble figuring out how I can get the list of triangles (vertices) that make up an osg object to use in another algorithm that needs a list of triangle vertices that make up the model. (I have seen the models I intend to use in osgviewer using the 'w' key and they are made up o