ReferenceregularPolygon (Page 1)

<regularPolygon>

<regularPolygon> is a Graphical component that renders a regular polygon on a <graph>.

Attributes and Properties

Attributes for <regularPolygon>
AttributeTypeValues
allowDilation = "…"boolean"true" "false"
allowRotation = "…"boolean"true" "false"
allowTranslation = "…"boolean"true" "false"
apothem = "…"number
applyStyleToLabel = "…"boolean"true" "false"
area = "…"number
center = "…"[ math ]
circumradius = "…"number
displayDecimals = "…"integer
displayDigits = "…"integer
displaySmallAsZero = "…"number
draggable = "…"boolean"true" "false"
filled = "…"boolean"true" "false"
inradius = "…"number
labelIsName = "…"boolean"true" "false"
layer = "…"integer
minShrink = "…"
numSides = "…"integer
numVertices = "…"integer
padZeros = "…"boolean"true" "false"
perimeter = "…"number
radius = "…"number
rigid = "…"boolean"true" "false"
rotateAround = "…""centroid" "vertex" "point"
rotationCenter = "…"
rotationHandleVertices = "…"
rotationVertex = "…"
showCoordsWhenDragging = "…"boolean"true" "false"
sideLength = "…"number
vertices = "…"[ math ]
verticesDraggable = "…"boolean"true" "false"
Props for <regularPolygon name="r">
PropertyType
$r.allowDilationboolean
$r.allowRotationboolean
$r.allowTranslationboolean
$r.apothemnumber
$r.applyStyleToLabelboolean
$r.areanumber
$r.borderStyleDescriptiontext
$r.center[ math ]
$r.circumradiusnumber
$r.disabledboolean
$r.displayDecimalsinteger
$r.displayDigitsinteger
$r.displaySmallAsZeronumber
$r.draggableboolean
$r.filledboolean
$r.fillStyleDescriptiontext
$r.fixedboolean
$r.fixLocationboolean
$r.hiddenboolean
$r.inradiusnumber
$r.labellabel
$r.labelIsNameboolean
$r.layerinteger
$r.numDimensionsnumber
$r.numSidesinteger
$r.numVerticesinteger
$r.padZerosboolean
$r.perimeternumber
$r.preserveSimilarityboolean
$r.radiusnumber
$r.rigidboolean
$r.showCoordsWhenDraggingboolean
$r.sideLengthnumber
$r.styleDescriptiontext
$r.styleDescriptionWithNountext
$r.vertices[ math ]
$r.verticesDraggableboolean

Examples Page 1

Example: Default <regularPolygon>

The default shape for a <regularPolygon> without any attributes specified is a triangle with radius 1 (where radius implies circumradius in this case), centered at the origin.


Example: <regularPolygon> with user-specified sides

In this example, the number of sides and side length are specified by the user with a <mathInput/> and a <slider/> component, respectively. These values are then referenced by the numSides and sideLength attributes of the <regularPolygon>. Note that the prefill attributes are required in this case; the values for these attributes cannot be null.


Example: Filled, colored <regularPolygon>

The filled attribute renders the polygon with default shading to match the styleNumber.


Example: Construct a polygon on a given line segment

Two vertices only of a <regularPolygon> are specified in the vertices attribute by referencing the endpoints of a defined <lineSegment>. Try tinkering with the number of sides in this example, or dragging the endpoints of the line segment.


Attribute Example: numVertices

The number of vertices of a regular polygon can be specified with the numVertices attribute.


Attribute Example: numSides

The number of sides of a regular polygon can be specified with the numSides attribute.


Attribute Example: center

The center of a regular polygon can be specified with the center attribute.

Note on precedence: the vertices and center attributes take precedence over the following attributes (in the event of overconstraint): radius / circumRadius, inRadius / apothem, sideLength, perimeter, and area.


Attribute Example: vertices

The endpoints of a known side can be specified with the vertices attribute, and Doenet will construct the resulting regular polygon (given a specified number of sides).

Note on precedence: the vertices and center attributes take precedence over the following attributes (in the event of overconstraint): radius / circumRadius, inRadius / apothem, sideLength, perimeter, and area.


Attribute Example: radius / circumRadius

The radius and circumRadius attributes are an interchangeable way to specify the distance from the center of a regular polygon to any of its vertices. (Note that the vertices attribute takes precedence in the case of overconstraint.)


Attribute Example: inRadius / apothem

The inRadius and apothem attributes are an interchangeable way to specify the distance from the center of a regular polygon to the midpoint of any of its sides. (Note that the vertices attribute takes precedence in the case of overconstraint.)


Attribute Example: sideLength

The sideLength attribute can be used to adjust the size of the regular polygon. (Note that the vertices attribute takes precedence in the case of overconstraint.)


Attribute Example: perimeter

The perimeter attribute can be used to adjust the size of the regular polygon. (Note that the vertices attribute takes precedence in the case of overconstraint.)