Referencetriangle

<triangle>

A triangle defined by three vertices

<triangle> is a Graphical component that renders a triangle when nested inside a <graph> component.

Attributes and Properties

Attributes for <triangle>

Number display (5)
avoidScientificNotation

boolean. Default value: false. Whether to render numbers in full decimal form rather than scientific notation.

displayDecimals

integer. Default value: 2. Number of decimal places to display when rendering this number.

displayDigits

integer. Default value: 3. Number of significant digits to display when rendering this number.

displaySmallAsZero

number. Default value: 1e-14. Threshold below which numbers are displayed as zero.

padZeros

boolean. Default value: false. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.

Labels (1)
labelIsName

boolean. Default value: false. Whether to use this component's name as its rendered label.

Other (23)
addControls

keyword. Whether to render interactive vertex control handles.

ValueDescription
center (default)Show a control handle for moving the polygon's center.
noneShow no control handles.
allowDilation

boolean. Default value: true. Whether the shape can be dilated (scaled) under drag.

allowReflection

boolean. Default value: true. Whether the polyline can be reflected under drag.

allowRotation

boolean. Default value: true. Whether the polyline can be rotated under drag.

allowTranslation

boolean. Default value: true. Whether the polyline can be translated under drag.

applyStyleToLabel

boolean. Default value: false. Whether to apply this component's selected style to its label.

controlOrder

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

fillOpacity

number. Opacity of fills, 0 to 1.

layer

integer. Default value: 0. Z-order layer index used to stack graphical components (higher values render on top).

lineStyle

keyword. Stroke style for lines.

ValueDescription
solidContinuous, unbroken stroke.
dashedStroke composed of evenly-spaced dashes.
dottedStroke composed of evenly-spaced dots.
lineWidth

number. Stroke width for lines, in pixels.

minShrink

number. Default value: 0.1. Minimum scaling factor allowed when dilating.

preserveSimilarity

boolean. Default value: false. Whether the shape is preserved up to similarity (uniform scaling) under drag.

rigid

boolean. Default value: false. Whether the polyline is treated as rigid (preserves shape under drag).

rotateAround

keyword. What point to rotate the shape around.

ValueDescription
centroid (default)Rotate around the centroid of the shape.
vertexRotate around the vertex specified by rotationVertex.
pointRotate around the explicit point given by rotationCenter.
rotationCenter

point. The point to rotate around when rotateAround is 'point'.

rotationHandleVertices

numberList. Default value: [1]. Vertex indices that should display rotation handles when the shape is rigid or preserves similarity.

rotationVertex

integer. Default value: 1. The vertex index to rotate around when rotateAround is 'vertex'.

showCoordsWhenDragging

boolean. 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)
copy

reference. Create an independent copy of another component by reference. Enter a references a $name.

disabled

boolean. Default value: false. Whether this component is disabled and cannot be interacted with.

extend

reference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.

fixed

boolean. Default value: false. Whether this component's value is fixed and cannot be modified.

fixLocation

boolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

hide

boolean. Default value: false. Whether to hide this component from the rendered output.

isResponse

boolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.

name

text. The name used to reference this component from elsewhere in the document.

styleNumber

integer. 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.avoidScientificNotation

boolean. Whether to render numbers in full decimal form rather than scientific notation.

$t.displayDecimals

integer. Number of decimal places to display when rendering this number.

$t.displayDigits

integer. Number of significant digits to display when rendering this number.

$t.displaySmallAsZero

number. Threshold below which numbers are displayed as zero.

$t.padZeros

boolean. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.

Labels (2)
$t.label

label. The label rendered with this component.

$t.labelIsName

boolean. Whether to use this component's name as its rendered label.

Other (29)
$t.addControls

text. Whether to render interactive vertex control handles.

$t.allowDilation

boolean. Whether the polyline can be dilated under drag.

$t.allowReflection

boolean. Whether the polyline can be reflected under drag.

$t.allowRotation

boolean. Whether the polyline can be rotated under drag.

$t.allowTranslation

boolean. Whether the polyline can be translated under drag.

$t.applyStyleToLabel

boolean. Whether to apply this component's selected style to its label.

$t.area

number. The area enclosed by the polygon.

$t.borderStyleDescription

text. A textual description of the polygon's border style.

$t.center

[ math ]. The centroid of the polyline's vertices.

$t.controlOrder

integer. Slot order for graph controls (1-indexed; 0 means no explicit slot request).

$t.disabled

boolean. Whether this component is disabled and cannot be interacted with.

$t.draggable

boolean. Whether the polyline can be dragged on a graph.

$t.filled

boolean. Whether to fill the interior of the polygon.

$t.fillStyleDescription

text. A textual description of the polygon's fill style.

$t.fixed

boolean. Whether this component's value is fixed and cannot be modified.

$t.fixLocation

boolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

$t.hidden

boolean. Whether this component is hidden from the rendered output.

$t.layer

integer. Z-order layer index used to stack graphical components (higher values render on top).

$t.numDimensions

number. The number of dimensions the polyline lives in.

$t.numSides

number. The number of sides of the polygon.

$t.numVertices

number. The number of vertices (always 3 for a triangle).

$t.perimeter

number. The perimeter of the polygon.

$t.preserveSimilarity

boolean. Whether the polyline preserves its shape (up to similarity).

$t.rigid

boolean. Whether the polyline is treated as rigid (preserves shape under drag).

$t.showCoordsWhenDragging

boolean. Whether to show coordinate labels while dragging.

$t.styleDescription

text. A textual description of the polygon's style.

$t.styleDescriptionWithNoun

text. Style description including the word "polygon".

$t.vertices

[ math ]. The vertices of the polyline.

$t.verticesDraggable

boolean. Whether each vertex can be dragged independently.

Common to all components (4)
$t.doenetML

text. The DoenetML source code that produced this component.

$t.hide

boolean. Whether to hide this component from the rendered output.

$t.isResponse

boolean. Whether this component is treated as a response for the purposes of assessment.

$t.styleNumber

integer. 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 (0,0),(1,0)(0,0), (1,0) and (0,1)(0,1)


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.