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).
Inside
a should stay inside b by at least pad. Energy is strength * g⁺²
using the same residual as HardConstraint::Inside.
MinGap
PreferSide
Fields
side: SidePointStandoff
MinimizeDist
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.
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.
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.
RayThrough
Squared perpendicular distance from p to the infinite line a → b.
Unlike Constraint::Collinear, does not hinge on the segment parameter.
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.
Midpoint
Spring a’s anchor to the live midpoint of b (arc-length mid of a
painted open polyline; otherwise the shape center).
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 moreAuto Trait Implementations§
impl Freeze for Constraint
impl RefUnwindSafe for Constraint
impl Send for Constraint
impl Sync for Constraint
impl Unpin for Constraint
impl UnsafeUnpin for Constraint
impl UnwindSafe for Constraint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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