Class Polygon
Represents an N-sided polygon defined by an ordered list of vertices. Immutable: all operations return new instances. Minimum 3 points required.
public sealed class Polygon : IBounds, IEquatable<Polygon>
- Inheritance
-
Polygon
- Implements
- Inherited Members
Constructors
- Polygon(params Point[])
Initializes a new polygon from an array of vertices.
- Polygon(IReadOnlyList<Point>)
Initializes a new polygon from an ordered list of vertices.
Properties
- Area
Gets the signed area of the polygon (positive for counter-clockwise winding).
- AxisAlignedBounds
Gets the axis-aligned bounding rectangle of this polygon.
- Bottom
Gets the vertical position of the bottom edge of the bounds.
- Centroid
Gets the centroid (geometric center of mass) of the polygon.
- Height
Gets the total vertical extent of the bounds (Bottom minus Top).
- Left
Gets the horizontal position of the left edge of the bounds.
- MidX
Gets the horizontal midpoint of the bounds.
- MidY
Gets the vertical midpoint of the bounds.
- PointCount
Gets the number of vertices.
- Points
Gets the vertices of this polygon.
- Right
Gets the horizontal position of the right edge of the bounds.
- Top
Gets the vertical position of the top edge of the bounds.
- Width
Gets the total horizontal extent of the bounds (Right minus Left).
Methods
- Contains(double, double)
Determines whether the specified point lies inside this polygon using the even-odd (ray casting) rule.
- Regular(Point, double, int)
Creates a regular N-sided polygon inscribed in a circle.
- Scale(double, double)
Returns a new polygon with all vertices scaled by the specified factors relative to the origin.
- ToString()
Returns
Polygon(N pts).
- Translate(double, double)
Returns a new polygon translated by the specified offsets.
Operators
- operator ==(Polygon, Polygon)
Determines whether two polygons are equal.
- operator !=(Polygon, Polygon)
Determines whether two polygons are not equal.