Skip to main content

BezierTriangle

Struct BezierTriangle 

Source
pub struct BezierTriangle { /* private fields */ }
Expand description

A (rational) triangular Bézier patch.

Implementations§

Source§

impl BezierTriangle

Source

pub fn point_count(degree: usize) -> usize

Number of control points of a degree-n patch.

Source

pub fn index(degree: usize, j: usize, k: usize) -> usize

Storage index of P_ijk (i = n − j − k): rows of constant k, j increasing inside a row.

Source

pub fn new( degree: usize, points: Vec<Vec4>, ) -> Result<Self, BezierTriangleRefusal>

A patch from homogeneous points (w·p, w) in BezierTriangle::index order.

Source

pub fn from_points( degree: usize, points: &[Vec3], ) -> Result<Self, BezierTriangleRefusal>

A polynomial patch (all weights one) from Cartesian points.

Source

pub fn degree(&self) -> usize

Source

pub fn points(&self) -> &[Vec4]

Homogeneous control points in BezierTriangle::index order.

Source

pub fn control(&self, j: usize, k: usize) -> Vec4

Homogeneous control point P_ijk, i = n − j − k.

Source

pub fn blossom_homogeneous(&self, args: &[[f64; 3]]) -> Vec4

The homogeneous polar form R(x_1, …, x_n): de Casteljau with argument x_m at level m. Symmetric and linear in each argument (arguments are barycentric triples; points sum to one, directions to zero). args.len() must equal the degree.

Source

pub fn evaluate_homogeneous( &self, a: f64, b: f64, c: f64, ) -> Result<Vec4, BezierTriangleRefusal>

Homogeneous point at barycentric (a, b, c) (3.11.7).

Source

pub fn evaluate( &self, a: f64, b: f64, c: f64, ) -> Result<Vec3, BezierTriangleRefusal>

Point at barycentric (a, b, c).

Source

pub fn derivative( &self, a: f64, b: f64, c: f64, direction: [f64; 3], ) -> Result<(Vec3, Vec3), BezierTriangleRefusal>

Point and directional derivative along the barycentric direction (da, db, dc) (components summing to zero), e.g. (-1, 1, 0) is ∂/∂b with c held. The homogeneous derivative is n·R(d, x, …, x), then the quotient rule.

Source

pub fn side_curve( &self, side: TriangleSide, ) -> Result<NurbsCurve, BezierTriangleRefusal>

The boundary row on side as a rational Bézier curve on [0, 1].

Source

pub fn elevate(&self) -> Result<Self, BezierTriangleRefusal>

The same patch at degree n + 1 (3.11.8): P*_ijk = (i·P_{i−1,j,k} + j·P_{i,j−1,k} + k·P_{i,j,k−1}) / (n + 1).

Source

pub fn compose_bilinear( &self, corners: [[f64; 3]; 4], ) -> Result<TrianglePiece, BezierTriangleRefusal>

The exact bidegree (n, n) tensor patch of the triangle composed with the bilinear map of corners ([Q00, Q10, Q01, Q11], barycentric). Control point (k, l) is the symmetrized tensor blossom at (1^k 0^(n−k); 1^l 0^(n−l)): a hypergeometric average over how many s = 1 slots pair with t = 1 slots.

Source

pub fn to_nurbs_quads( &self, ) -> Result<[TrianglePiece; 3], BezierTriangleRefusal>

The exact conversion into three regular (n, n) patches, one per corner: piece v spans corner V_v, the midpoints of its two sides and the centroid, with s running toward the next corner’s side midpoint and t toward the previous one’s (each piece keeps the triangle’s orientation). Adjacent pieces share their common side exactly: it is the image of one straight domain segment.

Source

pub fn to_nurbs_collapsed(&self) -> Result<TrianglePiece, BezierTriangleRefusal>

The exact conversion into one (n, n) patch through (s, t) ↦ (1 − s, s(1 − t), s t): side s = 0 is collapsed to the corner P_n00 (a pole), s = 1 is the side a = 0.

Trait Implementations§

Source§

impl Clone for BezierTriangle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BezierTriangle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more