Skip to main content

BsplineSurface

Struct BsplineSurface 

Source
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: usize

Polynomial degree in u.

§degree_v: usize

Polynomial degree in v.

Implementations§

Source§

impl BsplineSurface

Source

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.

Source

pub fn eval(&self, u: f64, v: f64) -> [f64; 3]

Evaluate the surface at parameter (u, v) using tensor-product de Boor.

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.