예제 #1
0
 public bool Contains(Vector2 point)
 {
     if (!_boundingBox.Contains(point))
     {
         return(false);
     }
     else
     {
         return(Contours.Select(c => c.WindingNumber(point)).Sum() > 0);
     }
 }
예제 #2
0
 public double Distance2(Vector2 point)
 {
     if (this.Contains(point))
     {
         return(0);
     }
     else if (this.IsEmpty)
     {
         return(double.PositiveInfinity);
     }
     else
     {
         return(Contours.Select(c => PolylineUtils.Distance2(point, c)).Min());
     }
 }
예제 #3
0
 public int CountVertices()
 {
     return(Contours.Select(contour => contour.Vertices.Count).Sum());
 }
예제 #4
0
 // Assumes contour orientation is canonic (counterclockwise for outer contours, clockwise for inner contours)
 public double Area()
 {
     return(Contours.Select(contour => contour.SignedArea()).Sum());
 }