Skip to main content

Constraint

Enum Constraint 

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

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

§

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: f64
§

DistanceX

b.x - a.x = value.

Fields

§value: f64
§

DistanceY

b.y - a.y = value.

Fields

§value: f64
§

PointLineDistance

Fields

§point: PointId
§line: CurveId
§value: f64
§

Length

Length of a line or arc.

Fields

§curve: CurveId
§value: f64
§

Radius

Radius of a circle or arc.

Fields

§curve: CurveId
§value: f64
§

Angle

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

Fields

§value: f64

Implementations§

Source§

impl Constraint

Source

pub fn points(&self) -> Vec<PointId>

The points this constraint refers to directly (curves aside).

Trait Implementations§

Source§

impl Clone for Constraint

Source§

fn clone(&self) -> Constraint

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Constraint

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Constraint

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Constraint

Source§

fn eq(&self, other: &Constraint) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Constraint

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Constraint

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.