<curve>
<curve> is a Graphical
component that renders a spline within a <graph>.
Attributes and Properties
Attributes for <curve>
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 (20)
applyStyleToLabelboolean. Default value: false. Whether to apply this component's selected style to its label.
boolean. Default value: true. Whether the curve can be dragged on a graph.
boolean. Default value: false. Whether to extrapolate the curve before its first defined point.
boolean. Default value: false. Whether to extrapolate the curve beyond its last defined point.
fillOpacitynumber. Opacity of fills, 0 to 1.
boolean. Default value: false. Whether to swap the function and its argument (i.e., reflect across y=x).
keyword. Position of the curve's label relative to the curve.
| Value | Description |
|---|---|
upperRight (default) | Place the label above and to the right of the curve. |
upperLeft | Place the label above and to the left of the curve. |
lowerRight | Place the label below and to the right of the curve. |
lowerLeft | Place the label below and to the left of the curve. |
top | Place the label directly above the curve. |
bottom | Place the label directly below the curve. |
left | Place the label directly to the left of the curve. |
right | Place the label directly to the right of the curve. |
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.
nearestPointAsCurveboolean. Default value: false. Whether nearest-point queries should treat this as a curve in the plane rather than a graph y = f(x).
numDiscretizationPointsnumber. Default value: 1000. Number of points used when discretizing the curve for rendering.
math. Maximum value of the curve's parameter (for parametric curves).
math. Minimum value of the curve's parameter (for parametric curves).
periodicboolean. Default value: false. Whether the curve is treated as periodic when interpolating between control points.
showCoordsWhenDraggingboolean. Default value: true. Whether to show coordinate labels while dragging the curve.
keyword. Form of spline used to interpolate between control points.
| Value | Description |
|---|---|
centripetal (default) | Centripetal Catmull-Rom spline (avoids self-intersection at sharp turns). |
uniform | Uniform Catmull-Rom spline with evenly spaced parameterization. |
number. Default value: 0.8. Tension parameter used when fitting a spline through control points.
pointList. Points the interpolated curve passes through.
_variableName. Default value: . Name of the curve's parameter or independent variable.
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 <curve name="c">
Number display (5)
$c.avoidScientificNotationboolean. Whether to render numbers in full decimal form rather than scientific notation.
$c.displayDecimalsinteger. Number of decimal places to display when rendering this number.
$c.displayDigitsinteger. Number of significant digits to display when rendering this number.
$c.displaySmallAsZeronumber. Threshold below which numbers are displayed as zero.
$c.padZerosboolean. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Labels (2)
$c.labellabel. The label rendered with this component.
$c.labelIsNameboolean. Whether to use this component's name as its rendered label.
Other (36)
$c.applyStyleToLabelboolean. Whether to apply this component's selected style to its label.
[ math ]. The Bezier control points (vertex + offset) for each through-point.
[ math ]. The Bezier control vectors at each through-point.
[ number ]. Points where the curve's curvature changes sign (inflection points).
$c.disabledboolean. Whether this component is disabled and cannot be interacted with.
$c.draggableboolean. Whether the curve can be dragged on a graph.
$c.extrapolateBackwardboolean. Whether to extrapolate the curve before its first defined point.
$c.extrapolateBackwardModetext. The extrapolation style used before the first through-point (e.g., 'line', 'parabolaHorizontal', 'parabolaVertical').
$c.extrapolateForwardboolean. Whether to extrapolate the curve beyond its last defined point.
$c.extrapolateForwardModetext. The extrapolation style used beyond the last through-point (e.g., 'line', 'parabolaHorizontal', 'parabolaVertical').
$c.ffunction. The first component function of the curve as a function of its parameter.
$c.fixedboolean. Whether this component's value is fixed and cannot be modified.
$c.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$c.flipFunctionboolean. Whether to swap the function and its argument (i.e., reflect across y=x).
$c.fs[ function ]. The component functions of the curve as functions of its parameter.
$c.labelPositiontext. Position of the curve's label relative to the curve.
$c.layerinteger. Z-order layer index used to stack graphical components (higher values render on top).
integer. The number of points where the curve's curvature changes sign.
number. Number of dimensions the curve lives in.
$c.numDiscretizationPointsnumber. Number of points used when discretizing the curve for rendering.
integer. The number of x-critical points (horizontal tangents) on the curve.
integer. The number of y-critical points (vertical tangents) on the curve.
$c.parMaxnumber. Maximum value of the curve's parameter.
$c.parMinnumber. Minimum value of the curve's parameter.
$c.periodicboolean. Whether the curve is treated as periodic when interpolating between control points.
$c.showCoordsWhenDraggingboolean. Whether to show coordinate labels while dragging the curve.
$c.splineFormtext. Form of spline used to interpolate between control points.
$c.splineTensionnumber. Tension parameter used when fitting a spline through control points.
$c.styleDescriptiontext. A textual description of the curve's style.
$c.styleDescriptionWithNountext. Style description including the word "curve".
[ math ]. Points the curve is constrained to pass through.
[ text ]. Direction symmetry of each control vector pair.
[ number ]. The x-critical points (horizontal tangents) on the curve.
[ number ]. The y-critical points (vertical tangents) on the curve.
Common to all components (4)
$c.doenetMLtext. The DoenetML source code that produced this component.
$c.hideboolean. Whether to hide this component from the rendered output.
$c.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$c.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: <curve> through 4 points
A <curve> is constructed through four points specified in the through attribute.
Example: <curve> through 4 points with bezier controls
A <curve> is constructed through four points specified in
the through attribute. The shape of the curve at its through points
is specified with <bezierControls>. When <bezierControls> are
specified, draggable handles appear on the <graph> when the
through points are clicked.
Example: Parametric equation of an ellipse
Parametric equations can be constructed with the <curve> component
by assigning a parameter with the variable attribute and
providing function children for the -coordinates and -coordinates
defining the <curve>.