Hi Andi,

On Tue, 2005-06-07 at 15:08 +0200, Andreas BrĂ¼ning wrote:
> 
> i have a geometry with a lot of lines. There are only lines. I loaded
> it from a vrml- file. I want to copy the points of every line in a
> multimap, so in the end, there are two points in every entry of the
> multimap. How can i get the points of every line? Can i get them with
> the primitiv- Iterator? 

Yup, only the PrimitiveIterator will give you lines. You need to find
the Geometry Node with those lines first (either looking for the name or
walking the tree, see 10loading.cpp) and then run a PrimtiveIterator on
it. You can start with the following snippet (after testIterators.cpp):

PrimitiveIterator pi;

for ( pi = g->beginPrimitives(); pi != g->endPrimitives(); ++pi )
{
    std::cerr << "Primitive " << pi.getIndex() << ": "
         << Geometry::mapType( pi.getType() ) << " with " 
         << pi.getLength() << " points" << std::endl;
    for ( j = 0; j < pi.getLength(); j++ )
    {
        std::cerr << "Point " << j << ":  " << pi.getPositionIndex( j ) 
                << ": " << pi.getPosition( j );
    }
}

If you find primitives of type 1,2 or 3 (GL_LINES, GL_LINE_LOOP,
GL_LINE_STRIP), those are lines. How to interpret the points and how to
split it into 2-point lines depends on the type, see an OpenGL book for
that.

Hope it helps

        Dirk




-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r 
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to