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:
@@ -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())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user