bool distanceToHullAcceptableHoles( Vertices polygon, Vector2 point, bool higherDetail )
{
if( polygon == null )
throw new ArgumentNullException( nameof( polygon ), "'polygon' can't be null." );
if( polygon.Count < 3 )
throw new ArgumentException( "'polygon.MainPolygon.Count' can't be less then 3." );
// Check the distance to main polygon.
if( distanceToHullAcceptable( polygon, point, higherDetail ) )
{
if( polygon.holes != null )
{
for( int i = 0; i < polygon.holes.Count; i++ )
{
// If there is one distance not acceptable then return false.
if( !distanceToHullAcceptable( polygon.holes[i], point, higherDetail ) )
return false;
}
}
// All distances are larger then _hullTolerance.
return true;
}
// Default to false.
return false;
}