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:
Robert Osfield
2010-01-26 13:05:05 +00:00
parent 5e9aedc8e1
commit 144d3e7af3
2 changed files with 3 additions and 3 deletions

View File

@@ -431,7 +431,7 @@ struct IntersectKdTree
const KdTree::KdNodeList& nodes,
const KdTree::TriangleList& triangles,
KdTree::LineSegmentIntersections& intersections,
const osg::Vec3& s, const osg::Vec3& e):
const osg::Vec3d& s, const osg::Vec3d& e):
_vertices(vertices),
_kdNodes(nodes),
_triangles(triangles),
@@ -764,7 +764,7 @@ bool KdTree::build(BuildOptions& options, osg::Geometry* geometry)
return build.build(options, geometry);
}
bool KdTree::intersect(const osg::Vec3& start, const osg::Vec3& end, LineSegmentIntersections& intersections) const
bool KdTree::intersect(const osg::Vec3d& start, const osg::Vec3d& end, LineSegmentIntersections& intersections) const
{
if (_kdNodes.empty())
{