<constrainTo>
<constrainTo> is a Graphical component
used within a <constraints> block to constrain a <point> to
another named graphical component (such as a <line> or a <function>).
Attributes and Properties
| Attribute | Type | Values |
|---|---|---|
relativeToGraphScales = "…" | boolean | "true" "false" |
| Property | Type |
|---|---|
$c.disabled | boolean |
$c.fixed | boolean |
$c.fixLocation | boolean |
$c.hidden | boolean |
$c.relativeToGraphScales | boolean |
Example: Constrain a <point> to a <circle>
The <point> named car is constrained to the <circle> named
raceTrack using the <constrainTo> component within the <constraints> block.
Example: Constrain a <circle> to a <line>
To constrain geometric objects other than points,
first define a named <point> with the desired
constraint, and then reference that point within the
definition of the geometric object.
The original <point> can be hidden using the hide attribute.
Example: Construct a draggable tangent <line>
A tangent <line> to a <function> is defined by
referencing a constrained <point> in the <through>
attribute of the <line> component.
The slope of the <line> as the user drags the <point>
is computed by evaluating the <derivative> of the
named <function> at the referenced x property of the <point>.