LineSegmentIntersector fixed: intersection ratio remaped to the range of LineSegment => correct order in multiset of intersections
This commit is contained in:
parent
8055ec9156
commit
8d8035a173
@ -299,13 +299,17 @@ struct IntersectFunctor
|
||||
return;
|
||||
}
|
||||
|
||||
Vec3 in = v0*r0 + v1*r1 + v2*r2;
|
||||
// Remap ratio into the range of LineSegment
|
||||
const osg::Vec3d& lsStart = _settings->_lineSegIntersector->getStart();
|
||||
const osg::Vec3d& lsEnd = _settings->_lineSegIntersector->getEnd();
|
||||
double remap_ratio = ((_start - lsStart).length() + r*_length)/(lsEnd - lsStart).length();
|
||||
|
||||
Vec3 in = lsStart*(1.0 - remap_ratio) + lsEnd*remap_ratio; // == v0*r0 + v1*r1 + v2*r2;
|
||||
Vec3 normal = E1^E2;
|
||||
normal.normalize();
|
||||
|
||||
|
||||
LineSegmentIntersector::Intersection hit;
|
||||
hit.ratio = r;
|
||||
hit.ratio = remap_ratio;
|
||||
hit.matrix = _settings->_iv->getModelMatrix();
|
||||
hit.nodePath = _settings->_iv->getNodePath();
|
||||
hit.drawable = _settings->_drawable;
|
||||
|
Loading…
Reference in New Issue
Block a user