pub struct RegularRepetition<T>where
T: CoordinateType,{ /* private fields */ }
Expand description
Describe a equi-spaced n*m two-dimensional repetition as a lattice.
The offsets are computed as (i*a, j*b)
for i
in 0..n
and j
in 0..m
.
a
and b
the distance vectors between two neighbouring points.
Implementations§
Source§impl<T> RegularRepetition<T>where
T: CoordinateType,
impl<T> RegularRepetition<T>where
T: CoordinateType,
Sourcepub fn new(a: Vector<T>, b: Vector<T>, n: u32, m: u32) -> RegularRepetition<T>
pub fn new(a: Vector<T>, b: Vector<T>, n: u32, m: u32) -> RegularRepetition<T>
Create a new lattice based repetition.
§Parameters
a, b
: Lattice vectors.n, m
: Number of repetitions in directionsa
andb
.
Sourcepub fn new_rectilinear(
spacing_x: T,
spacing_y: T,
num_x: u32,
num_y: u32,
) -> RegularRepetition<T>
pub fn new_rectilinear( spacing_x: T, spacing_y: T, num_x: u32, num_y: u32, ) -> RegularRepetition<T>
Create a repetition along the x and y axis.
§Example
use iron_shapes::prelude::RegularRepetition;
let rep = RegularRepetition::new_rectilinear(1, 1, 1, 2);
assert_eq!(rep.len(), 2);
let offsets: Vec<_> = rep.iter().collect();
assert_eq!(offsets, [(0, 0).into(), (0, 1).into()]);
Trait Implementations§
Source§impl<T> Clone for RegularRepetition<T>where
T: Clone + CoordinateType,
impl<T> Clone for RegularRepetition<T>where
T: Clone + CoordinateType,
Source§fn clone(&self) -> RegularRepetition<T>
fn clone(&self) -> RegularRepetition<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T> Debug for RegularRepetition<T>where
T: Debug + CoordinateType,
impl<T> Debug for RegularRepetition<T>where
T: Debug + CoordinateType,
Source§impl<T> Hash for RegularRepetition<T>where
T: Hash + CoordinateType,
impl<T> Hash for RegularRepetition<T>where
T: Hash + CoordinateType,
Source§impl<T> PartialEq for RegularRepetition<T>where
T: PartialEq + CoordinateType,
impl<T> PartialEq for RegularRepetition<T>where
T: PartialEq + CoordinateType,
impl<T> Copy for RegularRepetition<T>where
T: Copy + CoordinateType,
impl<T> Eq for RegularRepetition<T>where
T: Eq + CoordinateType,
impl<T> StructuralPartialEq for RegularRepetition<T>where
T: CoordinateType,
Auto Trait Implementations§
impl<T> Freeze for RegularRepetition<T>where
T: Freeze,
impl<T> RefUnwindSafe for RegularRepetition<T>where
T: RefUnwindSafe,
impl<T> Send for RegularRepetition<T>where
T: Send,
impl<T> Sync for RegularRepetition<T>where
T: Sync,
impl<T> Unpin for RegularRepetition<T>where
T: Unpin,
impl<T> UnwindSafe for RegularRepetition<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more