pub struct CenterLineProfile {
pub path: Contour,
pub half_width: f64,
}Expand description
An open path swept by a constant width, centred on the path.
This is a representation, not a contour: the closed area it denotes is
the set of points within half_width of the path. Resolving it into a
boundary is an offsetting algorithm, which belongs above this tier.
Keeping it exact matters because offsetting is lossy in a way that cannot be undone. Once a centre line is flattened into an outline, the fact that it was a constant-width path is gone, and with it the ability to change the width, re-offset at a different tolerance, or round-trip the source unchanged. Sheet metal, curtain-wall mullions and pipe centre lines are all authored this way.
The path is held as a Contour because a centre line is a sequence of
bounded curve segments exactly like a boundary is; the difference is that
this one is not closed and does not enclose anything on its own.
Fields§
§path: ContourOpen path the width is measured from.
half_width: f64Half the constant width, measured perpendicular to the path.
Stored as a half-width rather than a full thickness so the two offset
sides are symmetric by construction: a consumer offsets by +half and
-half without having to remember to halve anything. Halving at the
boundary is the kind of factor-of-two error that produces geometry
which looks plausible and is wrong.
Implementations§
Source§impl CenterLineProfile
impl CenterLineProfile
Sourcepub fn from_width(path: Contour, width: f64) -> CenterLineProfile
pub fn from_width(path: Contour, width: f64) -> CenterLineProfile
Construct from an open path and the full width across it.
Trait Implementations§
Source§impl Clone for CenterLineProfile
impl Clone for CenterLineProfile
Source§fn clone(&self) -> CenterLineProfile
fn clone(&self) -> CenterLineProfile
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CenterLineProfile
impl Debug for CenterLineProfile
Source§impl PartialEq for CenterLineProfile
impl PartialEq for CenterLineProfile
impl StructuralPartialEq for CenterLineProfile
Auto Trait Implementations§
impl Freeze for CenterLineProfile
impl RefUnwindSafe for CenterLineProfile
impl Send for CenterLineProfile
impl Sync for CenterLineProfile
impl Unpin for CenterLineProfile
impl UnwindSafe for CenterLineProfile
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
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