Class Polygon
A polygon is an object defined by its vertices in 2 space
T is the type of the polygon and sides is how many sides the polygon has
class Polygon(T, uint numSides)
;
Constructors
Name | Description |
this
|
Creates an empty polygon
|
this
|
Creates a polygon using a list of vertices as vertices
|
Fields
Name | Type | Description |
vertices
|
Vector!(T,2)[numSides] | The vertices of the polygon
|
Properties
Name | Type | Description |
sides [get]
|
Segment!(T,2)[numSides] | Gets the sides of a polygon
|
Methods
Name | Description |
contains
|
Returns whether or not a given point is inside the polygon
This algorithm uses scanlining (see Renderer.fillPolygon)
Conceptually, it draws a ray to the left from the given point; if the ray intersects the polygon an odd number of times
the point is within the polygon
|
opCast
|
Casts the polygon to a polygon of another type
|
TODO
upgrade to dimension-ambiguous model class in math