Class Polygon
- Namespace
- SixLabors.PolygonClipper
- Assembly
- SixLabors.PolygonClipper.dll
Represents a complex polygon.
public sealed class Polygon : IReadOnlyCollection<Contour>, IEnumerable<Contour>, IEnumerable
- Inheritance
-
Polygon
- Implements
- Inherited Members
Constructors
Polygon()
Initializes a new instance of the Polygon class.
public Polygon()
Polygon(int)
Initializes a new instance of the Polygon class with a contour capacity.
public Polygon(int capacity)
Parameters
capacityintThe initial contour capacity.
Properties
Count
Gets the number of contours in the polygon.
public int Count { get; }
Property Value
this[int]
Gets the contour at the specified index.
public Contour this[int index] { get; }
Parameters
indexintThe index of the contour.
Property Value
VertexCount
Gets the total number of vertices across all contours in the polygon.
public int VertexCount { get; }
Property Value
- int
The total vertex count.
Methods
Add(Contour)
Adds a contour to the end of the contour collection.
public void Add(Contour contour)
Parameters
contourContourThe contour to add.
Clear()
Clears all contours from the polygon.
public void Clear()
DeepClone()
Creates a deep copy of this polygon and all of its contours.
public Polygon DeepClone()
Returns
- Polygon
A detached polygon copy.
GetBoundingBox()
Gets the bounding box.
public Box2 GetBoundingBox()
Returns
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<Contour> GetEnumerator()
Returns
- IEnumerator<Contour>
An enumerator that can be used to iterate through the collection.
GetLastContour()
Gets the last contour in the polygon.
public Contour GetLastContour()
Returns
Join(Polygon)
Joins another polygon to this instance.
public void Join(Polygon polygon)
Parameters
polygonPolygonThe polygon to join.
ToDebugString()
Creates a string useful for debugging.
public string ToDebugString()
Returns
Translate(double, double)
Translates the polygon by the specified x and y values.
public void Translate(double x, double y)