Class Polygon
Represents a 2D polygon composed of 32-bit signed integer vertices.
Inheritance
Namespace: X10D.Drawing
Assembly: X10D.dll
Syntax
public class Polygon : IEquatable<Polygon>
Constructors
| Improve this Doc View SourcePolygon()
Initializes a new instance of the Polygon class.
Declaration
public Polygon()
Polygon(IEnumerable<Point>)
Initializes a new instance of the Polygon class by constructing it from the specified vertices.
Declaration
public Polygon(IEnumerable<Point> vertices)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Point> | vertices | An enumerable collection of vertices from which the polygon should be constructed. |
Polygon(Polygon)
Initializes a new instance of the Polygon class by copying the specified polygon.
Declaration
public Polygon(Polygon polygon)
Parameters
Type | Name | Description |
---|---|---|
Polygon | polygon |
Properties
| Improve this Doc View SourceEmpty
Gets an empty polygon. That is, a polygon with no vertices.
Declaration
public static Polygon Empty { get; }
Property Value
Type | Description |
---|---|
Polygon | An empty polygon. |
IsConvex
Returns a value indicating whether this polygon is convex.
Declaration
public bool IsConvex { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if this polygon is convex; otherwise, false. |
VertexCount
Gets the number of vertices in this polygon.
Declaration
public int VertexCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | An |
Vertices
Gets a read-only view of the vertices in this polygon.
Declaration
public IReadOnlyList<Point> Vertices { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<Point> | A |
Methods
| Improve this Doc View SourceAddVertex(Point)
Adds a vertex to this polygon.
Declaration
public void AddVertex(Point vertex)
Parameters
Type | Name | Description |
---|---|---|
Point | vertex | The vertex to add. |
AddVertices(IEnumerable<Point>)
Adds a collection of vertices to this polygon.
Declaration
public void AddVertices(IEnumerable<Point> vertices)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Point> | vertices | An enumerable collection of vertices to add. |
ClearVertices()
Clears all vertices from this polygon.
Declaration
public void ClearVertices()
Equals(Nullable<Object>)
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Object> | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Polygon)
Returns a value indicating whether this instance and another instance are equal.
Declaration
public bool Equals(Polygon other)
Parameters
Type | Name | Description |
---|---|---|
Polygon | other | The instance with which to compare. |
Returns
Type | Description |
---|---|
System.Boolean | true if this instance and |
FromPolygonF(PolygonF)
Declaration
public static Polygon FromPolygonF(PolygonF polygon)
Parameters
Type | Name | Description |
---|---|---|
PolygonF | polygon | The polygon to convert. |
Returns
Type | Description |
---|---|
Polygon | The converted polygon. |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Operators
| Improve this Doc View SourceEquality(Polygon, Polygon)
Returns a value indicating whether two instances of Polygon are equal.
Declaration
public static bool operator ==(Polygon left, Polygon right)
Parameters
Type | Name | Description |
---|---|---|
Polygon | left | The first instance. |
Polygon | right | The second instance. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
Explicit(PolygonF to Polygon)
Declaration
public static explicit operator Polygon(PolygonF polygon)
Parameters
Type | Name | Description |
---|---|---|
PolygonF | polygon | The polygon to convert. |
Returns
Type | Description |
---|---|
Polygon | The converted polygon. |
Inequality(Polygon, Polygon)
Returns a value indicating whether two instances of Polygon are not equal.
Declaration
public static bool operator !=(Polygon left, Polygon right)
Parameters
Type | Name | Description |
---|---|---|
Polygon | left | The first instance. |
Polygon | right | The second instance. |
Returns
Type | Description |
---|---|
System.Boolean | true if |