Fixed handling of cases when no matrix is attached to intersections

This commit is contained in:
Robert Osfield
2007-06-15 13:12:46 +00:00
parent 08d3b13430
commit f423c7660f
2 changed files with 4 additions and 2 deletions

View File

@@ -100,7 +100,8 @@ void HeightAboveTerrain::computeIntersections(osg::Node* scene, osg::Node::NodeM
if (!intersections.empty())
{
const osgUtil::LineSegmentIntersector::Intersection& intersection = *intersections.begin();
osg::Vec3d intersectionPoint = intersection.localIntersectionPoint * (*intersection.matrix);
osg::Vec3d intersectionPoint = intersection.matrix.valid() ? intersection.localIntersectionPoint * (*intersection.matrix) :
intersection.localIntersectionPoint;
_HATList[index]._hat = (_HATList[index]._point - intersectionPoint).length();
}
}

View File

@@ -141,7 +141,8 @@ void LineOfSight::computeIntersections(osg::Node* scene, osg::Node::NodeMask tra
++itr)
{
const osgUtil::LineSegmentIntersector::Intersection& intersection = *itr;
intersectionsLOS.push_back( intersection.localIntersectionPoint * (*intersection.matrix) );
if (intersection.matrix.valid()) intersectionsLOS.push_back( intersection.localIntersectionPoint * (*intersection.matrix) );
else intersectionsLOS.push_back( intersection.localIntersectionPoint );
}
}
}