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 TODO: upgrade to dimension-ambiguous model class in math

Constructors

this
this()

Creates an empty polygon

this
this(Vector!(T, 2)[] vertices...)

Creates a polygon using a list of vertices as vertices

Members

Functions

contains
bool contains(Vector!(U, 2) point)

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
U opCast()

Casts the polygon to a polygon of another type

Properties

sides
Segment!(T, 2)[numSides] sides [@property getter]

Gets the sides of a polygon

Variables

vertices
Vector!(T, 2)[numSides] vertices;

The vertices of the polygon

Meta