<triangle>
<triangle> is a Graphical
component that renders a triangle when nested inside a <graph> component.
Attributes and Properties
Attributes for <triangle>
Number display (5)
avoidScientificNotationboolean. Default value: false. Whether to render numbers in full decimal form rather than scientific notation.
displayDecimalsinteger. Default value: 2. Number of decimal places to display when rendering this number.
displayDigitsinteger. Default value: 3. Number of significant digits to display when rendering this number.
displaySmallAsZeronumber. Default value: 1e-14. Threshold below which numbers are displayed as zero.
padZerosboolean. Default value: false. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Labels (1)
labelIsNameboolean. Default value: false. Whether to use this component's name as its rendered label.
Other (23)
addControlskeyword. Whether to render interactive vertex control handles.
| Value | Description |
|---|---|
center (default) | Show a control handle for moving the polygon's center. |
none | Show no control handles. |
allowDilationboolean. Default value: true. Whether the shape can be dilated (scaled) under drag.
allowReflectionboolean. Default value: true. Whether the polyline can be reflected under drag.
allowRotationboolean. Default value: true. Whether the polyline can be rotated under drag.
allowTranslationboolean. Default value: true. Whether the polyline can be translated under drag.
applyStyleToLabelboolean. Default value: false. Whether to apply this component's selected style to its label.
controlOrderinteger. Default value: 0. Slot order for graph controls (1-indexed; 0 means no explicit slot request).
boolean. Default value: true. Whether the polyline can be dragged on a graph.
boolean. Default value: false. Whether to fill the interior of the polygon.
fillOpacitynumber. Opacity of fills, 0 to 1.
layerinteger. Default value: 0. Z-order layer index used to stack graphical components (higher values render on top).
lineStylekeyword. Stroke style for lines.
| Value | Description |
|---|---|
solid | Continuous, unbroken stroke. |
dashed | Stroke composed of evenly-spaced dashes. |
dotted | Stroke composed of evenly-spaced dots. |
lineWidthnumber. Stroke width for lines, in pixels.
minShrinknumber. Default value: 0.1. Minimum scaling factor allowed when dilating.
preserveSimilarityboolean. Default value: false. Whether the shape is preserved up to similarity (uniform scaling) under drag.
rigidboolean. Default value: false. Whether the polyline is treated as rigid (preserves shape under drag).
rotateAroundkeyword. What point to rotate the shape around.
| Value | Description |
|---|---|
centroid (default) | Rotate around the centroid of the shape. |
vertex | Rotate around the vertex specified by rotationVertex. |
point | Rotate around the explicit point given by rotationCenter. |
rotationCenterpoint. The point to rotate around when rotateAround is 'point'.
rotationHandleVerticesnumberList. Default value: [1]. Vertex indices that should display rotation handles when the shape is rigid or preserves similarity.
rotationVertexinteger. Default value: 1. The vertex index to rotate around when rotateAround is 'vertex'.
showCoordsWhenDraggingboolean. Default value: true. Whether to show coordinate labels while dragging.
[ pointList ]. The list of vertex points that define the shape.
boolean. Whether individual vertices may be dragged independently.
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <triangle name="t">
Number display (5)
$t.avoidScientificNotationboolean. Whether to render numbers in full decimal form rather than scientific notation.
$t.displayDecimalsinteger. Number of decimal places to display when rendering this number.
$t.displayDigitsinteger. Number of significant digits to display when rendering this number.
$t.displaySmallAsZeronumber. Threshold below which numbers are displayed as zero.
$t.padZerosboolean. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Labels (2)
$t.labellabel. The label rendered with this component.
$t.labelIsNameboolean. Whether to use this component's name as its rendered label.
Other (29)
$t.addControlstext. Whether to render interactive vertex control handles.
$t.allowDilationboolean. Whether the polyline can be dilated under drag.
$t.allowReflectionboolean. Whether the polyline can be reflected under drag.
$t.allowRotationboolean. Whether the polyline can be rotated under drag.
$t.allowTranslationboolean. Whether the polyline can be translated under drag.
$t.applyStyleToLabelboolean. Whether to apply this component's selected style to its label.
$t.areanumber. The area enclosed by the polygon.
$t.borderStyleDescriptiontext. A textual description of the polygon's border style.
$t.center[ math ]. The centroid of the polyline's vertices.
$t.controlOrderinteger. Slot order for graph controls (1-indexed; 0 means no explicit slot request).
$t.disabledboolean. Whether this component is disabled and cannot be interacted with.
$t.draggableboolean. Whether the polyline can be dragged on a graph.
$t.filledboolean. Whether to fill the interior of the polygon.
$t.fillStyleDescriptiontext. A textual description of the polygon's fill style.
$t.fixedboolean. Whether this component's value is fixed and cannot be modified.
$t.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$t.layerinteger. Z-order layer index used to stack graphical components (higher values render on top).
$t.numDimensionsnumber. The number of dimensions the polyline lives in.
$t.numSidesnumber. The number of sides of the polygon.
$t.numVerticesnumber. The number of vertices (always 3 for a triangle).
$t.perimeternumber. The perimeter of the polygon.
$t.preserveSimilarityboolean. Whether the polyline preserves its shape (up to similarity).
$t.rigidboolean. Whether the polyline is treated as rigid (preserves shape under drag).
$t.showCoordsWhenDraggingboolean. Whether to show coordinate labels while dragging.
$t.styleDescriptiontext. A textual description of the polygon's style.
$t.styleDescriptionWithNountext. Style description including the word "polygon".
$t.vertices[ math ]. The vertices of the polyline.
$t.verticesDraggableboolean. Whether each vertex can be dragged independently.
Common to all components (4)
$t.doenetMLtext. The DoenetML source code that produced this component.
$t.hideboolean. Whether to hide this component from the rendered output.
$t.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$t.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: Default <triangle>
The default <triangle> has vertices at and
Example: <triangle> constrained to a grid
The vertices of a <triangle> are predefined as constrained points, thereby constraining the triangle to a grid as well.
Attribute Examples
Attribute Example: vertices
The vertices attribute takes a list of points as its input.
Attribute Example: filled
The filled attribute renders the triangle with default shading to match the styleNumber.
Attribute Example: draggable
The draggable attribute determines whether the <triangle> can be dragged around the <graph>. All graphical objects are draggable by default.
Attribute Example: verticesDraggable
Vertices are draggable by default. Use the verticesDraggable attribute set to false to disable users from changing the proportions of the <triangle>. The triangle as a whole can still be repositioned on the <graph>.
Attribute Example: Standard graphical attributes
The uses of the following standard graphical attributes are illustrated: hide, fixLocation, layer, styleNumber, applyStyleToLabel and labelIsName.
Property Examples
Property Example: Style properties
The styleDescription, styleDescriptionWithNoun, fillStyleDescription, and borderStyleDescription properties render a text description corresponding to the styleNumber of the component.