bool searchNextHullEntrance( List<Vertices> detectedPolygons, Vector2 start, out Vector2? entrance )
{
int x;
bool foundTransparent = false;
bool isInPolygon = false;
for( int i = (int)start.X + (int)start.Y * _width; i <= _dataLength; i++ )
{
if( isSolid( ref i ) )
{
if( foundTransparent )
{
x = i % _width;
entrance = new Vector2( x, ( i - x ) / (float)_width );
isInPolygon = false;
for( int polygonIdx = 0; polygonIdx < detectedPolygons.Count; polygonIdx++ )
{
if( inPolygon( detectedPolygons[polygonIdx], entrance.Value ) )
{
isInPolygon = true;
break;
}
}
if( isInPolygon )
foundTransparent = false;
else
return true;
}
}
else
foundTransparent = true;
}
entrance = null;
return false;
}