pub struct PlineView<'a, P>where
    P: PlineSource + ?Sized,{
    pub source: &'a P,
    pub data: PlineViewData<P::Num>,
}
Expand description

A PlineView represents a partial selection or subpart of a source polyline without copying. This structure borrows a source polyline to access vertex data for iteration and operations.

See PlineViewData for how to create different types of views/selections.

Fields§

§source: &'a P

Reference to the source polyline for this view.

§data: PlineViewData<P::Num>

View data used for indexing into the source polyline.

Implementations§

source§

impl<'a, P> PlineView<'a, P>where P: PlineSource + ?Sized,

source

pub fn new(source: &'a P, data: PlineViewData<P::Num>) -> Self

Create a new view with the given source and data.

source

pub fn detach(self) -> PlineViewData<P::Num>

Consume the view (releasing the borrow on the source polyline) and returning the associated view data.

Trait Implementations§

source§

impl<'a, P> Clone for PlineView<'a, P>where P: PlineSource + ?Sized + Clone, P::Num: Clone,

source§

fn clone(&self) -> PlineView<'a, P>

Returns a copy 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<'a, P> Debug for PlineView<'a, P>where P: PlineSource + ?Sized + Debug, P::Num: Debug,

source§

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

Formats the value using the given formatter. Read more
source§

impl<'a, P> PlineSource for PlineView<'a, P>where P: PlineSource + ?Sized,

§

type Num = <P as PlineSource>::Num

Numeric type used for the polyline.
§

type OutputPolyline = Polyline<<P as PlineSource>::Num>

Type used for output when invoking methods that return a new polyline.
source§

fn vertex_count(&self) -> usize

Total number of vertexes.
source§

fn is_closed(&self) -> bool

Whether the polyline is closed (true) or open (false).
source§

fn get(&self, index: usize) -> Option<PlineVertex<Self::Num>>

Get the vertex at given index position. Returns None if index out of bounds.
source§

fn at(&self, index: usize) -> PlineVertex<Self::Num>

Same as PlineSource::get but panics if index is out of bounds. Read more
source§

fn iter_segments(&self) -> SegmentIter<'_, Self>

Return iterator to iterate over all the polyline segments.
source§

fn iter_vertexes(&self) -> VertexIter<'_, Self>

Return iterator to iterate over all the polyline vertexes.
source§

fn is_empty(&self) -> bool

Returns true if vertex count is 0.
source§

fn fuzzy_eq_eps<P>(&self, other: &P, eps: Self::Num) -> boolwhere P: PlineSource<Num = Self::Num> + ?Sized,

Fuzzy compare with another polyline using eps epsilon value for fuzzy comparison of vertexes.
source§

fn fuzzy_eq<P>(&self, other: &P) -> boolwhere P: PlineSource<Num = Self::Num> + ?Sized,

Same as PlineSource::fuzzy_eq_eps but uses default Self::Num::fuzzy_epsilon().
source§

fn last(&self) -> Option<PlineVertex<Self::Num>>

Get the last vertex of the polyline or None if polyline is empty.
source§

fn segment_count(&self) -> usize

Total number of segments in the polyline.
source§

fn iter_segment_indexes(&self) -> PlineSegIndexIterator

Iterate through all the polyline segment vertex positional indexes. Read more
source§

fn next_wrapping_index(&self, i: usize) -> usize

Returns the next wrapping vertex index for the polyline. Read more
source§

fn prev_wrapping_index(&self, i: usize) -> usize

Returns the previous wrapping vertex index for the polyline. Read more
source§

fn fwd_wrapping_dist(&self, start_index: usize, end_index: usize) -> usize

Returns the forward wrapping distance between two vertex indexes. Read more
source§

fn fwd_wrapping_index(&self, start_index: usize, offset: usize) -> usize

Returns the vertex index after applying offset to start_index in a wrapping manner. Read more
source§

fn extents(&self) -> Option<AABB<Self::Num>>

Compute the XY extents of the polyline. Read more
source§

fn path_length(&self) -> Self::Num

Returns the total path length of the polyline. Read more
source§

fn area(&self) -> Self::Num

Compute the closed signed area of the polyline. Read more
source§

fn orientation(&self) -> PlineOrientation

Returns the orientation of the polyline. Read more
source§

fn remove_repeat_pos( &self, pos_equal_eps: Self::Num ) -> Option<Self::OutputPolyline>

Remove all repeat position vertexes from the polyline. Read more
source§

fn remove_redundant( &self, pos_equal_eps: Self::Num ) -> Option<Self::OutputPolyline>

Remove all redundant vertexes from the polyline. Read more
source§

fn rotate_start( &self, start_index: usize, point: Vector2<Self::Num>, pos_equal_eps: Self::Num ) -> Option<Self::OutputPolyline>

Rotates the vertexes in a closed polyline such that the first vertex’s position is at point. start_index indicates which segment point lies on before rotation. This does not change the shape of the polyline curve. pos_equal_eps is epsilon value used for comparing the positions of points. None is returned if the polyline is not closed, the polyline length is less than 2, or the start_index is out of bounds. Read more
source§

fn create_approx_aabb_index(&self) -> Option<StaticAABB2DIndex<Self::Num>>

Creates a fast approximate spatial index of all the polyline segments. Read more
source§

fn create_aabb_index(&self) -> Option<StaticAABB2DIndex<Self::Num>>

Creates a spatial index of all the polyline segments. Read more
source§

fn closest_point( &self, point: Vector2<Self::Num>, pos_equal_eps: Self::Num ) -> Option<ClosestPointResult<Self::Num>>

Find the closest segment point on a polyline to a point given. Read more
source§

fn winding_number(&self, point: Vector2<Self::Num>) -> i32

Calculate the winding number for a point relative to the polyline. Read more
source§

fn arcs_to_approx_lines( &self, error_distance: Self::Num ) -> Option<Self::OutputPolyline>

Returns a new polyline with all arc segments converted to line segments with some error_distance or None if T fails to cast to or from usize. Read more
source§

fn visit_self_intersects<C, V>(&self, visitor: &mut V) -> Cwhere C: ControlFlow, V: PlineIntersectVisitor<Self::Num, C>,

Visit self intersects of the polyline using default options.
source§

fn visit_self_intersects_opt<C, V>( &self, visitor: &mut V, options: &PlineSelfIntersectOptions<'_, Self::Num> ) -> Cwhere C: ControlFlow, V: PlineIntersectVisitor<Self::Num, C>,

Visit self intersects of the polyline using options provided.
source§

fn find_intersects<P>(&self, other: &P) -> PlineIntersectsCollection<Self::Num>where P: PlineSource<Num = Self::Num> + ?Sized,

Find all intersects between two polylines using default options.
source§

fn find_intersects_opt<P>( &self, other: &P, options: &FindIntersectsOptions<'_, Self::Num> ) -> PlineIntersectsCollection<Self::Num>where P: PlineSource<Num = Self::Num> + ?Sized,

Find all intersects between two polylines using the options provided.
source§

fn parallel_offset(&self, offset: Self::Num) -> Vec<Self::OutputPolyline>

Compute the parallel offset polylines of the polyline using default options. Read more
source§

fn parallel_offset_opt( &self, offset: Self::Num, options: &PlineOffsetOptions<'_, Self::Num> ) -> Vec<Self::OutputPolyline>

Compute the parallel offset polylines of the polyline with options given. Read more
source§

fn boolean<P>( &self, other: &P, operation: BooleanOp ) -> BooleanResult<Self::OutputPolyline>where P: PlineSource<Num = Self::Num> + ?Sized,

Perform a boolean operation between this polyline and another using default options. Read more
source§

fn boolean_opt<P>( &self, other: &P, operation: BooleanOp, options: &PlineBooleanOptions<'_, Self::Num> ) -> BooleanResult<Self::OutputPolyline>where P: PlineSource<Num = Self::Num> + ?Sized,

Perform a boolean operation between this polyline and another with options provided. Read more
source§

fn find_point_at_path_length( &self, target_path_length: Self::Num ) -> Result<(usize, Vector2<Self::Num>), Self::Num>

Find the segment index and point on the polyline corresponding to the path length given. Read more
source§

impl<'a, P> Copy for PlineView<'a, P>where P: PlineSource + ?Sized + Copy, P::Num: Copy,

Auto Trait Implementations§

§

impl<'a, P: ?Sized> RefUnwindSafe for PlineView<'a, P>where P: RefUnwindSafe, <P as PlineSource>::Num: RefUnwindSafe,

§

impl<'a, P: ?Sized> Send for PlineView<'a, P>where P: Sync, <P as PlineSource>::Num: Send,

§

impl<'a, P: ?Sized> Sync for PlineView<'a, P>where P: Sync, <P as PlineSource>::Num: Sync,

§

impl<'a, P: ?Sized> Unpin for PlineView<'a, P>where <P as PlineSource>::Num: Unpin,

§

impl<'a, P: ?Sized> UnwindSafe for PlineView<'a, P>where P: RefUnwindSafe, <P as PlineSource>::Num: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.