Fixes kdtree building
This commit is contained in:
@@ -361,8 +361,6 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int
|
|||||||
|
|
||||||
while(left<right && (_centers[_primitiveIndices[right]][axis]>mid)) { --right; }
|
while(left<right && (_centers[_primitiveIndices[right]][axis]>mid)) { --right; }
|
||||||
|
|
||||||
while(left<right && (_centers[_primitiveIndices[right]][axis]>mid)) { --right; }
|
|
||||||
|
|
||||||
if (left<right)
|
if (left<right)
|
||||||
{
|
{
|
||||||
std::swap(_primitiveIndices[left], _primitiveIndices[right]);
|
std::swap(_primitiveIndices[left], _primitiveIndices[right]);
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ struct IntersectFunctor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// compate s and e against the yMin to yMax range of bb.
|
// compare s and e against the yMin to yMax range of bb.
|
||||||
if (s.y()<=e.y())
|
if (s.y()<=e.y())
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ struct IntersectFunctor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// compate s and e against the zMin to zMax range of bb.
|
// compare s and e against the zMin to zMax range of bb.
|
||||||
if (s.z()<=e.z())
|
if (s.z()<=e.z())
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -247,8 +247,8 @@ struct IntersectFunctor
|
|||||||
|
|
||||||
value_type r,r0,r1,r2;
|
value_type r,r0,r1,r2;
|
||||||
|
|
||||||
const value_type esplison = 1e-10;
|
const value_type epsilon = 1e-10;
|
||||||
if (det>esplison)
|
if (det>epsilon)
|
||||||
{
|
{
|
||||||
value_type u = (P*T);
|
value_type u = (P*T);
|
||||||
if (u<0.0 || u>det) return;
|
if (u<0.0 || u>det) return;
|
||||||
@@ -271,7 +271,7 @@ struct IntersectFunctor
|
|||||||
r2 = v;
|
r2 = v;
|
||||||
r = t * _inverse_length;
|
r = t * _inverse_length;
|
||||||
}
|
}
|
||||||
else if (det<-esplison)
|
else if (det<-epsilon)
|
||||||
{
|
{
|
||||||
value_type u = (P*T);
|
value_type u = (P*T);
|
||||||
if (u>0.0 || u<det) return;
|
if (u>0.0 || u<det) return;
|
||||||
@@ -595,7 +595,7 @@ bool LineSegmentIntersector::intersectAndClip(osg::Vec3d& s, osg::Vec3d& e,const
|
|||||||
|
|
||||||
double epsilon = 1e-5;
|
double epsilon = 1e-5;
|
||||||
|
|
||||||
// compate s and e against the xMin to xMax range of bb.
|
// compare s and e against the xMin to xMax range of bb.
|
||||||
if (s.x()<=e.x())
|
if (s.x()<=e.x())
|
||||||
{
|
{
|
||||||
// trivial reject of segment wholely outside.
|
// trivial reject of segment wholely outside.
|
||||||
@@ -636,7 +636,7 @@ bool LineSegmentIntersector::intersectAndClip(osg::Vec3d& s, osg::Vec3d& e,const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// compate s and e against the yMin to yMax range of bb.
|
// compare s and e against the yMin to yMax range of bb.
|
||||||
if (s.y()<=e.y())
|
if (s.y()<=e.y())
|
||||||
{
|
{
|
||||||
// trivial reject of segment wholely outside.
|
// trivial reject of segment wholely outside.
|
||||||
@@ -677,7 +677,7 @@ bool LineSegmentIntersector::intersectAndClip(osg::Vec3d& s, osg::Vec3d& e,const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// compate s and e against the zMin to zMax range of bb.
|
// compare s and e against the zMin to zMax range of bb.
|
||||||
if (s.z()<=e.z())
|
if (s.z()<=e.z())
|
||||||
{
|
{
|
||||||
// trivial reject of segment wholely outside.
|
// trivial reject of segment wholely outside.
|
||||||
|
|||||||
Reference in New Issue
Block a user