From Lars Nilsson, "Attached is a small program doing intersection calculations, both with and without KdTree. The geometry is a TRIANGLE_STRIP consisting of five vertices, all with the same rather high Z-value. If the intersection calculation uses KdTree, it fails. When I changed osg::Vec3 to osg::Vec3d in a few places in osg::KdTree it finds the correct intersection point."
From Robert Osfield, I didn't merge the change of parameter type of IntersectKdTree::intersect() as the internal maths is all done in Vec3s. Keeping Vec3 here hasn't effected the test results.
This commit is contained in:
@@ -83,7 +83,7 @@ class OSG_EXPORT KdTree : public osg::Shape
|
||||
typedef std::vector<LineSegmentIntersection> LineSegmentIntersections;
|
||||
|
||||
/** compute the intersection of a line segment and the kdtree, return true if an intersection has been found.*/
|
||||
virtual bool intersect(const osg::Vec3& start, const osg::Vec3& end, LineSegmentIntersections& intersections) const;
|
||||
virtual bool intersect(const osg::Vec3d& start, const osg::Vec3d& end, LineSegmentIntersections& intersections) const;
|
||||
|
||||
|
||||
typedef int value_type;
|
||||
|
||||
Reference in New Issue
Block a user