pub enum Constraint {
Show 20 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,
},
Midpoint {
point: PointId,
curve: CurveId,
},
Symmetric {
a: PointId,
b: PointId,
line: CurveId,
},
Fix {
point: PointId,
x: f64,
y: f64,
},
Distance {
a: PointId,
b: PointId,
value: f64,
},
DistanceX {
a: PointId,
b: PointId,
value: f64,
},
DistanceY {
a: PointId,
b: PointId,
value: f64,
},
PointLineDistance {
point: PointId,
line: CurveId,
value: f64,
},
Length {
curve: CurveId,
value: f64,
},
Radius {
curve: CurveId,
value: f64,
},
Angle {
a: CurveId,
b: CurveId,
value: f64,
},
}Expand description
The typical CAD sketch constraints. Distances and lengths are in sketch units, angles in radians.
Variants§
Coincident
a and b are the same point.
PointOnCurve
point lies on curve (a line’s infinite extension, an arc’s full
circle, or a circle).
Horizontal
Vertical
Parallel
Perpendicular
Collinear
Two lines on one infinite line.
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.
Equal
Equal length (two lines) or equal radius (two circles/arcs).
Concentric
Two circles/arcs share a center.
Midpoint
point is the midpoint of a line or arc.
Symmetric
a and b are mirror images across line.
Fix
point stays at (x, y).
Distance
DistanceX
b.x - a.x = value.
DistanceY
b.y - a.y = value.
PointLineDistance
Length
Length of a line or arc.
Radius
Radius of a circle or arc.
Angle
The counter-clockwise angle from line a’s direction to line b’s.
Implementations§
Trait Implementations§
Source§impl Clone for Constraint
impl Clone for Constraint
Source§fn clone(&self) -> Constraint
fn clone(&self) -> Constraint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Constraint
impl Debug for Constraint
Source§impl<'de> Deserialize<'de> for Constraint
impl<'de> Deserialize<'de> for Constraint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for Constraint
impl PartialEq for Constraint
Source§fn eq(&self, other: &Constraint) -> bool
fn eq(&self, other: &Constraint) -> bool
self and other values to be equal, and is used by ==.