Polygon is a collection of ZOO.Geometry.LinearRing.
Inherits from
NAME | DESCRIPTION |
---|---|
ZOO.Geometry.Polygon | Constructor for a Polygon geometry. |
getArea | Calculated by subtracting the areas of the internal holes from the area of the outer hole. |
containsPoint | Test if a point is inside a polygon. |
createRegularPolygon | Create a regular polygon around a radius. |
Constructor for a Polygon geometry. The first ring (this.component[0]) is the outer bounds of the polygon and all subsequent rings (this.component[1-n]) are internal holes.
Parameters
components {Array(ZOO.Geometry.LinearRing)}
getArea: function()
Calculated by subtracting the areas of the internal holes from the area of the outer hole.
Returns
{float} The area of the geometry
containsPoint: function(point)
Test if a point is inside a polygon. Points on a polygon edge are considered inside.
Parameters
point {ZOO.Geometry.Point}
Returns
{Boolean | Number} The point is inside the polygon. Returns 1 if the point is on an edge. Returns boolean otherwise.
ZOO.Geometry.Polygon.createRegularPolygon = function( origin,
radius,
sides,
rotation )
Create a regular polygon around a radius. Useful for creating circles and the like.
Parameters