pub struct BsplineSurface {
pub control_net: Vec<Vec<[f64; 3]>>,
pub u_knots: Vec<f64>,
pub v_knots: Vec<f64>,
pub degree_u: usize,
pub degree_v: usize,
}Expand description
A tensor-product B-spline surface defined by a rectangular control net.
control_net[i][j] is the (i, j) control point. Knot vectors in
each parameter direction are stored separately.
Fields§
§control_net: Vec<Vec<[f64; 3]>>Control net — outer index u, inner index v.
u_knots: Vec<f64>Knot vector in the u direction.
v_knots: Vec<f64>Knot vector in the v direction.
degree_u: usizePolynomial degree in u.
degree_v: usizePolynomial degree in v.
Implementations§
Source§impl BsplineSurface
impl BsplineSurface
Sourcepub fn new(
control_net: Vec<Vec<[f64; 3]>>,
u_knots: Vec<f64>,
v_knots: Vec<f64>,
degree_u: usize,
degree_v: usize,
) -> Self
pub fn new( control_net: Vec<Vec<[f64; 3]>>, u_knots: Vec<f64>, v_knots: Vec<f64>, degree_u: usize, degree_v: usize, ) -> Self
Construct a BsplineSurface.
Sourcepub fn eval(&self, u: f64, v: f64) -> [f64; 3]
pub fn eval(&self, u: f64, v: f64) -> [f64; 3]
Evaluate the surface at parameter (u, v) using tensor-product de Boor.
Sourcepub fn compute_curvature(&self, u: f64, v: f64) -> (f64, f64)
pub fn compute_curvature(&self, u: f64, v: f64) -> (f64, f64)
Compute Gaussian curvature K and mean curvature H at (u, v).
Uses the first and second fundamental forms computed via finite differences of the surface position.
Returns (K, H). Both values may be NaN at degenerate points.
Sourcepub fn refine_knots(&self, new_u_knots: &[f64], new_v_knots: &[f64]) -> Self
pub fn refine_knots(&self, new_u_knots: &[f64], new_v_knots: &[f64]) -> Self
H-refinement via knot insertion in both parameter directions.
new_u_knots and new_v_knots are sorted lists of knot values to
insert (repeated insertions are handled by the Boehm algorithm).
Returns a new BsplineSurface with the refined control net.
Auto Trait Implementations§
impl Freeze for BsplineSurface
impl RefUnwindSafe for BsplineSurface
impl Send for BsplineSurface
impl Sync for BsplineSurface
impl Unpin for BsplineSurface
impl UnsafeUnpin for BsplineSurface
impl UnwindSafe for BsplineSurface
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
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.