pub struct Contour {
pub points: Vec<Point<usize>>,
}Expand description
Represents a contour outline as a list of points.
Fields§
§points: Vec<Point<usize>>Implementations§
Source§impl Contour
impl Contour
Sourcepub fn arc_length(&self, closed: bool) -> f64
pub fn arc_length(&self, closed: bool) -> f64
Computes the perimeter/length of a contour.
Sourcepub fn contour_area(&self) -> f64
pub fn contour_area(&self) -> f64
Returns the area of the contour region.
Sourcepub fn approx_poly_dp(&self, epsilon: f64, closed: bool) -> Self
pub fn approx_poly_dp(&self, epsilon: f64, closed: bool) -> Self
Approximates a polygonal curve using the Douglas-Peucker algorithm.
Sourcepub fn bounding_rect(&self) -> Rect<usize>
pub fn bounding_rect(&self) -> Rect<usize>
Computes the straight bounding rectangle of the contour.
Source§impl Contour
impl Contour
Sourcepub fn convexity_defects(
contour: &[Point<f64>],
hull: &[Point<f64>],
) -> Vec<ConvexityDefect>
pub fn convexity_defects( contour: &[Point<f64>], hull: &[Point<f64>], ) -> Vec<ConvexityDefect>
Finds convexity defects between a contour and its convex hull.
A convexity defect is a region where the contour deviates inward from its convex hull. For each defect we record the start point (hull vertex), end point (next hull vertex), the farthest contour point from the hull edge, and the perpendicular depth of that point.
Sourcepub fn convex_hull(&self) -> Self
pub fn convex_hull(&self) -> Self
Computes the convex hull of the contour using Andrew’s Monotone Chain algorithm.
Trait Implementations§
impl StructuralPartialEq for Contour
Auto Trait Implementations§
impl Freeze for Contour
impl RefUnwindSafe for Contour
impl Send for Contour
impl Sync for Contour
impl Unpin for Contour
impl UnsafeUnpin for Contour
impl UnwindSafe for Contour
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().