Hi Daniel,

I'm afriad the IntersectVisitor only supports intersection with
surface primitives, it doesn't support lines or points.  To do line
and points intersections you can't use ray/line segment based
intersection techniques like IntersectVisitor, you have to use
something like a polytope based intersection.

You could have a play with the PolytopeVisitor implementation which is
part of the back-end of the SphereSegment class for inspiration.
You'll find the code hidden away in src/osgSim/SphereSegment.cpp.

Robert.

On 6/12/06, Kallfass, Daniel, SDGE1 <[EMAIL PROTECTED]> wrote:
Hello,

I'm having a problem drawing a single point in a drawable/geometry 
(PrimitiveSet osg::PrimitiveSet::POINTS)
which is then added to an empty geode.
I get the following error message (originated from the Intersect Visitor Class) 
and the point isn't drawn:

Warning: invalid line segment passed to IntersectVisitor::addLineSegment(..)
 0 0 0 0 0 0 segment ignored.

This error doesn't occur when I insert two or more different points into the 
drawable.
I'm using a simple render loop and are not using the IntersectVisitor at all.
I've attached the code example.

I guess that the bounding box computation fails when there is only one single 
point
in the drawable/geometry. So the cull traversal might produce this error. But I 
couldn't
track the error.

Is this behaviour an OSG bug?

Thanks!

Best regards,
Daniel Kallfass


Code example:

 pxGeode = new osg::Geode();


 // create the vertices
 osg::ref_ptr<osg::Vec3Array> pxVerts = new osg::Vec3Array();

 pxVerts->push_back( osg::Vec3d( 3.0f, 2.0f, 1.0f ) );
 //pxVerts->push_back( osg::Vec3d( 5.0f, 3.0f, 4.0f ) );

 // create the state set
 osg::ref_ptr<osg::StateSet> pxStateSet = pxGeode->getOrCreateStateSet();

 // create the state attributes
 osg::ref_ptr<osg::Point> pxPointAttr = new osg::Point();
 pxPointAttr->setSize( m_fScale );
 pxPointAttr->setMaxSize( m_fScale );
 pxPointAttr->setMinSize( m_fScale );
 pxStateSet->setAttributeAndModes( pxPointAttr.get() );

 // create the drawable
 osg::ref_ptr<osg::Geometry> pxDrawable = new osg::Geometry();
 pxDrawable->setVertexArray( pxVerts.get() );

 osg::ref_ptr<osg::DrawElementsUInt> pxPrimSet = new osg::DrawElementsUInt( 
osg::PrimitiveSet::POINTS );
 pxPrimSet->push_back( 0 );
 //pxPrimSet->push_back( 1 );
 pxDrawable->addPrimitiveSet( pxPrimSet.get() );

 // create the colors
 osg::ref_ptr<osg::Vec4Array> pxColors = new osg::Vec4Array();
 //pxColors->push_back( m_vecColor );
 pxColors->push_back( osg::Vec4f( 1.0f, 1.0f, 1.0f, 1.0f ) );
 pxDrawable->setColorArray( pxColors.get() );
 pxDrawable->setColorBinding( osg::Geometry::BIND_PER_PRIMITIVE_SET );

 pxGeode->addDrawable( pxDrawable.get() );


_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to