Members
-
position :Vector2
-
Description
The start position of the rectDetails
-
size :Vector2
-
Description
The size of the rectDetails
-
<readonly> region :Array.<Array>
-
Description
Get region for polybooljs plugin, can be also be used for GeoJson. Return a double level array ([[x, y], [x, y], ...])Details
-
<readonly> points :Array.<Vector2>
-
Description
Get points of the PolygonDetails
-
<readonly> lines :Array.<Line>
-
Description
Get lines of the PolygonDetails
-
<readonly> area :Number
-
Description
Get area of the PolygonDetails
-
<readonly> isConvex :Boolean
-
Description
Did the polygon is convexDetails
-
<readonly> isConcave :Boolean
-
Description
Did the polygon is concaveDetails
-
<readonly> hull :Polygon
-
Description
Convert the current polygon to a hull polygon (convert to convex)Details
-
<readonly> convex :Polygon
-
Description
Alias of hullDetails
-
<readonly> clone :Polygon
-
Description
Clonning the current polygon, usefull to not modify the current polygonDetails
Methods
-
pointIsInside( point ) → {boolean}
-
Description
Wrapper for checking if point is inside a rectParameters
Name Type Description point
Vector2 Point to check Returns
Details
-
pointIsInsideRect( point ) → {Boolean}
-
Description
Check if a point is inside a RectParameters
Name Type Description point
Vector2 The Vector2 like object Returns
Details
-
pointIsInsidePolygon( point ) → {boolean}
-
Description
Checking if point is inside a polygonParameters
Name Type Description point
Vector2 Point to check Returns
Details
-
setChildren( polygons ) → {Polygon}
-
Description
Setting all children polygons (for holes)Parameters
Name Type Description polygons
Array.<Polygon> Children to set Returns
Details
-
addChild( polygon ) → {Polygon}
-
Description
Adding a child polygon (for hole)Parameters
Name Type Description polygon
Polygon Child polygon to add Returns
Details
-
setVertexes( vertices ) → {Polygon}
-
Description
Setting vertices of the polygonParameters
Name Type Description vertices
Array.<Vector2> Vertices to set Returns
Details
-
setElements( vertices ) → {Polygon}
-
Description
Setting elements of the polygonParameters
Name Type Description vertices
Array.<(Vector2|BezierCurve)> Vertices to set Returns
Details
-
addVertex( vertice ) → {Polygon}
-
Description
Add a new vertices to the endParameters
Name Type Description vertice
Vector2 the vertice to add Returns
Details
-
<static> Box( p ) → {Rect}
-
addElement( element ) → {Polygon}
-
Description
Add a new vertices to the endParameters
Name Type Description element
Vector2 | BezierCurve the vertice or curve to add Returns
Details
-
colliding( polygon ) → {Boolean}
-
Description
Is the current polygon colliding with the given polygonParameters
Name Type Description polygon
Polygon the second polygon for the collision Returns
Details
-
intersect( polygon ) → {Array.<Polygon>}
-
Description
Intersect boolean operation on this polygon with the given polygonParameters
Name Type Description polygon
Polygon the second polygon for the operation Returns
Details
-
difference( polygon ) → {Array.<Polygon>}
-
Description
Difference boolean operation on this polygon with the given polygonParameters
Name Type Description polygon
Polygon the second polygon for the operation Returns
Details
-
union( polygon ) → {Array.<Polygon>}
-
Description
Union boolean operation on this polygon with the given polygonParameters
Name Type Description polygon
Polygon the second polygon for the operation Returns
Details
-
xor( polygon ) → {Array.<Polygon>}
-
Description
Xor boolean operation on this polygon with the given polygonParameters
Name Type Description polygon
Polygon the second polygon for the operation Returns
Details
-
moveBy( value ) → {Vector2}
-
Description
Move all vertices of the polygon by a Vector2Parameters
Name Type Description value
Vector2 The value to move by Returns
Details