Skip to main content

Constraint

Enum Constraint 

Source
pub enum Constraint {
    Outside {
        a: String,
        b: String,
        clash_dist: f64,
        strength: f64,
    },
    Inside {
        a: String,
        b: String,
        pad: f64,
        strength: f64,
    },
    MinGap {
        a: String,
        b: String,
        dist: f64,
        strength: f64,
    },
    PreferSide {
        a: String,
        b: String,
        side: Side,
        strength: f64,
        align_along: f64,
    },
    PointStandoff {
        tip: String,
        target: String,
        dist: f64,
        strength: f64,
    },
    MinimizeDist {
        a: String,
        b: String,
        opt_dist: f64,
        strength: f64,
    },
    PreferPose {
        a: String,
        x: f64,
        y: f64,
        strength: f64,
    },
    PolyCross {
        a: String,
        b: String,
        strength: f64,
    },
    Collinear {
        a: String,
        b: String,
        c: String,
        strength: f64,
    },
    RayThrough {
        a: String,
        b: String,
        p: String,
        strength: f64,
    },
    Parallel {
        a: String,
        b: String,
        strength: f64,
    },
    Midpoint {
        a: String,
        b: String,
        strength: f64,
    },
}
Expand description

Soft constraint forms emitted by type kits.

Variants§

§

Outside

a should stay outside b by at least clash_dist (edge gap).

Fields

§clash_dist: f64
§strength: f64
§

Inside

a should stay inside b by at least pad. Energy is strength * g⁺² using the same residual as HardConstraint::Inside.

Fields

§pad: f64
§strength: f64
§

MinGap

Fields

§dist: f64
§strength: f64
§

PreferSide

Fields

§side: Side
§strength: f64
§align_along: f64

Extra spring along the edge, as a fraction of strength (Left/Right → match b’s y; Above/Below → match x). 0 is hinge only — the solver does not infer this from b’s shape.

§

PointStandoff

Fields

§target: String
§dist: f64
§strength: f64
§

MinimizeDist

Fields

§opt_dist: f64
§strength: f64
§

PreferPose

Spring the object’s center (or point) to a placement (x, y).

This is the preferred paint position (centered caption, side hug, callout standoff, atom-label seed). Clash terms can spend this energy to move off an obstacle; with a clear field the minimum is this pose.

Fields

§strength: f64
§

PolyCross

Soft energy when two open polylines / lines have a proper (transverse) intersection. Kits that should not uncross an existing X simply omit this row for that pair.

Fields

§strength: f64
§

Collinear

b should sit on the segment a → c (squared perp distance, plus hinges if b is behind a or past c). Scheme arrows use this so the shaft keeps its seed orientation while the endpoint extends toward a mol centroid without crossing to the far side.

Fields

§strength: f64
§

RayThrough

Squared perpendicular distance from p to the infinite line a → b. Unlike Constraint::Collinear, does not hinge on the segment parameter.

Fields

§strength: f64
§

Parallel

a.rot should match the local tangent of b (mod 180°: lines have no direction). Extra DOF: [LayoutNode::rot] is packed after (tx, ty) only for nodes that appear as a here. Kits flip upside-down text 180° after the solve.

Fields

§strength: f64
§

Midpoint

Spring a’s anchor to the live midpoint of b (arc-length mid of a painted open polyline; otherwise the shape center).

Fields

§strength: f64

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

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V