Polygon

Struct Polygon 

Source
pub struct Polygon<D, F>
where D: DualNum<F>, F: DualNumFloat,
{ /* private fields */ }
Expand description

A polygon represented by a list of vertices.

Implementations§

Source§

impl<D, F> Polygon<D, F>
where D: DualNum<F> + ComplexField<RealField = D>, F: DualNumFloat,

Source

pub fn new(vertices: Vec<Point2<D>>) -> Self

Creates a new Polygon<F>. Returns a reference to the vector of distances between consecutive vertices.

§Returns

A slice of distances of type F.

Source

pub fn new_centered_rectangle(width: D, height: D) -> Self

Source

pub fn distance(&self) -> &[D]

Returns a reference to the vector of cumulative distances.

Trait Implementations§

Source§

impl<D, F> Clone for Polygon<D, F>
where D: DualNum<F> + Clone, F: DualNumFloat + Clone,

Source§

fn clone(&self) -> Polygon<D, F>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C, P, F> Closed<C, F> for Polygon<P, F>
where C: DualNum<F> + From<P> + PartialOrd + ComplexField<RealField = C> + RealField, P: DualNum<F> + PartialOrd, F: DualNumFloat, for<'a> &'a C: Sub<&'a C, Output = C>, for<'a> &'a P: Sub<&'a P, Output = P>,

Source§

fn is_inside(&self, point: &Point2<C>, _n: u32) -> bool

Divides the closed contour into n segments and returns the points of the divided segments. Read more
Source§

fn min_distance2_vec(&self, point: &Point2<C>, _n: u32) -> MinDist<C>

Source§

fn divide_cycle(&self, n: u32) -> Vec<Point2<D>>

Divides the closed contour into n cycles and returns the points of the divided cycles. Read more
Source§

impl<P, C, F> Contour<C, F> for Polygon<P, F>
where P: DualNum<F> + PartialOrd, C: DualNum<F> + From<P> + PartialOrd, F: DualNumFloat, for<'a> &'a C: Sub<&'a C, Output = C>, for<'a> &'a P: Sub<&'a P, Output = P>,

Source§

fn position(&self, s: &C) -> Point2<C>

Returns the position on the contour for a given input value. Read more
Source§

fn s_interval(&self) -> (C, C)

Returns the interval of the input values for the contour.
Source§

fn aabb(&self, _n: u32, _f: PhantomData<C>) -> Aabb<C>

Returns the axis-aligned bounding box (AABB) of the contour with a specified margin.
Source§

fn divide(&self, start: D, end: D, n_points: u32) -> Vec<Point2<D>>

Divides the contour into a specified number of points between the start and end values. Read more
Source§

fn length(&self) -> D

Returns the length of the contour.
Source§

impl<D, F> Debug for Polygon<D, F>
where D: DualNum<F> + Debug, F: DualNumFloat + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<D, F> Freeze for Polygon<D, F>

§

impl<D, F> RefUnwindSafe for Polygon<D, F>

§

impl<D, F> Send for Polygon<D, F>
where D: Send,

§

impl<D, F> Sync for Polygon<D, F>
where D: Sync,

§

impl<D, F> Unpin for Polygon<D, F>
where F: Unpin, D: Unpin,

§

impl<D, F> UnwindSafe for Polygon<D, F>
where F: UnwindSafe, D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.