Skip to main content

Kind

Enum Kind 

Source
pub enum Kind {
    Coincident,
    Concentric,
    Parallel,
    Perpendicular,
    Distance {
        value: Scalar,
    },
    Angle {
        value: Scalar,
    },
    Tangent,
    Path,
}
Expand description

What a constraint asks of its two features.

Variants§

§

Coincident

They touch: two points coincide, a point lies on a line or a plane, two lines are one, a line lies in a plane, two planes are one (facing either way).

§

Concentric

Two lines — axes, as a round edge or face has — are one.

§

Parallel

Lines and planes run parallel: two lines, two planes’ normals, a line along a plane.

§

Perpendicular

Lines and planes stand square: two lines, two planes, a line along a plane’s normal.

§

Distance

They are value apart: two points, a point and a line or a plane, or two parallel lines or planes, or a line parallel to a plane.

Fields

§value: Scalar
§

Angle

The lines (or planes’ normals) meet at value degrees.

Fields

§value: Scalar
§

Tangent

The second entity keeps touching the first, a face, flat or curved: a circle — a roller’s rim, a pin’s — keeps its radius off the face, its center on the face’s offset, a point stays on the face. A cam and its follower, a pin in a slot of any shape.

§

Path

The second entity — a point, a circle’s center — runs along the first, a curve: a path mate, a pin along a slot’s center line.

Implementations§

Source§

impl Kind

Source

pub fn label(&self) -> &'static str

Source

pub fn feet(&self) -> &'static [&'static str]

The names of the parameters of the foot point on the first entity it is kept at, each a value of the state: the curve’s t, the face’s u and v. None for a kind that keeps no point on a curve or a face.

Source

pub fn roles(&self) -> &'static [Role]

What an entity of a constraint of this kind can be, in the order its geometry is taken (see Kind::geometry): for one that touches or keeps a distance, a point before a line before a plane before a round face’s axis; for a concentric one, an axis; for one that turns, a direction.

A flat face is its plane before it is anything round: the cap of a revolved cylinder is a disc, a surface of revolution round the cylinder’s axis, and a part standing on it stands on the plane, not with the axis in it. Only a concentric mate wants the disc’s axis.

Source

pub fn geometry( &self, k: usize, shape: &Shape, surface: impl FnOnce() -> GeopResult<Option<NurbSurface3D>>, curve: impl FnOnce() -> GeopResult<Option<NurbCurve3D>>, ) -> GeopResult<Option<Geometry>>

The geometry the kth entity of a constraint of this kind contributes, shape — as the first of its Kind::roles it fits — and surface and curve, the wall of a face and the run of an edge, asked of a tangent’s first and of a path’s first only: of a tangent constraint, the face first and then the circle or the point that touches it; of a path, the curve and then the point that runs along it.

Source

pub fn needs(&self, k: usize) -> Option<&'static str>

What the kth entity of a constraint of this kind has to be, in words, where it is not what Kind::roles says: of a tangent and of a path, each entity something of its own.

Source

pub fn fits(&self, a: &Geometry, b: &Geometry) -> GeopResult<()>

Checks that it can hold between a and b at all: a distance between two lines, say, but no angle at a point.

Trait Implementations§

Source§

impl Clone for Kind

Source§

fn clone(&self) -> Kind

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 Copy for Kind

Source§

impl Debug for Kind

Source§

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

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

impl<'de> Deserialize<'de> for Kind

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 Kind

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Kind

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 Kind

Auto Trait Implementations§

§

impl Freeze for Kind

§

impl RefUnwindSafe for Kind

§

impl Send for Kind

§

impl Sync for Kind

§

impl Unpin for Kind

§

impl UnsafeUnpin for Kind

§

impl UnwindSafe for Kind

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.