Hello Michael,

On 09/15/2010 07:00 AM, Michael Raab wrote:
> I have a problem in our OpenSG1.8 application when trying to pick small 
> objects. Attached you can find an object geometry which has a AABB size of 
> (0.00002, 0.00002, 0.00001). If I try to pick that geometry nothing happens. 
> If I put a transformation node above that geometry that has a scale factor of 
> (10000, 10000, 10000), I'm still not able to pick that geometry. If I apply 
> that transformation to the vertices of the geometry the 
> selection/intersection works fine. Has anyone an idea what the problem is?

hm, I see the problem using the picking tutorial 11picking.cpp. My guess 
would be that the triangles on the geometry are so tiny that the 
triangle/line intersection code runs into precision issues (the scale 
transformation does not help here, because that only transform the line, 
so the code still tests tiny triangles against a line).

If you want to try a different triangle/line intersection algorithm, the 
current one is in
Line::intersect(const Pnt3r &v0, const Pnt3r &v1, const Pnt3r &v2,
                  Real  &t,  Vec3r *norm) const
and called from Geometry::intersect(Action * action).

Another alternative could be to replace the intersection callback used 
for the geometry core with one that does not test triangles for very 
small objects, but only the bounding box.
To register a different callback:

OSG::Action::ResultE intersect(OSG::Geometry* geo, OSG::Action* act)
{
    // check size of bounding volume

    if( /* large */)
    {
       return geo->intersect(act);
    }
    else
    {
       // test BB against line
    }
}

int main(int argc, char* argv[])
{
     osgInit(argc, argv);

     OSG::IntersectAction::registerEnterDefault(
        OSG::Geometry::getClassType(),
        OSG::osgTypedFunctionFunctor2Ptr<Action::ResultE, Geometry,
                                         Action*>(&intersect));

}

I'm not really certain about the functor above, it has been a long time 
since I used the 1.x functors (boost::function/boost::bind is so much 
more convenient)...

        Cheers,
                Carsten

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to