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§fn clone(&self) -> ControlGrid<P>
fn clone(&self) -> ControlGrid<P>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§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>
Source§fn eq(&self, other: &ControlGrid<P>) -> bool
fn eq(&self, other: &ControlGrid<P>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<P: PartialEq> StructuralPartialEq for ControlGrid<P>
Auto Trait Implementations§
impl<P> Freeze for ControlGrid<P>
impl<P> RefUnwindSafe for ControlGrid<P>where
P: RefUnwindSafe,
impl<P> Send for ControlGrid<P>where
P: Send,
impl<P> Sync for ControlGrid<P>where
P: Sync,
impl<P> Unpin for ControlGrid<P>where
P: Unpin,
impl<P> UnsafeUnpin for ControlGrid<P>
impl<P> UnwindSafe for ControlGrid<P>where
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
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§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 more§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).§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.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.