pub struct Shape {
pub contours: Vec<Contour>,
pub inverse_y_axis: bool,
}Fields§
§contours: Vec<Contour>§inverse_y_axis: boolWhen true, the shape’s Y axis points downward (non-default orientation).
Implementations§
Source§impl Shape
impl Shape
pub fn new() -> Self
pub fn add_contour(&mut self, contour: Contour)
Sourcepub fn add_contour_mut(&mut self) -> &mut Contour
pub fn add_contour_mut(&mut self) -> &mut Contour
Push and return a mutable reference to a fresh contour.
Sourcepub fn validate(&self) -> bool
pub fn validate(&self) -> bool
Every contour must be closed and consistent (each edge starts where the
previous ended). Port of Shape::validate.
Sourcepub fn normalize(&mut self)
pub fn normalize(&mut self)
Split single-edge contours into thirds and push apart convergent corners.
Port of Shape::normalize.
Sourcepub fn get_bounds(&self, border: f64) -> Bounds
pub fn get_bounds(&self, border: f64) -> Bounds
Axis-aligned bounds, optionally expanded by a uniform border.
pub fn edge_count(&self) -> usize
Sourcepub fn orient_contours(&mut self)
pub fn orient_contours(&mut self)
Ensure all contours wind consistently (outer CCW, holes CW). Port of
Shape::orientContours.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Shape
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnsafeUnpin for Shape
impl UnwindSafe for Shape
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
Mutably borrows from an owned value. Read more
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>
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 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>
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