Struct cavalier_contours::polyline::PlineView
source · 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,
impl<'a, P> PlineView<'a, P>where P: PlineSource + ?Sized,
sourcepub fn new(source: &'a P, data: PlineViewData<P::Num>) -> Self
pub fn new(source: &'a P, data: PlineViewData<P::Num>) -> Self
Create a new view with the given source and data.
sourcepub fn detach(self) -> PlineViewData<P::Num>
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> PlineSource for PlineView<'a, P>where
P: PlineSource + ?Sized,
impl<'a, P> PlineSource for PlineView<'a, P>where P: PlineSource + ?Sized,
§type Num = <P as PlineSource>::Num
type Num = <P as PlineSource>::Num
Numeric type used for the polyline.
§type OutputPolyline = Polyline<<P as PlineSource>::Num>
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
fn vertex_count(&self) -> usize
Total number of vertexes.
source§fn get(&self, index: usize) -> Option<PlineVertex<Self::Num>>
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 iter_segments(&self) -> SegmentIter<'_, Self> ⓘ
fn iter_segments(&self) -> SegmentIter<'_, Self> ⓘ
Return iterator to iterate over all the polyline segments.
source§fn iter_vertexes(&self) -> VertexIter<'_, Self> ⓘ
fn iter_vertexes(&self) -> VertexIter<'_, Self> ⓘ
Return iterator to iterate over all the polyline vertexes.
source§fn fuzzy_eq_eps<P>(&self, other: &P, eps: Self::Num) -> boolwhere
P: PlineSource<Num = Self::Num> + ?Sized,
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,
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>>
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
fn segment_count(&self) -> usize
Total number of segments in the polyline.
source§fn iter_segment_indexes(&self) -> PlineSegIndexIterator ⓘ
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
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
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
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 extents(&self) -> Option<AABB<Self::Num>>
fn extents(&self) -> Option<AABB<Self::Num>>
Compute the XY extents of the polyline. Read more
source§fn path_length(&self) -> Self::Num
fn path_length(&self) -> Self::Num
Returns the total path length of the polyline. Read more
source§fn orientation(&self) -> PlineOrientation
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>
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>
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>
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 moresource§fn create_approx_aabb_index(&self) -> Option<StaticAABB2DIndex<Self::Num>>
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>>
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>>
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 moresource§fn winding_number(&self, point: Vector2<Self::Num>) -> i32
fn winding_number(&self, point: Vector2<Self::Num>) -> i32
Calculate the winding number for a
point
relative to the polyline. Read moresource§fn arcs_to_approx_lines(
&self,
error_distance: Self::Num
) -> Option<Self::OutputPolyline>
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 moresource§fn visit_self_intersects<C, V>(&self, visitor: &mut V) -> Cwhere
C: ControlFlow,
V: PlineIntersectVisitor<Self::Num, C>,
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>,
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,
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,
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>
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>
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,
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 moresource§fn boolean_opt<P>(
&self,
other: &P,
operation: BooleanOp,
options: &PlineBooleanOptions<'_, Self::Num>
) -> BooleanResult<Self::OutputPolyline>where
P: PlineSource<Num = Self::Num> + ?Sized,
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