<curve>

A curve defined by a function, parametric formulas, or control points

<curve> is a Graphical component that renders a spline within a <graph>.

Attributes and Properties

Attributes for <curve>

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

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

fillOpacity

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

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

nearestPointAsCurve

boolean. Default value: false. Whether nearest-point queries should treat this as a curve in the plane rather than a graph y = f(x).

numDiscretizationPoints

number. 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).

periodic

boolean. Default value: false. Whether the curve is treated as periodic when interpolating between control points.

showCoordsWhenDragging

boolean. Default value: true. Whether to show coordinate labels while dragging the curve.

keyword. Form of spline used to interpolate between control points.

ValueDescription
centripetal (default)Centripetal Catmull-Rom spline (avoids self-intersection at sharp turns).
uniformUniform 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: \(x\). Name of the curve's parameter or independent variable.

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 <curve name="c">

Number display (5)
$c.avoidScientificNotation

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

$c.displayDecimals

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

$c.displayDigits

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

$c.displaySmallAsZero

number. Threshold below which numbers are displayed as zero.

$c.padZeros

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

Labels (2)
$c.label

label. The label rendered with this component.

$c.labelIsName

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

Other (36)
$c.applyStyleToLabel

boolean. 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.disabled

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

$c.draggable

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

$c.extrapolateBackward

boolean. Whether to extrapolate the curve before its first defined point.

$c.extrapolateBackwardMode

text. The extrapolation style used before the first through-point (e.g., 'line', 'parabolaHorizontal', 'parabolaVertical').

$c.extrapolateForward

boolean. Whether to extrapolate the curve beyond its last defined point.

$c.extrapolateForwardMode

text. The extrapolation style used beyond the last through-point (e.g., 'line', 'parabolaHorizontal', 'parabolaVertical').

$c.f

function. The first component function of the curve as a function of its parameter.

$c.fixed

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

$c.fixLocation

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

$c.flipFunction

boolean. 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.hidden

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

[ boolean ]. Whether each control vector is currently hidden.

$c.labelPosition

text. Position of the curve's label relative to the curve.

$c.layer

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

number. 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.parMax

number. Maximum value of the curve's parameter.

$c.parMin

number. Minimum value of the curve's parameter.

$c.periodic

boolean. Whether the curve is treated as periodic when interpolating between control points.

$c.showCoordsWhenDragging

boolean. Whether to show coordinate labels while dragging the curve.

$c.splineForm

text. Form of spline used to interpolate between control points.

$c.splineTension

number. Tension parameter used when fitting a spline through control points.

$c.styleDescription

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

$c.styleDescriptionWithNoun

text. 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.doenetML

text. The DoenetML source code that produced this component.

$c.hide

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

$c.isResponse

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

$c.styleNumber

integer. 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 xx-coordinates and yy-coordinates defining the <curve>.