Added handling of zero points

This commit is contained in:
Robert Osfield
2016-06-24 10:02:39 +01:00
parent f47be656b4
commit fb9591d6bc

View File

@@ -49,8 +49,15 @@ namespace PolytopeIntersectorUtils
if (distance > _maxDistance) _maxDistance = distance;
if (_numPoints==MaxNumIntesections) break;
}
center /= value_type(_numPoints);
_distance = referencePlane.distance( center );
if (_numPoints>0)
{
center /= value_type(_numPoints);
_distance = referencePlane.distance( center );
}
else
{
_distance = _maxDistance;
}
}
bool operator<(const PolytopeIntersection& rhs) const { return _distance < rhs._distance; }