pub trait PlineSourceMut: PlineSource {
Show 21 methods // Required methods fn set_vertex(&mut self, index: usize, vertex: PlineVertex<Self::Num>); fn insert_vertex(&mut self, index: usize, vertex: PlineVertex<Self::Num>); fn remove(&mut self, index: usize) -> PlineVertex<Self::Num>; fn clear(&mut self); fn add_vertex(&mut self, vertex: PlineVertex<Self::Num>); fn extend_vertexes<I>(&mut self, vertexes: I) where I: IntoIterator<Item = PlineVertex<Self::Num>>; fn reserve(&mut self, additional: usize); fn set_is_closed(&mut self, is_closed: bool); // Provided methods fn set( &mut self, index: usize, x: Self::Num, y: Self::Num, bulge: Self::Num ) { ... } fn set_last(&mut self, vertex: PlineVertex<Self::Num>) { ... } fn insert( &mut self, index: usize, x: Self::Num, y: Self::Num, bulge: Self::Num ) { ... } fn remove_last(&mut self) -> PlineVertex<Self::Num> { ... } fn add(&mut self, x: Self::Num, y: Self::Num, bulge: Self::Num) { ... } fn add_from_array(&mut self, data: [Self::Num; 3]) { ... } fn extend<P>(&mut self, other: &P) where P: PlineSource<Num = Self::Num> + ?Sized { ... } fn extend_remove_repeat<P>(&mut self, other: &P, pos_equal_eps: Self::Num) where P: PlineSource<Num = Self::Num> + ?Sized { ... } fn add_or_replace_vertex( &mut self, vertex: PlineVertex<Self::Num>, pos_equal_eps: Self::Num ) { ... } fn add_or_replace( &mut self, x: Self::Num, y: Self::Num, bulge: Self::Num, pos_equal_eps: Self::Num ) { ... } fn scale_mut(&mut self, scale_factor: Self::Num) { ... } fn translate_mut(&mut self, x: Self::Num, y: Self::Num) { ... } fn invert_direction_mut(&mut self) { ... }
}
Expand description

Trait representing a mutable source of polyline data. This trait has all the methods and operations that can be performed on a mutable polyline.

See other core polyline traits: PlineSource and PlineCreation for more information.

Required Methods§

source

fn set_vertex(&mut self, index: usize, vertex: PlineVertex<Self::Num>)

Set the vertex data at the given index position of the polyline.

source

fn insert_vertex(&mut self, index: usize, vertex: PlineVertex<Self::Num>)

Insert a new vertex into the polyline at the given index position.

source

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

Remove vertex at the given index position and return it.

source

fn clear(&mut self)

Clear all vertexes of the polyline.

source

fn add_vertex(&mut self, vertex: PlineVertex<Self::Num>)

Add a vertex to the end of the polyline.

source

fn extend_vertexes<I>(&mut self, vertexes: I)
where I: IntoIterator<Item = PlineVertex<Self::Num>>,

Append all vertexes from an iterator to the end of this polyline.

source

fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more vertexes.

source

fn set_is_closed(&mut self, is_closed: bool)

Set whether the polyline is closed (is_closed = true) or open (is_closed = false).

Provided Methods§

source

fn set(&mut self, index: usize, x: Self::Num, y: Self::Num, bulge: Self::Num)

Same as PlineSourceMut::set_vertex but accepts each component of the vertex rather than a vertex structure.

source

fn set_last(&mut self, vertex: PlineVertex<Self::Num>)

Set the last vertex of the polyline.

§Panics

Panics if polyline is empty.

source

fn insert(&mut self, index: usize, x: Self::Num, y: Self::Num, bulge: Self::Num)

Same as PlineSourceMut::insert_vertex but accepts each component of the vertex rather than a vertex structure.

source

fn remove_last(&mut self) -> PlineVertex<Self::Num>

Remove the last vertex from the polyline and return it.

§Panics

Panics if polyline is empty.

source

fn add(&mut self, x: Self::Num, y: Self::Num, bulge: Self::Num)

Same as PlineSourceMut::add_vertex but accepts each component of the vertex rather than a vertex structure.

source

fn add_from_array(&mut self, data: [Self::Num; 3])

Same as PlineSourceMut::add_vertex but accepts each component as elements in an array, 0 = x, 1 = y, 2 = bulge.

source

fn extend<P>(&mut self, other: &P)
where P: PlineSource<Num = Self::Num> + ?Sized,

Copy all vertexes from other to the end of this polyline.

source

fn extend_remove_repeat<P>(&mut self, other: &P, pos_equal_eps: Self::Num)
where P: PlineSource<Num = Self::Num> + ?Sized,

Same as PlineSourceMut::extend but removes any consecutive repeat position vertexes in the process of copying (using pos_equal_eps for compare).

source

fn add_or_replace_vertex( &mut self, vertex: PlineVertex<Self::Num>, pos_equal_eps: Self::Num )

Add a vertex if it’s position is not fuzzy equal to the last vertex in the polyline.

If the vertex position is fuzzy equal then just update the bulge of the last vertex with the bulge given.

source

fn add_or_replace( &mut self, x: Self::Num, y: Self::Num, bulge: Self::Num, pos_equal_eps: Self::Num )

Same as PlineSourceMut::add_or_replace_vertex but accepts each component of the vertex rather than a vertex structure.

source

fn scale_mut(&mut self, scale_factor: Self::Num)

Uniformly scale the polyline (mutably) in the xy plane by scale_factor.

§Examples
let mut polyline = Polyline::new();
polyline.add(2.0, 2.0, 0.5);
polyline.add(4.0, 4.0, 1.0);
polyline.scale_mut(2.0);
let mut expected = Polyline::new();
expected.add(4.0, 4.0, 0.5);
expected.add(8.0, 8.0, 1.0);
assert!(polyline.fuzzy_eq(&expected));
source

fn translate_mut(&mut self, x: Self::Num, y: Self::Num)

Translate the polyline (mutably) by some x_offset and y_offset.

§Examples
let mut polyline = Polyline::new();
polyline.add(2.0, 2.0, 0.5);
polyline.add(4.0, 4.0, 1.0);
polyline.translate_mut(-3.0, 1.0);
let mut expected = Polyline::new();
expected.add(-1.0, 3.0, 0.5);
expected.add(1.0, 5.0, 1.0);
assert!(polyline.fuzzy_eq(&expected));
source

fn invert_direction_mut(&mut self)

Invert/reverse the direction of the polyline in place (mutably).

This method works by simply reversing the order of the vertexes, shifting by 1 position all the vertexes, and inverting the sign of all the bulge values. E.g. after reversing the vertex the bulge at index 0 becomes negative bulge at index 1. The end result for a is_closed polyline is the direction will be changed from clockwise to counter clockwise or vice versa.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> PlineSourceMut for Polyline<T>
where T: Real,