new Circle( center, radius, sides )

Description
Circle Class
Parameters
Name Type Description
center Vector2 The center of the circle
radius Number The radius of the circle
sides Number Sides count of the polygon circle
Details

Members


sides :Number

Description
Sides count of the circle
Details
Number

center :Vector2

Description
Center of the circle
Details

radius :Number

Description
Radius of the circle
Details
Number

<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
Array.<Array>

<readonly> points :Array.<Vector2>

Description
Get points of the Polygon
Details
Array.<Vector2>

<readonly> lines :Array.<Line>

Description
Get lines of the Polygon
Details
Array.<Line>

<readonly> area :Number

Description
Get area of the Polygon
Details
Number

<readonly> isConvex :Boolean

Description
Did the polygon is convex
Details
Boolean

isConcave


<readonly> isConcave :Boolean

Description
Did the polygon is concave
Details
Boolean

isConvex


<readonly> hull :Polygon

Description
Convert the current polygon to a hull polygon (convert to convex)
Details

<readonly> convex :Polygon

Description
Alias of hull
Details

hull


<readonly> clone :Polygon

Description
Clonning the current polygon, usefull to not modify the current polygon
Details

Methods


pointIsInside( point ) → {boolean}

Description
Wrapper for checking if point is inside a circle
Parameters
Name Type Description
point Vector2 Point to check
Returns
Details

pointIsInsidePolygon( point ) → {boolean}

Description
Checking if point is inside a polygon
Parameters
Name Type Description
point Vector2 Point to check
Returns

pointIsInsideCircle( point ) → {Boolean}

Description
Check if a point is inside a Circle
Parameters
Name Type Description
point Vector2 The Vector2 like object
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 polygon
Parameters
Name Type Description
vertices Array.<Vector2> Vertices to set
Returns
Details

true


setElements( vertices ) → {Polygon}

Description
Setting elements of the polygon
Parameters
Name Type Description
vertices Array.<(Vector2|BezierCurve)> Vertices to set
Returns
Details

addVertex( vertice ) → {Polygon}

Description
Add a new vertices to the end
Parameters
Name Type Description
vertice Vector2 the vertice to add
Returns
Details

true


addElement( element ) → {Polygon}

Description
Add a new vertices to the end
Parameters
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 polygon
Parameters
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 polygon
Parameters
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 polygon
Parameters
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 polygon
Parameters
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 polygon
Parameters
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 Vector2
Parameters
Name Type Description
value Vector2 The value to move by
Returns
Details