Constructor
new Polygon(points)
Parameters:
| Name | Type | Description |
|---|---|---|
points |
Array.<Point> | the array of points which form the polygon |
Members
area
the area of the polygon
edges :Array.<LineSegment>
containing the edges of the polygon
Type:
- Array.<LineSegment>
maximumCorner
the corner of the bounding box with the maximum x- and y- coordinates
minimumCorner
the corner of the bounding box with the minimum x- and y- coordinates
n
the degree or order of the polygon, i.e. the number of vertices or edges
vertices :Array.<Point>
containing the vertices of the polygon
Type:
- Array.<Point>
Methods
translate(x, y) → {Polygon}
translate the polygon by the given displacement in both x- and y-directions; this is not a clone and the original polygon is affected
Parameters:
| Name | Type | Description |
|---|---|---|
x |
Number | the translation in the x-direction |
y |
Number | the translation in the y-direction |
Returns:
the translated polygon
- Type
- Polygon