Hi John,

I wasn't thinking of expanding the line segment, rather expanding the
bounding box just with a epsilon scaled by the line segment length.

However, you confusion about what I was thinking has given me an idea -
perhaps the best thing to do is do the intersection against the original
bounding box then pull the intersection point on the line segment back
towards the original end points just a little.  In essence this is exactly
what expanding the bounding box always did, but rather than put the epsilon
into the bounding box, we just put it into the ratio that is used to
compute the near start and and end points, as a ratio is used when
computing the distance there won't be any need to scale the epsilon too.

So the code:

           // clip s to xMin.
            s = s+(e-s)*(bb_min.x()-s.x())/(e.x()-s.x());


Would change to something like:

            s = s+(e-s)*((bb_min.x()-s.x())/(e.x()-s.x())-epsilon);

One would need to add a check to make sure the ratio computed isn't less
than the epsilon though, you wouldn't want the start and end points
migrating outwards.

Robert.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to