pub struct ControlGrid<P> { /* private fields */ }Expand description
A rectangular grid of control points for a tensor-product surface.
Stored row-major: points[i * v_count + j] is the point at u index i and
v index j. Carrying the shape with the data means the surface functions
cannot be handed a grid with the wrong stride, which is the mistake that
otherwise produces a plausible but transposed surface.
Implementations§
Source§impl<P: Blend> ControlGrid<P>
impl<P: Blend> ControlGrid<P>
Sourcepub fn new(points: Vec<P>, u_count: usize, v_count: usize) -> OgeomResult<Self>
pub fn new(points: Vec<P>, u_count: usize, v_count: usize) -> OgeomResult<Self>
A grid from row-major points.
§Errors
OgeomError::Dimension if the point count
is not u_count * v_count, or either count is zero.
Sourcepub fn get(&self, i: usize, j: usize) -> Option<P>
pub fn get(&self, i: usize, j: usize) -> Option<P>
The point at (i, j), or None if either index is out of range.
Sourcepub fn transposed(&self) -> Self
pub fn transposed(&self) -> Self
This grid with u and v exchanged.
Sourcepub fn map<Q: Blend>(&self, f: impl Fn(P) -> Q) -> ControlGrid<Q>
pub fn map<Q: Blend>(&self, f: impl Fn(P) -> Q) -> ControlGrid<Q>
Apply f to every point.
Trait Implementations§
Source§impl<P: Clone> Clone for ControlGrid<P>
impl<P: Clone> Clone for ControlGrid<P>
Source§impl<P: Debug> Debug for ControlGrid<P>
impl<P: Debug> Debug for ControlGrid<P>
Source§impl<P: PartialEq> PartialEq for ControlGrid<P>
impl<P: PartialEq> PartialEq for ControlGrid<P>
impl<P: PartialEq> StructuralPartialEq for ControlGrid<P>
Auto Trait Implementations§
impl<P> Freeze for ControlGrid<P>
impl<P> RefUnwindSafe for ControlGrid<P>where
Vec<P>: RefUnwindSafe,
impl<P> Send for ControlGrid<P>
impl<P> Sync for ControlGrid<P>
impl<P> Unpin for ControlGrid<P>
impl<P> UnsafeUnpin for ControlGrid<P>where
Vec<P>: UnsafeUnpin,
impl<P> UnwindSafe for ControlGrid<P>where
Vec<P>: 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,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.