pub struct Chain<C> {
pub name: String,
pub curves: Vec<C>,
pub curve_names: Vec<String>,
pub joint_names: Vec<String>,
}Expand description
A chain of curves, with a stable name for every curve and every joint
between them — what extrude, revolve and the sweeps build the names of
what they make from (see the crate docs). For a sketch these are its
element ids; for a shape built in code, positions in the chain
(Chain::closed).
joint_names[i] names the joint where curves[i] starts. A closed loop
has one joint per curve; an open chain one more, its end.
Fields§
§name: StringWhat the chain goes by: its sketch’s name, or its edge’s; empty for one built in code.
curves: Vec<C>§curve_names: Vec<String>§joint_names: Vec<String>Implementations§
Source§impl<const D: usize> Chain<NurbCurve<D>>where
NurbCurve<D>: ChainCurve,
impl<const D: usize> Chain<NurbCurve<D>>where
NurbCurve<D>: ChainCurve,
Sourcepub fn closed(curves: Vec<NurbCurve<D>>) -> Self
pub fn closed(curves: Vec<NurbCurve<D>>) -> Self
A closed loop whose curves are called c0, c1, ... and whose joints
p0, p1, ..., p0 where c0 starts.
Sourcepub fn open(curves: Vec<NurbCurve<D>>) -> Self
pub fn open(curves: Vec<NurbCurve<D>>) -> Self
An open chain, named like Chain::closed plus its end joint.
Sourcepub fn with_prefix(self, prefix: &str) -> Self
pub fn with_prefix(self, prefix: &str) -> Self
The same chain with prefix put in front of every name — to keep
several Chain::closed loops of one extrude apart.
pub fn is_closed(&self) -> bool
Sourcepub fn check_names(&self) -> GeopResult<()>
pub fn check_names(&self) -> GeopResult<()>
Checks that there is one name per curve and one per joint.
Sourcepub fn reversed(&self) -> Self
pub fn reversed(&self) -> Self
The same chain traversed the other way; every name stays with its curve or joint.
Sourcepub fn starting_at(&self, k: usize) -> Self
pub fn starting_at(&self, k: usize) -> Self
The closed chain starting at its joint k.
Sourcepub fn map_curves(&self, f: impl Fn(&NurbCurve<D>) -> NurbCurve<D>) -> Self
pub fn map_curves(&self, f: impl Fn(&NurbCurve<D>) -> NurbCurve<D>) -> Self
The same chain with f applied to every curve, keeping the names.
Sourcepub fn joint(&self, i: usize) -> GeopResult<<NurbCurve<D> as ChainCurve>::Point>
pub fn joint(&self, i: usize) -> GeopResult<<NurbCurve<D> as ChainCurve>::Point>
Joint i, where it is.
Sourcepub fn joints(&self) -> GeopResult<Vec<<NurbCurve<D> as ChainCurve>::Point>>
pub fn joints(&self) -> GeopResult<Vec<<NurbCurve<D> as ChainCurve>::Point>>
The joints, where they are.
Source§impl Chain<NurbCurve2D>
impl Chain<NurbCurve2D>
Sourcepub fn corners(&self) -> GeopResult<Vec<usize>>
pub fn corners(&self) -> GeopResult<Vec<usize>>
The joints of the closed chain where its tangent turns — the corners
a designer sees — as indices into joint_names, in order. A joint is
smooth where the curve arriving and the curve leaving could have one
tangent direction: their tangents’ cross product could be zero and
their dot product is definitely positive. Everything else is a
corner: a turn, a cusp, or a tangent that could vanish. The split of
an arc at a quarter turn, or a sketch point where two curves meet
tangentially, is no corner.
Source§impl Chain<NurbCurve3D>
impl Chain<NurbCurve3D>
Sourcepub fn starting_on(&self, plane: &CoordinateSystem) -> GeopResult<Option<Self>>
pub fn starting_on(&self, plane: &CoordinateSystem) -> GeopResult<Option<Self>>
The open chain run from its end on plane: as it is if it starts
there, the other way round if only its end could lie on it. None
if neither end could.