module:RegularPolygon

module:RegularPolygon

Regular polygon class
regular-polygon demo

Constructor

# new module:RegularPolygon(position, nbSides, radiusopt, optionsopt)

Regular polygon constructor

Parameters:
Name Type Attributes Default Description
position PositionDefinition

Center of the polygon

nbSides Number

Number of sides

radius Number <optional>
0

Distance between center and outer points

options ComponentOptions <optional>

Drawing options

Extends

Members

# radius

Set a new radius

# radius

Get the current radius

Methods

# (static) from(definition) → {RegularPolygon}

Parameters:
Name Type Description
definition Object

Regular polygon definition

Returns:
Type
RegularPolygon

# (static) getRotatingPoints(nbPoints, radius, startAngleopt, centeropt) → {Array.<Position>}

Return positions at regular intervals around a circle

Parameters:
Name Type Attributes Default Description
nbPoints Number

Number of points

radius Number

Distance from origin

startAngle Number <optional>
0

Starting angle of the points (between 0 and 1)

center PositionDefinition <optional>

Relative center of all the points

Returns:
Type
Array.<Position>