Skip to main content

Constraint

Type Alias Constraint 

Source
pub type Constraint = Constraint;
Expand description

A sketch constraint as a program holds it.

Aliased Type§

pub enum Constraint {
Show 26 variants Coincident { a: PointId, b: PointId, }, PointOnCurve { point: PointId, curve: CurveId, }, Horizontal { line: CurveId, }, Vertical { line: CurveId, }, Parallel { a: CurveId, b: CurveId, }, Perpendicular { a: CurveId, b: CurveId, }, Collinear { a: CurveId, b: CurveId, }, Tangent { a: CurveId, b: CurveId, }, Equal { a: CurveId, b: CurveId, }, Concentric { a: CurveId, b: CurveId, }, Center { point: PointId, curve: CurveId, }, Midpoint { point: PointId, curve: CurveId, }, Symmetric { a: PointId, b: PointId, line: CurveId, }, Fix { point: PointId, x: Scalar, y: Scalar, }, Distance { a: PointId, b: PointId, value: Scalar, }, DistanceX { a: PointId, b: PointId, value: Scalar, }, DistanceY { a: PointId, b: PointId, value: Scalar, }, PointLineDistance { point: PointId, line: CurveId, value: Scalar, }, Length { curve: CurveId, value: Scalar, }, Radius { curve: CurveId, value: Scalar, }, Diameter { curve: CurveId, value: Scalar, }, Angle { a: CurveId, b: CurveId, value: Scalar, }, Moved { a: PointId, b: PointId, by: CurveId, }, EqualSweep { a: CurveId, b: CurveId, }, Offset { a: CurveId, b: CurveId, value: Scalar, }, OffsetAt { a: CurveId, at: Scalar, b: CurveId, on: Scalar, by: CurveId, across: bool, },
}

Variants§

§

Coincident

a and b are the same point.

Fields

§

PointOnCurve

point lies on curve (a line’s infinite extension, an arc’s full circle, or a circle).

Fields

§point: PointId
§curve: CurveId
§

Horizontal

Fields

§line: CurveId
§

Vertical

Fields

§line: CurveId
§

Parallel

Fields

§

Perpendicular

Fields

§

Collinear

Two lines on one infinite line.

Fields

§

Tangent

Two curves meet tangentially: at a shared endpoint if they have one (lines, arcs and splines), else a line touching a circle/arc, or two circles/arcs touching each other.

Fields

§

Equal

Equal length (two lines) or equal radius (two circles/arcs).

Fields

§

Concentric

Two circles/arcs share a center.

Fields

§

Center

point is the center of a circle or arc.

Fields

§point: PointId
§curve: CurveId
§

Midpoint

point is the midpoint of a line or arc.

Fields

§point: PointId
§curve: CurveId
§

Symmetric

a and b are mirror images across line.

Fields

§line: CurveId
§

Fix

point stays at (x, y).

Fields

§point: PointId
§

Distance

Fields

§value: Scalar
§

DistanceX

b.x - a.x = value.

Fields

§value: Scalar
§

DistanceY

b.y - a.y = value.

Fields

§value: Scalar
§

PointLineDistance

Fields

§point: PointId
§line: CurveId
§value: Scalar
§

Length

Length of a line or arc.

Fields

§curve: CurveId
§value: Scalar
§

Radius

Radius of a circle or arc.

Fields

§curve: CurveId
§value: Scalar
§

Diameter

Diameter of a circle or arc.

Fields

§curve: CurveId
§value: Scalar
§

Angle

The counter-clockwise angle from line a’s direction to line b’s.

Fields

§value: Scalar
§

Moved

b is a moved the way by carries its start onto its end: along a line, shifted by it; round an arc, turned about the arc’s center by its sweep. How a pattern’s copies follow what they copy (see [crate::copies]).

§

EqualSweep

Two arcs turn by the same angle: an arc whose ends are the images of another’s, under a motion or a reflection, is then its image.

Fields

§

Offset

b runs value from a: two parallel lines value apart, or two concentric circles/arcs whose radii differ by value (see [crate::offset]).

Fields

§value: Scalar
§

OffsetAt

The point on along the spline b lies the radius of the circle by from the point at along the spline a, along a’s normal there — or, across, only that far across it: anywhere on the line a’s offset runs along there. Each as a fraction of the spline’s domain. The offset of a spline is no spline: a spline fitted through such points is held to it (see [crate::offset]).