Constraint built-ins
Constraints relate Float expressions; the solver finds geometry that satisfies them. For an equality constraint with a label the GUI draws, see std::layout::dimension.
float
float() -> Float
Creates a new solver variable.
Use it for a value you want to name now and constrain later.
Returns Float. A variable with no constraints on it yet.
let center = float();
eq(center, (bounds.x0 + bounds.x1) / 2.);
eq
eq(left: Float, right: Float) -> ()
Constrains two linear expressions to be equal.
| Argument | Type | Requirement | Description |
|---|---|---|---|
left | Float | Required, positional | One side of the equality: a literal, parameter, geometry field, or linear combination of them. |
right | Float | Required, positional | The other side. |
Returns (). Nothing; the constraint is added to the current cell.
eq(inner.x0, outer.x0 + inset);
eq(inner.w, outer.w - 2. * inset);
Conflicting constraints are reported when the cell runs.