<ray>

A ray starting at one point passing through another

<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:

  1. the endpoint and the through attributes
  2. the endpoint and the direction attributes

Attributes and Properties

Attributes for <ray>

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 (9)
applyStyleToLabel

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

direction

[ vector ]. The direction the ray points in.

draggable

boolean. Default value: true. Whether the ray can be dragged on a graph.

endpoint

[ point ]. The starting point (endpoint) of the ray.

labelPosition

keyword. Where the label sits along this line/curve.

ValueDescription
upperRightPlace the label above and to the right of the line.
upperLeftPlace the label above and to the left of the line.
lowerRightPlace the label below and to the right of the line.
lowerLeftPlace the label below and to the left of the line.
center (default)Place the label at the midpoint of the line.
topPlace the label directly above the line.
bottomPlace the label directly below the line.
leftPlace the label directly to the left of the line.
rightPlace the label directly to the right of the line.
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.

through

[ point ]. A point the ray passes through (used with endpoint or direction).

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 <ray name="r">

Number display (5)
$r.avoidScientificNotation

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

$r.displayDecimals

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

$r.displayDigits

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

$r.displaySmallAsZero

number. Threshold below which numbers are displayed as zero.

$r.padZeros

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

Labels (2)
$r.label

label. The label rendered with this component.

$r.labelIsName

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

Other (14)
$r.applyStyleToLabel

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

$r.direction

[ math ]. The direction vector of the ray.

$r.disabled

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

$r.draggable

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

$r.endpoint

[ math ]. The starting endpoint of the ray.

$r.fixed

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

$r.fixLocation

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

$r.hidden

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

$r.labelPosition

text. Where the label sits along this line/curve.

$r.layer

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

$r.numDimensions

number. Number of dimensions the ray lives in.

$r.styleDescription

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

$r.styleDescriptionWithNoun

text. Style description including the word "ray".

$r.through

[ math ]. A point the ray passes through.

Common to all components (4)
$r.doenetML

text. The DoenetML source code that produced this component.

$r.hide

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

$r.isResponse

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

$r.styleNumber

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

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.