pub struct Feature { /* private fields */ }Expand description
A run of contiguous cubics grouped into one semantic unit of the outline.
Features are what a morph matches on. A rounded rectangle’s outline is a
dozen-odd cubics but only four corners plus four edges, and matching
corner-to-corner (convex to convex, concave to concave) is what keeps a
shape transition legible. Features built as
ignorable — and every Edge —
sit out that matching.
Implementations§
Source§impl Feature
impl Feature
Sourcepub fn ignorable(cubics: Vec<Cubic>) -> Feature
pub fn ignorable(cubics: Vec<Cubic>) -> Feature
A feature of any indentation that the default morph mapping skips.
Useful for steering a morph: marking a 12-pointed star’s concave corners ignorable makes a morph consider only its outer points, which can cost the animation a whole rotation’s worth of intersections.
§Panics
If cubics is empty or its curves are not contiguous.
Sourcepub fn convex_corner(cubics: Vec<Cubic>) -> Feature
pub fn convex_corner(cubics: Vec<Cubic>) -> Feature
Sourcepub fn concave_corner(cubics: Vec<Cubic>) -> Feature
pub fn concave_corner(cubics: Vec<Cubic>) -> Feature
Sourcepub const fn kind(&self) -> FeatureKind
pub const fn kind(&self) -> FeatureKind
What this feature contributes to the outline.
Sourcepub const fn is_ignorable(&self) -> bool
pub const fn is_ignorable(&self) -> bool
Whether the default morph mapping skips this feature.
Sourcepub const fn is_convex_corner(&self) -> bool
pub const fn is_convex_corner(&self) -> bool
Whether this feature is an outward corner.
Sourcepub const fn is_concave_corner(&self) -> bool
pub const fn is_concave_corner(&self) -> bool
Whether this feature is an inward corner.
Sourcepub fn transformed_with(&self, f: impl Fn(Point) -> Point + Copy) -> Feature
pub fn transformed_with(&self, f: impl Fn(Point) -> Point + Copy) -> Feature
This feature with every point mapped through f.
Sourcepub fn reversed(&self) -> Feature
pub fn reversed(&self) -> Feature
This feature traversed in the opposite direction.
A corner’s indentation flips with the traversal, since a polygon’s convexity flag is orientation-dependent (upstream carries the same negation, and the same note that it is really a property of the polygon’s winding).
Trait Implementations§
impl StructuralPartialEq for Feature
Auto Trait Implementations§
impl Freeze for Feature
impl RefUnwindSafe for Feature
impl Send for Feature
impl Sync for Feature
impl Unpin for Feature
impl UnsafeUnpin for Feature
impl UnwindSafe for Feature
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.