<ray>
<ray> is a Graphical
component that renders a geometrical ray (one endpoint; the opposite side continuous), when
nested inside a <graph>.
A <ray> may be specified with:
- the
endpointand thethroughattributes - the
endpointand thedirectionattributes
Attributes and Properties
Attributes for <ray>
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 (9)
applyStyleToLabelboolean. Default value: false. Whether to apply this component's selected style to its label.
direction[ vector ]. The direction the ray points in.
draggableboolean. Default value: true. Whether the ray can be dragged on a graph.
endpoint[ point ]. The starting point (endpoint) of the ray.
labelPositionkeyword. Where the label sits along this line/curve.
| Value | Description |
|---|---|
upperRight | Place the label above and to the right of the line. |
upperLeft | Place the label above and to the left of the line. |
lowerRight | Place the label below and to the right of the line. |
lowerLeft | Place the label below and to the left of the line. |
center (default) | Place the label at the midpoint of the line. |
top | Place the label directly above the line. |
bottom | Place the label directly below the line. |
left | Place the label directly to the left of the line. |
right | Place the label directly to the right of the line. |
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.
through[ point ]. A point the ray passes through (used with endpoint or direction).
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 <ray name="r">
Number display (5)
$r.avoidScientificNotationboolean. Whether to render numbers in full decimal form rather than scientific notation.
$r.displayDecimalsinteger. Number of decimal places to display when rendering this number.
$r.displayDigitsinteger. Number of significant digits to display when rendering this number.
$r.displaySmallAsZeronumber. Threshold below which numbers are displayed as zero.
$r.padZerosboolean. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Labels (2)
$r.labellabel. The label rendered with this component.
$r.labelIsNameboolean. Whether to use this component's name as its rendered label.
Other (14)
$r.applyStyleToLabelboolean. Whether to apply this component's selected style to its label.
$r.direction[ math ]. The direction vector of the ray.
$r.disabledboolean. Whether this component is disabled and cannot be interacted with.
$r.draggableboolean. Whether the ray can be dragged on a graph.
$r.endpoint[ math ]. The starting endpoint of the ray.
$r.fixedboolean. Whether this component's value is fixed and cannot be modified.
$r.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$r.labelPositiontext. Where the label sits along this line/curve.
$r.layerinteger. Z-order layer index used to stack graphical components (higher values render on top).
$r.numDimensionsnumber. Number of dimensions the ray lives in.
$r.styleDescriptiontext. A textual description of the ray's style.
$r.styleDescriptionWithNountext. Style description including the word "ray".
$r.through[ math ]. A point the ray passes through.
Common to all components (4)
$r.doenetMLtext. The DoenetML source code that produced this component.
$r.hideboolean. Whether to hide this component from the rendered output.
$r.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$r.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: <ray> defined directly
The <ray> component is defined directly by specifying coordinates within
the endpoint and through attributes. (Alternatively, a tuple may be directly
specified in the direction attribute).
The user can manipulate the position of the ray by dragging the ray itself, but
the direction remains constant.
Example: <ray> defined with rendered through-point
The <ray> component is used with the endpoint and through attributes. Note that, if no endpoint is specified, the default is .
The user can manipulate both the direction and the endpoint of the <ray> by dragging the points.
Example: <ray> defined with endpoint and direction
If both the through and direction attributes are specified and not consistent, Doenet prioritizes the direction.
Example: Adjust direction of a <ray>
If the direction attribute references another component, such as a <vector> or a <mathInput/>, the user can manipulate the direction of the line segment.