pub struct BezierTriangle { /* private fields */ }Expand description
A (rational) triangular Bézier patch.
Implementations§
Source§impl BezierTriangle
impl BezierTriangle
Sourcepub fn point_count(degree: usize) -> usize
pub fn point_count(degree: usize) -> usize
Number of control points of a degree-n patch.
Sourcepub fn index(degree: usize, j: usize, k: usize) -> usize
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.
Sourcepub fn new(
degree: usize,
points: Vec<Vec4>,
) -> Result<Self, BezierTriangleRefusal>
pub fn new( degree: usize, points: Vec<Vec4>, ) -> Result<Self, BezierTriangleRefusal>
A patch from homogeneous points (w·p, w) in BezierTriangle::index order.
Sourcepub fn from_points(
degree: usize,
points: &[Vec3],
) -> Result<Self, BezierTriangleRefusal>
pub fn from_points( degree: usize, points: &[Vec3], ) -> Result<Self, BezierTriangleRefusal>
A polynomial patch (all weights one) from Cartesian points.
pub fn degree(&self) -> usize
Sourcepub fn points(&self) -> &[Vec4]
pub fn points(&self) -> &[Vec4]
Homogeneous control points in BezierTriangle::index order.
Sourcepub fn control(&self, j: usize, k: usize) -> Vec4
pub fn control(&self, j: usize, k: usize) -> Vec4
Homogeneous control point P_ijk, i = n − j − k.
Sourcepub fn blossom_homogeneous(&self, args: &[[f64; 3]]) -> Vec4
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.
Sourcepub fn evaluate_homogeneous(
&self,
a: f64,
b: f64,
c: f64,
) -> Result<Vec4, BezierTriangleRefusal>
pub fn evaluate_homogeneous( &self, a: f64, b: f64, c: f64, ) -> Result<Vec4, BezierTriangleRefusal>
Homogeneous point at barycentric (a, b, c) (3.11.7).
Sourcepub fn evaluate(
&self,
a: f64,
b: f64,
c: f64,
) -> Result<Vec3, BezierTriangleRefusal>
pub fn evaluate( &self, a: f64, b: f64, c: f64, ) -> Result<Vec3, BezierTriangleRefusal>
Point at barycentric (a, b, c).
Sourcepub fn derivative(
&self,
a: f64,
b: f64,
c: f64,
direction: [f64; 3],
) -> Result<(Vec3, Vec3), BezierTriangleRefusal>
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.
Sourcepub fn side_curve(
&self,
side: TriangleSide,
) -> Result<NurbsCurve, BezierTriangleRefusal>
pub fn side_curve( &self, side: TriangleSide, ) -> Result<NurbsCurve, BezierTriangleRefusal>
The boundary row on side as a rational Bézier curve on [0, 1].
Sourcepub fn elevate(&self) -> Result<Self, BezierTriangleRefusal>
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).
Sourcepub fn compose_bilinear(
&self,
corners: [[f64; 3]; 4],
) -> Result<TrianglePiece, BezierTriangleRefusal>
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.
Sourcepub fn to_nurbs_quads(
&self,
) -> Result<[TrianglePiece; 3], BezierTriangleRefusal>
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.
Sourcepub fn to_nurbs_collapsed(&self) -> Result<TrianglePiece, BezierTriangleRefusal>
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.