AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::primal::BezierTriangle< T, NDIMS > Class Template Reference

Represents a Bezier triangle defined by a triangular array of control points. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/develop/src/axom/primal/geometry/BezierTriangle.hpp>

Public Types

using PointType = Point< T, NDIMS >
 
using Barycentric = Point< T, 3 >
 
using VectorType = Vector< T, NDIMS >
 
using CoordsVec = axom::Array< PointType, 1 >
 
using WeightsVec = axom::Array< T, 1 >
 
using BoundingBoxType = BoundingBox< T, NDIMS >
 
using OrientedBoundingBoxType = OrientedBoundingBox< T, NDIMS >
 
using BezierCurveType = primal::BezierCurve< T, NDIMS >
 
using EdgesVec = axom::Array< BezierCurveType >
 

Public Member Functions

 AXOM_STATIC_ASSERT_MSG ((NDIMS==1)||(NDIMS==2)||(NDIMS==3), "A Bezier Triangle object may be defined in 1-, 2-, or 3-D")
 
 AXOM_STATIC_ASSERT_MSG (std::is_arithmetic< T >::value, "A Bezier Triangle must be defined using an arithmetic type")
 
bool isRational () const
 Returns true when this triangle is rational. More...
 
void makeRational ()
 Make trivially rational. If already rational, do nothing. More...
 
void makeNonrational ()
 Make nonrational by shrinking array of weights. More...
 
CoordsVecgetControlPoints ()
 Returns a reference to the triangle's control points. More...
 
const CoordsVecgetControlPoints () const
 Returns a reference to the triangle's control points. More...
 
WeightsVecgetWeights ()
 Returns a reference to the triangle's weights. More...
 
const WeightsVecgetWeights () const
 Returns a reference to the triangle's weights. More...
 
BoundingBoxType boundingBox () const
 Returns an axis-aligned bounding box containing the Bezier triangle. More...
 
OrientedBoundingBoxType orientedBoundingBox () const
 Returns an oriented bounding box containing the Bezier triangle. More...
 
void setOrder (int ord)
 Sets the order of the Bezier triangle and resizes internal storage. More...
 
int getOrder () const
 Returns the polynomial order of the triangle. More...
 
PointType getVertex (int vertIdx) const
 Return one vertex from the Bezier triangle. More...
 
BezierCurveType getEdge (int edgeIdx) const
 Returns a copy of one of the boundary edges of the Bezier triangle. More...
 
EdgesVec getEdges () const
 Returns all three boundary edges of the Bezier triangle. More...
 
void restrictToSubtriangle (const Barycentric &Qa, const Barycentric &Qb, const Barycentric &Qc, BezierTriangle &out) const
 Restricts this Bezier triangle to a subtriangle of the parameter domain. More...
 
void split (T u0, T v0, BezierTriangle &t0, BezierTriangle &t1, BezierTriangle &t2) const
 Splits a Bezier triangle into three subtriangles by connecting an interior parameter point (u0,v0) to the triangle's three vertices. More...
 
void split (int edgeIdx, T s, BezierTriangle &t0, BezierTriangle &t1) const
 Splits a Bezier triangle into two subtriangles by connecting a point on a boundary edge to the opposite vertex. More...
 
void uniformSplit (BezierTriangle &t0, BezierTriangle &t1, BezierTriangle &t2, BezierTriangle &t3) const
 Uniform 4-way split at edge midpoints. More...
 
void split (T s1, T s2, T s3, BezierTriangle &t1, BezierTriangle &t2, BezierTriangle &t3, BezierTriangle &t4) const
 Splits a Bezier triangle into four subtriangles by inserting one split point on each boundary edge and connecting the split points pairwise. More...
 
PointTypeoperator() (int i, int j)
 Access a control point in the triangular control net. More...
 
const PointTypeoperator() (int i, int j) const
 Access a control point in the triangular control net. More...
 
const T & getWeight (int i, int j) const
 Get a specific weight from a rational Bezier triangle. More...
 
void setWeight (int i, int j, T weight)
 Set the weight at a specific index for a rational Bezier triangle. More...
 
PointType evaluate (T u0, T v0) const
 Evaluates the Bezier triangle at (u0,v0) More...
 
void evaluateFirstDerivatives (T u0, T v0, Point< T, NDIMS > &eval, Vector< T, NDIMS > &Du, Vector< T, NDIMS > &Dv) const
 Evaluates first derivatives of the Bezier triangle at (u0,v0) More...
 
void evaluateLinearDerivatives (T u0, T v0, Point< T, NDIMS > &eval, Vector< T, NDIMS > &Du, Vector< T, NDIMS > &Dv, Vector< T, NDIMS > &DuDv) const
 Evaluates all linear derivatives of a Bezier triangle at (u, v) More...
 
void evaluateSecondDerivatives (T u0, T v0, Point< T, NDIMS > &eval, Vector< T, NDIMS > &Du, Vector< T, NDIMS > &Dv, Vector< T, NDIMS > &DuDu, Vector< T, NDIMS > &DvDv, Vector< T, NDIMS > &DuDv) const
 Evaluates all second derivatives of a Bezier triangle at (u0, v0) More...
 
VectorType du (T u0, T v0) const
 Computes a tangent of a Bezier triangle at (u0, v0) along the u axis. More...
 
VectorType dv (T u0, T v0) const
 Computes a tangent of a Bezier triangle at (u0, v0) along the v axis. More...
 
VectorType dudu (T u0, T v0) const
 Computes the second derivative of a Bezier triangle at (u0, v0) along the u axis. More...
 
VectorType dvdv (T u0, T v0) const
 Computes the second derivative of a Bezier triangle at (u0, v0) along the v axis. More...
 
VectorType dudv (T u0, T v0) const
 Computes the mixed second derivative of a Bezier triangle at (u0, v0) More...
 
VectorType dvdu (T u0, T v0) const
 Convenience alias for S_vu(u0,v0), which equals S_uv(u0,v0) for polynomial triangles. More...
 
VectorType normal (T u0, T v0) const
 Computes the normal vector of a Bezier triangle at (u0, v0) More...
 
std::ostream & print (std::ostream &os) const
 Simple formatted print of a Bezier Triangle instance. More...
 
Constructors for BezierTriangle

The constructors allow for flexible initialization of BezierTriangle objects from:

  • 1D Axom arrays/views of control points and weights,
  • C-style arrays of control points and weights,
  • a specified polynomial order,
  • rational or polynomial (nonrational) triangles, depending on the presence of weights.

The triangle is parametrized over the domain \( u \ge 0, v \ge 0, u+v \le 1 \).

Rational triangles are identified by a non-empty weights array, and nonrational triangles by an empty weights array. All weights must be greater than 0 in a rational triangle.

For 1D control point/weight arrays, the expected layout corresponds to the indexing used by operator()(i,j): pts[ triIndex(N,i,j) ] <-> (*this)(i,j) for 0<=i<=N and 0<=j<=N-i

 BezierTriangle (axom::ArrayView< const PointType > controlPoints, axom::ArrayView< const T > weights, int ord)
 Constructor from ArrayViews of control points and weights. More...
 
 BezierTriangle (axom::ArrayView< PointType > controlPoints, axom::ArrayView< T > weights, int ord)
 Constructor from ArrayViews of (non-const) control points and weights. More...
 
 BezierTriangle (int ord=-1)
 Constructor for a polynomial (nonrational) Bezier Triangle that reserves space. More...
 
 BezierTriangle (const PointType *pts, int ord)
 Constructor for a polynomial Bezier Triangle from an array of coordinates. More...
 
 BezierTriangle (const PointType *pts, const T *weights, int ord)
 Constructor for a rational Bezier Triangle from arrays of coordinates and weights. More...
 
 BezierTriangle (const CoordsVec &pts, int ord)
 Constructor from an Axom array of control points. More...
 
 BezierTriangle (const CoordsVec &pts, const WeightsVec &weights, int ord)
 Constructor from Axom arrays of control points and weights. More...
 

Static Public Member Functions

static constexpr int triSize (int ord)
 Returns the number of control points for a triangle of order ord. More...
 
static constexpr size_t triIndex (int ord, int i, int j)
 Maps triangular indices (i,j) to the linear storage index. More...
 
static constexpr bool isValidIndex (int ord, int i, int j)
 Check if a given index is valid in the triangular array. More...
 
static constexpr PointType triInterpolate (const PointType &A, const PointType &B, const PointType &C, const Barycentric &Q)
 Do a triangular interpolation from three points and a barycentric coordinate. More...
 
static constexpr T triInterpolate (const T &A, const T &B, const T &C, const Barycentric &Q)
 Do a triangular interpolation from three coordinates and a barycentric coordinate. More...
 

Friends

class BezierTriangle< T, 1 >
 
class BezierTriangle< T, 2 >
 
class BezierTriangle< T, 3 >
 

Detailed Description

template<typename T, int NDIMS>
class axom::primal::BezierTriangle< T, NDIMS >

Represents a Bezier triangle defined by a triangular array of control points.

Template Parameters
Tthe coordinate type, e.g., double, float, etc.
NDIMSThe dimension of each control point, e.g. 1 for rational weights

A Bezier triangle of order N has \( (N+1)(N+2)/2 \) control points. It is parametrized over the domain \( u0 \ge 0, v0 \ge 0, u0+v0 \le 1 \).

Control points are indexed using integer coordinates \( (i,j) \) with \( 0 \le i \le N \) and \( 0 \le j \le N-i \) and accessed via operator()(i,j). Internally, the triangular control net is stored in a 1D array and triIndex(N,i,j) maps \( (i,j) \) to that linear storage index.

Rational triangles are represented by an additional set of positive weights. Polynomial (nonrational) Bezier triangles are identified by an empty weights array.

A default-constructed triangle will have order -1, and is "invalid". Arrays of nodes and weights will be empty, and most methods are invalid

Note
This triangle uses permuted barycentric coordinates (u0, v0) for evaluation such that, when getOrder()==1, the parameter values correspond to the triangle vertices:
  • evaluate(0,0) == (*this)(0,0)
  • evaluate(0,1) == (*this)(0,1)
  • evaluate(1,0) == (*this)(1,0)

These are mapped to standard Barycentric coordinates {u,v,w} through (u0, v0) = {1 - u0 - v0, v0, u0}:

Parametric (u0, v0): Barycentric {u,v,w}: (1, 0) {0,0,1} /\ /\ / \ / \ ^ / \ <—> / \ | / \ / \ | / \ / \ v0 /__________\ /__________\ (0, 0) u0 —> (0, 1) {1,0,0} {0,1,0}

Member Typedef Documentation

◆ PointType

template<typename T , int NDIMS>
using axom::primal::BezierTriangle< T, NDIMS >::PointType = Point<T, NDIMS>

◆ Barycentric

template<typename T , int NDIMS>
using axom::primal::BezierTriangle< T, NDIMS >::Barycentric = Point<T, 3>

◆ VectorType

template<typename T , int NDIMS>
using axom::primal::BezierTriangle< T, NDIMS >::VectorType = Vector<T, NDIMS>

◆ CoordsVec

template<typename T , int NDIMS>
using axom::primal::BezierTriangle< T, NDIMS >::CoordsVec = axom::Array<PointType, 1>

◆ WeightsVec

template<typename T , int NDIMS>
using axom::primal::BezierTriangle< T, NDIMS >::WeightsVec = axom::Array<T, 1>

◆ BoundingBoxType

template<typename T , int NDIMS>
using axom::primal::BezierTriangle< T, NDIMS >::BoundingBoxType = BoundingBox<T, NDIMS>

◆ OrientedBoundingBoxType

template<typename T , int NDIMS>
using axom::primal::BezierTriangle< T, NDIMS >::OrientedBoundingBoxType = OrientedBoundingBox<T, NDIMS>

◆ BezierCurveType

template<typename T , int NDIMS>
using axom::primal::BezierTriangle< T, NDIMS >::BezierCurveType = primal::BezierCurve<T, NDIMS>

◆ EdgesVec

template<typename T , int NDIMS>
using axom::primal::BezierTriangle< T, NDIMS >::EdgesVec = axom::Array<BezierCurveType>

Constructor & Destructor Documentation

◆ BezierTriangle() [1/7]

template<typename T , int NDIMS>
axom::primal::BezierTriangle< T, NDIMS >::BezierTriangle ( axom::ArrayView< const PointType controlPoints,
axom::ArrayView< const T >  weights,
int  ord 
)
inline

Constructor from ArrayViews of control points and weights.

Parameters
[in]controlPointsArrayView of control points (size: (ord+1)(ord+2)/2 or 0)
[in]weightsArrayView of weights (size: (ord+1)(ord+2)/2 or 0)
[in]ordThe triangle's polynomial order

If controlPoints is empty, we still allocate space for the control points.

Precondition
ord must be greater than or equal to -1

References axom::ArrayView< T, DIM, SPACE >::data(), axom::ArrayView< T, DIM, SPACE >::empty(), axom::Array< T, DIM, SPACE, StoragePolicy >::resize(), axom::ArrayView< T, DIM, SPACE >::size(), SLIC_ASSERT, and axom::primal::BezierTriangle< T, NDIMS >::triSize().

◆ BezierTriangle() [2/7]

template<typename T , int NDIMS>
axom::primal::BezierTriangle< T, NDIMS >::BezierTriangle ( axom::ArrayView< PointType controlPoints,
axom::ArrayView< T >  weights,
int  ord 
)
inline

Constructor from ArrayViews of (non-const) control points and weights.

◆ BezierTriangle() [3/7]

template<typename T , int NDIMS>
axom::primal::BezierTriangle< T, NDIMS >::BezierTriangle ( int  ord = -1)
inlineexplicit

Constructor for a polynomial (nonrational) Bezier Triangle that reserves space.

Parameters
[in]ordThe triangle's polynomial order
Precondition
ord must be greater than or equal to -1

◆ BezierTriangle() [4/7]

template<typename T , int NDIMS>
axom::primal::BezierTriangle< T, NDIMS >::BezierTriangle ( const PointType pts,
int  ord 
)
inline

Constructor for a polynomial Bezier Triangle from an array of coordinates.

Parameters
[in]ptsA 1D C-style array of (ord+1)(ord+2)/2 control points
[in]ordThe triangle's polynomial order
Precondition
ord is greater than or equal to zero

◆ BezierTriangle() [5/7]

template<typename T , int NDIMS>
axom::primal::BezierTriangle< T, NDIMS >::BezierTriangle ( const PointType pts,
const T *  weights,
int  ord 
)
inline

Constructor for a rational Bezier Triangle from arrays of coordinates and weights.

Parameters
[in]ptsA 1D C-style array of (ord+1)(ord+2)/2 control points
[in]weightsA 1D C-style array of (ord+1)(ord+2)/2 positive weights
[in]ordThe triangle's polynomial order
Precondition
ord is greater than or equal to zero

If weights is the null pointer, creates a nonrational triangle.

◆ BezierTriangle() [6/7]

template<typename T , int NDIMS>
axom::primal::BezierTriangle< T, NDIMS >::BezierTriangle ( const CoordsVec pts,
int  ord 
)
inline

Constructor from an Axom array of control points.

Parameters
[in]ptsA 1D Axom array of (ord+1)(ord+2)/2 control points
[in]ordThe triangle's polynomial order (>= 0)

◆ BezierTriangle() [7/7]

template<typename T , int NDIMS>
axom::primal::BezierTriangle< T, NDIMS >::BezierTriangle ( const CoordsVec pts,
const WeightsVec weights,
int  ord 
)
inline

Constructor from Axom arrays of control points and weights.

Parameters
[in]ptsA 1D Axom array of (ord+1)(ord+2)/2 control points
[in]weightsA 1D Axom array of (ord+1)(ord+2)/2 positive weights
[in]ordThe triangle's polynomial order (>= 0)

Member Function Documentation

◆ AXOM_STATIC_ASSERT_MSG() [1/2]

template<typename T , int NDIMS>
axom::primal::BezierTriangle< T, NDIMS >::AXOM_STATIC_ASSERT_MSG ( (NDIMS==1)||(NDIMS==2)||(NDIMS==3)  ,
"A Bezier Triangle object may be defined in 1-  ,
2-  ,
or 3-D"   
)

◆ AXOM_STATIC_ASSERT_MSG() [2/2]

template<typename T , int NDIMS>
axom::primal::BezierTriangle< T, NDIMS >::AXOM_STATIC_ASSERT_MSG ( std::is_arithmetic< T >::value  ,
"A Bezier Triangle must be defined using an arithmetic type"   
)

◆ isRational()

template<typename T , int NDIMS>
bool axom::primal::BezierTriangle< T, NDIMS >::isRational ( ) const
inline

Returns true when this triangle is rational.

A rational triangle has a weight per control point; polynomial (nonrational) triangles are identified by an empty weight array.

References axom::Array< T, DIM, SPACE, StoragePolicy >::empty().

◆ makeRational()

template<typename T , int NDIMS>
void axom::primal::BezierTriangle< T, NDIMS >::makeRational ( )
inline

◆ makeNonrational()

template<typename T , int NDIMS>
void axom::primal::BezierTriangle< T, NDIMS >::makeNonrational ( )
inline

Make nonrational by shrinking array of weights.

References axom::Array< T, DIM, SPACE, StoragePolicy >::clear().

◆ getControlPoints() [1/2]

template<typename T , int NDIMS>
CoordsVec& axom::primal::BezierTriangle< T, NDIMS >::getControlPoints ( )
inline

Returns a reference to the triangle's control points.

The control net contains triSize(getOrder()) points (or 0 when getOrder()<0).

◆ getControlPoints() [2/2]

template<typename T , int NDIMS>
const CoordsVec& axom::primal::BezierTriangle< T, NDIMS >::getControlPoints ( ) const
inline

Returns a reference to the triangle's control points.

◆ getWeights() [1/2]

template<typename T , int NDIMS>
WeightsVec& axom::primal::BezierTriangle< T, NDIMS >::getWeights ( )
inline

Returns a reference to the triangle's weights.

The weight array is empty for polynomial triangles. For rational triangles it contains triSize(getOrder()) positive weights.

◆ getWeights() [2/2]

template<typename T , int NDIMS>
const WeightsVec& axom::primal::BezierTriangle< T, NDIMS >::getWeights ( ) const
inline

Returns a reference to the triangle's weights.

◆ boundingBox()

template<typename T , int NDIMS>
BoundingBoxType axom::primal::BezierTriangle< T, NDIMS >::boundingBox ( ) const
inline

Returns an axis-aligned bounding box containing the Bezier triangle.

Note
The returned box is computed from the control points.

References axom::Array< T, DIM, SPACE, StoragePolicy >::data(), and axom::Array< T, DIM, SPACE, StoragePolicy >::size().

◆ orientedBoundingBox()

template<typename T , int NDIMS>
OrientedBoundingBoxType axom::primal::BezierTriangle< T, NDIMS >::orientedBoundingBox ( ) const
inline

Returns an oriented bounding box containing the Bezier triangle.

Note
The returned box is computed from the control points.

References axom::Array< T, DIM, SPACE, StoragePolicy >::data(), and axom::Array< T, DIM, SPACE, StoragePolicy >::size().

◆ setOrder()

template<typename T , int NDIMS>
void axom::primal::BezierTriangle< T, NDIMS >::setOrder ( int  ord)
inline

Sets the order of the Bezier triangle and resizes internal storage.

Parameters
[in]ordThe polynomial order
Precondition
ord must be greater than or equal to -1
Note
This function only resizes the control point and weight arrays and does not initialize their values. If the triangle is rational (isRational()==true), the weight array is also resized to match the number of control points.

References axom::primal::BezierTriangle< T, NDIMS >::isRational(), axom::Array< T, DIM, SPACE, StoragePolicy >::resize(), SLIC_ASSERT, and axom::primal::BezierTriangle< T, NDIMS >::triSize().

◆ getOrder()

template<typename T , int NDIMS>
int axom::primal::BezierTriangle< T, NDIMS >::getOrder ( ) const
inline

Returns the polynomial order of the triangle.

Note
A default constructed triangle has order -1 and no control points.

◆ getVertex()

template<typename T , int NDIMS>
PointType axom::primal::BezierTriangle< T, NDIMS >::getVertex ( int  vertIdx) const
inline

Return one vertex from the Bezier triangle.

Parameters
[in]vertIdxIndex of the requested vertex

The vertices are returned in counter-clockwise order with respect to the first control point (*this)(0, 0) == evaluate(0, 0)

Returns
The PointType object at the vertex

References SLIC_ASSERT.

◆ getEdge()

template<typename T , int NDIMS>
BezierCurveType axom::primal::BezierTriangle< T, NDIMS >::getEdge ( int  edgeIdx) const
inline

Returns a copy of one of the boundary edges of the Bezier triangle.

Parameters
[in]edgeIdxIndex of the requested edge in [0,2]

The edges are returned in counter-clockwise order with respect to the parameter domain (u,v), with edge 0 across from corner 0 (i.e. evaluate(0,0)):

  • edgeIdx = 0: u+v = 1 from evaluate(1,0) to evaluate(0,1)
  • edgeIdx = 1: u = 0 from evaluate(0,1) to evaluate(0,0)
  • edgeIdx = 2: v = 0 from evaluate(0,0) to evaluate(1,0)
Returns
A copy of the Bezier curve representing the requested edge.

References axom::primal::BezierTriangle< T, NDIMS >::isRational(), axom::Array< T, DIM, SPACE, StoragePolicy >::resize(), SLIC_ASSERT, and axom::primal::BezierTriangle< T, NDIMS >::triIndex().

◆ getEdges()

template<typename T , int NDIMS>
EdgesVec axom::primal::BezierTriangle< T, NDIMS >::getEdges ( ) const
inline

Returns all three boundary edges of the Bezier triangle.

Returns
An array of three Bezier curves, ordered the same as getEdge(int).

References axom::primal::BezierTriangle< T, NDIMS >::getEdge(), axom::Array< T, DIM, SPACE, StoragePolicy >::push_back(), axom::Array< T, DIM, SPACE, StoragePolicy >::reserve(), and SLIC_ASSERT.

◆ restrictToSubtriangle()

template<typename T , int NDIMS>
void axom::primal::BezierTriangle< T, NDIMS >::restrictToSubtriangle ( const Barycentric Qa,
const Barycentric Qb,
const Barycentric Qc,
BezierTriangle< T, NDIMS > &  out 
) const
inline

Restricts this Bezier triangle to a subtriangle of the parameter domain.

See overload returning a BezierTriangle for the vertex mapping convention.

Parameters
[in]QaBarycentric coordinates of the first subtriangle vertex (u,v,w)
[in]QbBarycentric coordinates of the second subtriangle vertex (u,v,w)
[in]QcBarycentric coordinates of the third subtriangle vertex (u,v,w)
[out]outOutput restricted Bezier triangle
Precondition
getOrder() >= 0
Note
The barycentric inputs Qa, Qb, Qc are standard Barycentric coordiantes related to parameter convention through (u0 = Qc, v0 = Qb)

References axom::primal::BezierTriangle< T, NDIMS >::isRational(), axom::primal::BezierTriangle< T, NDIMS >::makeNonrational(), axom::primal::BezierTriangle< T, NDIMS >::restrictToSubtriangle(), axom::primal::BezierTriangle< T, NDIMS >::setOrder(), SLIC_ASSERT, axom::Array< T, DIM, SPACE, StoragePolicy >::swap(), axom::primal::BezierTriangle< T, NDIMS >::triIndex(), axom::primal::BezierTriangle< T, NDIMS >::triInterpolate(), and axom::primal::BezierTriangle< T, NDIMS >::triSize().

◆ split() [1/3]

template<typename T , int NDIMS>
void axom::primal::BezierTriangle< T, NDIMS >::split ( u0,
v0,
BezierTriangle< T, NDIMS > &  t0,
BezierTriangle< T, NDIMS > &  t1,
BezierTriangle< T, NDIMS > &  t2 
) const
inline

Splits a Bezier triangle into three subtriangles by connecting an interior parameter point (u0,v0) to the triangle's three vertices.

Parameters
[in]u0Parameter value along the u axis for the split point
[in]v0Parameter value along the v axis for the split point
[out]t0Subtriangle over the parameter triangle with vertices (0,1), (1,0), and (u0,v0) (preserves edge 0)
[out]t1Subtriangle over the parameter triangle with vertices (1,0), (0,0), and (u0,v0) (preserves edge 1)
[out]t2Subtriangle over the parameter triangle with vertices (0,0), (0,1), and (u0,v0) (preserves edge 2)
Precondition
u0 > 0, v0 > 0, and u0 + v0 < 1
       A
      /|\
     / | \
    /t2|t1\
   /  /Q\  \
  / /  t0 \ \
 //_________\\
B             C
Returns
t0 = Tri(B,C,Q), t1 = Tri(C,A,Q), t2 = Tri(A,B,Q)

References axom::primal::BezierTriangle< T, NDIMS >::isRational(), axom::primal::BezierTriangle< T, NDIMS >::makeNonrational(), axom::Array< T, DIM, SPACE, StoragePolicy >::resize(), axom::primal::BezierTriangle< T, NDIMS >::setOrder(), SLIC_ASSERT, axom::primal::BezierTriangle< T, NDIMS >::split(), axom::primal::BezierTriangle< T, NDIMS >::triIndex(), axom::primal::BezierTriangle< T, NDIMS >::triInterpolate(), and axom::primal::BezierTriangle< T, NDIMS >::triSize().

◆ split() [2/3]

template<typename T , int NDIMS>
void axom::primal::BezierTriangle< T, NDIMS >::split ( int  edgeIdx,
s,
BezierTriangle< T, NDIMS > &  t0,
BezierTriangle< T, NDIMS > &  t1 
) const
inline

Splits a Bezier triangle into two subtriangles by connecting a point on a boundary edge to the opposite vertex.

Parameters
[in]edgeIdxIndex of the boundary edge to split (same convention as getEdge(int))
[in]sParameter in (0,1) locating the split point along the chosen edge
[out]t0First output subtriangle
[out]t1Second output subtriangle
Precondition
edgeIdx is 0, 1, or 2
s is in (0,1)

Taking P0 as the vertex opposite edge edgeIdx:

       P0
      /|\
     / | \
    /  |  \
   /   |   \
  / t0 | t1 \
 /_____|_____\

P1 Q P2 s=0 s s=1

Returns
t0 = Tri( P0, P1, Q ), t1 = Tri( P2, P0, Q )

References axom::primal::BezierTriangle< T, NDIMS >::isRational(), axom::Array< T, DIM, SPACE, StoragePolicy >::resize(), SLIC_ASSERT, axom::primal::BezierTriangle< T, NDIMS >::split(), axom::primal::BezierTriangle< T, NDIMS >::triIndex(), axom::primal::BezierTriangle< T, NDIMS >::triInterpolate(), and axom::primal::BezierTriangle< T, NDIMS >::triSize().

◆ uniformSplit()

template<typename T , int NDIMS>
void axom::primal::BezierTriangle< T, NDIMS >::uniformSplit ( BezierTriangle< T, NDIMS > &  t0,
BezierTriangle< T, NDIMS > &  t1,
BezierTriangle< T, NDIMS > &  t2,
BezierTriangle< T, NDIMS > &  t3 
) const
inline

Uniform 4-way split at edge midpoints.

Parameters
[out]t0Subtriangle near vertex (0,0)
[out]t1Subtriangle near vertex (0,1)
[out]t2Subtriangle near vertex (1,0)
[out]t3Central subtriangle

This is equivalent to split(0.5, 0.5, 0.5, ...), but with optimizations to reduce redundant computations by sharing intermediate control nets. We also separate the implementation based on triangle rationality to improve performance

      C
      /\
     /t2\
 P1 /____\ P0
   /\ t3 /\
  /t0\  /t1\
 /____\/____\
A     P2      B
Returns
t0 = Tri( A, P2, P1 ), t1 = Tri( B, P0, P2 ), t2 = Tri( C, P1, P0 ), t3 = Tri( P1, P0, P2 )

References axom::primal::BezierTriangle< T, NDIMS >::isRational(), axom::primal::BezierTriangle< T, NDIMS >::makeNonrational(), axom::primal::BezierTriangle< T, NDIMS >::makeRational(), axom::primal::BezierTriangle< T, NDIMS >::setOrder(), SLIC_ASSERT, and axom::primal::BezierTriangle< T, NDIMS >::triIndex().

◆ split() [3/3]

template<typename T , int NDIMS>
void axom::primal::BezierTriangle< T, NDIMS >::split ( s1,
s2,
s3,
BezierTriangle< T, NDIMS > &  t1,
BezierTriangle< T, NDIMS > &  t2,
BezierTriangle< T, NDIMS > &  t3,
BezierTriangle< T, NDIMS > &  t4 
) const
inline

Splits a Bezier triangle into four subtriangles by inserting one split point on each boundary edge and connecting the split points pairwise.

Parameters
[in]s1Parameter in (0,1) locating the split point on edge 0 (same convention as getEdge(0))
[in]s2Parameter in (0,1) locating the split point on edge 1 (same convention as getEdge(1))
[in]s3Parameter in (0,1) locating the split point on edge 2 (same convention as getEdge(2))
[out]t1Subtriangle near vertex (0,0) with vertices (0,0), point on edge 2, point on edge 1
[out]t2Subtriangle near vertex (0,1) with vertices (0,1), point on edge 0, point on edge 2
[out]t3Subtriangle near vertex (1,0) with vertices (1,0), point on edge 1, point on edge 0
[out]t4Central subtriangle with vertices point on edge 1, point on edge 0, point on edge 2
Precondition
s1, s2, s3 are all in (0,1) C /\ /t3\ P1 /____\ P0 /\ t4 /\ /t1\ /t2\ /____\/____\ A P2 B
Returns
t1 = Tri( A, P2, P1 ), t2 = Tri( B, P0, P2 ), t3 = Tri( C, P1, P0 ), t4 = Tri( P1, P0, P2 )

References axom::primal::BezierTriangle< T, NDIMS >::restrictToSubtriangle(), and SLIC_ASSERT.

◆ operator()() [1/2]

template<typename T , int NDIMS>
PointType& axom::primal::BezierTriangle< T, NDIMS >::operator() ( int  i,
int  j 
)
inline

Access a control point in the triangular control net.

Parameters
[in]iThe first index (0 <= i <= getOrder())
[in]jThe second index (0 <= j <= getOrder()-i)
Precondition
i and j are in range and i+j <= getOrder()

References axom::primal::BezierTriangle< T, NDIMS >::isValidIndex(), SLIC_ASSERT, and axom::primal::BezierTriangle< T, NDIMS >::triIndex().

◆ operator()() [2/2]

template<typename T , int NDIMS>
const PointType& axom::primal::BezierTriangle< T, NDIMS >::operator() ( int  i,
int  j 
) const
inline

◆ getWeight()

template<typename T , int NDIMS>
const T& axom::primal::BezierTriangle< T, NDIMS >::getWeight ( int  i,
int  j 
) const
inline

Get a specific weight from a rational Bezier triangle.

Parameters
[in]iFirst control net index
[in]jSecond control net index
Precondition
Requires that the triangle be rational

References axom::primal::BezierTriangle< T, NDIMS >::isRational(), axom::primal::BezierTriangle< T, NDIMS >::isValidIndex(), SLIC_ASSERT, and axom::primal::BezierTriangle< T, NDIMS >::triIndex().

◆ setWeight()

template<typename T , int NDIMS>
void axom::primal::BezierTriangle< T, NDIMS >::setWeight ( int  i,
int  j,
weight 
)
inline

Set the weight at a specific index for a rational Bezier triangle.

Parameters
[in]iFirst control net index
[in]jSecond control net index
[in]weightThe updated value of the weight
Precondition
Requires that the triangle be rational
Requires that the weight be positive

References axom::primal::BezierTriangle< T, NDIMS >::isRational(), axom::primal::BezierTriangle< T, NDIMS >::isValidIndex(), SLIC_ASSERT, and axom::primal::BezierTriangle< T, NDIMS >::triIndex().

◆ evaluate()

template<typename T , int NDIMS>
PointType axom::primal::BezierTriangle< T, NDIMS >::evaluate ( u0,
v0 
) const
inline

Evaluates the Bezier triangle at (u0,v0)

Parameters
[in]u0Parameter value along the u axis
[in]v0Parameter value along the v axis
Note
Evaluation uses permuted barycentric coordinates such that parameter values (u0, v0) correspond to the triangle vertices:
  • evaluate(0,0) == (*this)(0,0)
  • evaluate(0,1) == (*this)(0,order)
  • evaluate(1,0) == (*this)(order,0)
Warning
Will automatically extrapolate if (u0, v0) are outside the triangular domain (u0 >= 0, v0 >= 0, and u0+v0 <= 1)
Returns
Point value S(u0,v0)

References axom::utilities::annotations::end(), axom::primal::BezierTriangle< T, NDIMS >::evaluate(), axom::primal::BezierTriangle< T, NDIMS >::isRational(), axom::Array< T, DIM, SPACE, StoragePolicy >::size(), SLIC_ASSERT, axom::primal::BezierTriangle< T, NDIMS >::triIndex(), and axom::primal::BezierTriangle< T, NDIMS >::triInterpolate().

◆ evaluateFirstDerivatives()

template<typename T , int NDIMS>
void axom::primal::BezierTriangle< T, NDIMS >::evaluateFirstDerivatives ( u0,
v0,
Point< T, NDIMS > &  eval,
Vector< T, NDIMS > &  Du,
Vector< T, NDIMS > &  Dv 
) const
inline

Evaluates first derivatives of the Bezier triangle at (u0,v0)

Parameters
[in]u0Parameter value along the u axis
[in]v0Parameter value along the v axis
[out]evalPoint value S(u,v)
[out]DuFirst derivative S_u(u,v)
[out]DvFirst derivative S_v(u,v)
Warning
Will automatically extrapolate if (u0, v0) are outside the triangular domain (u0 >= 0, v0 >= 0, and u0+v0 <= 1)

References axom::utilities::annotations::end(), axom::primal::BezierTriangle< T, NDIMS >::evaluateFirstDerivatives(), axom::primal::BezierTriangle< T, NDIMS >::isRational(), axom::Array< T, DIM, SPACE, StoragePolicy >::size(), SLIC_ASSERT, axom::primal::BezierTriangle< T, NDIMS >::triIndex(), and axom::primal::BezierTriangle< T, NDIMS >::triInterpolate().

◆ evaluateLinearDerivatives()

template<typename T , int NDIMS>
void axom::primal::BezierTriangle< T, NDIMS >::evaluateLinearDerivatives ( u0,
v0,
Point< T, NDIMS > &  eval,
Vector< T, NDIMS > &  Du,
Vector< T, NDIMS > &  Dv,
Vector< T, NDIMS > &  DuDv 
) const
inline

Evaluates all linear derivatives of a Bezier triangle at (u, v)

Parameters
[in]u0Parameter value at which to evaluate along the u axis
[in]v0Parameter value at which to evaluate along the v axis
[out]evalThe point value of the Bezier triangle at (u, v)
[out]DuThe vector value of S_u(u, v)
[out]DvThe vector value of S_v(u, v)
[out]DuDvThe vector value of S_uv(u, v) == S_vu(u, v)
Warning
Will automatically extrapolate if (u0, v0) are outside the triangular domain (u0 >= 0, v0 >= 0, and u0+v0 <= 1)

References axom::utilities::annotations::end(), axom::primal::BezierTriangle< T, NDIMS >::evaluateFirstDerivatives(), axom::primal::BezierTriangle< T, NDIMS >::evaluateLinearDerivatives(), axom::primal::BezierTriangle< T, NDIMS >::isRational(), axom::Array< T, DIM, SPACE, StoragePolicy >::size(), SLIC_ASSERT, axom::primal::BezierTriangle< T, NDIMS >::triIndex(), and axom::primal::BezierTriangle< T, NDIMS >::triInterpolate().

◆ evaluateSecondDerivatives()

template<typename T , int NDIMS>
void axom::primal::BezierTriangle< T, NDIMS >::evaluateSecondDerivatives ( u0,
v0,
Point< T, NDIMS > &  eval,
Vector< T, NDIMS > &  Du,
Vector< T, NDIMS > &  Dv,
Vector< T, NDIMS > &  DuDu,
Vector< T, NDIMS > &  DvDv,
Vector< T, NDIMS > &  DuDv 
) const
inline

Evaluates all second derivatives of a Bezier triangle at (u0, v0)

Parameters
[in]u0Parameter value at which to evaluate along the u axis
[in]v0Parameter value at which to evaluate along the v axis
[out]evalThe point value of the Bezier triangle at (u, v)
[out]DuThe vector value of S_u(u, v)
[out]DvThe vector value of S_v(u, v)
[out]DuDuThe vector value of S_uu(u, v)
[out]DvDvThe vector value of S_vv(u, v)
[out]DuDvThe vector value of S_uv(u, v) == S_vu(u, v)
Warning
Will automatically extrapolate if (u0, v0) are outside the triangular domain (u0 >= 0, v0 >= 0, and u0+v0 <= 1)

References axom::utilities::annotations::end(), axom::primal::BezierTriangle< T, NDIMS >::evaluateFirstDerivatives(), axom::primal::BezierTriangle< T, NDIMS >::evaluateSecondDerivatives(), axom::primal::BezierTriangle< T, NDIMS >::isRational(), axom::Array< T, DIM, SPACE, StoragePolicy >::size(), SLIC_ASSERT, axom::primal::BezierTriangle< T, NDIMS >::triIndex(), and axom::primal::BezierTriangle< T, NDIMS >::triInterpolate().

◆ du()

template<typename T , int NDIMS>
VectorType axom::primal::BezierTriangle< T, NDIMS >::du ( u0,
v0 
) const
inline

Computes a tangent of a Bezier triangle at (u0, v0) along the u axis.

References axom::primal::BezierTriangle< T, NDIMS >::evaluateFirstDerivatives().

◆ dv()

template<typename T , int NDIMS>
VectorType axom::primal::BezierTriangle< T, NDIMS >::dv ( u0,
v0 
) const
inline

Computes a tangent of a Bezier triangle at (u0, v0) along the v axis.

References axom::primal::BezierTriangle< T, NDIMS >::evaluateFirstDerivatives().

◆ dudu()

template<typename T , int NDIMS>
VectorType axom::primal::BezierTriangle< T, NDIMS >::dudu ( u0,
v0 
) const
inline

Computes the second derivative of a Bezier triangle at (u0, v0) along the u axis.

References axom::primal::BezierTriangle< T, NDIMS >::evaluateSecondDerivatives().

◆ dvdv()

template<typename T , int NDIMS>
VectorType axom::primal::BezierTriangle< T, NDIMS >::dvdv ( u0,
v0 
) const
inline

Computes the second derivative of a Bezier triangle at (u0, v0) along the v axis.

References axom::primal::BezierTriangle< T, NDIMS >::evaluateSecondDerivatives().

◆ dudv()

template<typename T , int NDIMS>
VectorType axom::primal::BezierTriangle< T, NDIMS >::dudv ( u0,
v0 
) const
inline

Computes the mixed second derivative of a Bezier triangle at (u0, v0)

References axom::primal::BezierTriangle< T, NDIMS >::evaluateSecondDerivatives().

◆ dvdu()

template<typename T , int NDIMS>
VectorType axom::primal::BezierTriangle< T, NDIMS >::dvdu ( u0,
v0 
) const
inline

Convenience alias for S_vu(u0,v0), which equals S_uv(u0,v0) for polynomial triangles.

References axom::primal::BezierTriangle< T, NDIMS >::dudv().

◆ normal()

template<typename T , int NDIMS>
VectorType axom::primal::BezierTriangle< T, NDIMS >::normal ( u0,
v0 
) const
inline

Computes the normal vector of a Bezier triangle at (u0, v0)

Note
Only meaningful for NDIMS==3.

References axom::primal::Vector< T, NDIMS >::cross_product(), and axom::primal::BezierTriangle< T, NDIMS >::evaluateFirstDerivatives().

◆ print()

template<typename T , int NDIMS>
std::ostream& axom::primal::BezierTriangle< T, NDIMS >::print ( std::ostream &  os) const
inline

Simple formatted print of a Bezier Triangle instance.

Parameters
osThe output stream to write to
Returns
A reference to the modified ostream

References axom::primal::BezierTriangle< T, NDIMS >::isRational(), and axom::primal::BezierTriangle< T, NDIMS >::triIndex().

◆ triSize()

template<typename T , int NDIMS>
static constexpr int axom::primal::BezierTriangle< T, NDIMS >::triSize ( int  ord)
inlinestaticconstexpr

Returns the number of control points for a triangle of order ord.

Parameters
[in]ordTriangle order

◆ triIndex()

template<typename T , int NDIMS>
static constexpr size_t axom::primal::BezierTriangle< T, NDIMS >::triIndex ( int  ord,
int  i,
int  j 
)
inlinestaticconstexpr

Maps triangular indices (i,j) to the linear storage index.

Parameters
[in]ordTriangle order
[in]iFirst control net index
[in]jSecond control net index
Precondition
ord >= 0, i >= 0, j >= 0, and i+j <= ord

◆ isValidIndex()

template<typename T , int NDIMS>
static constexpr bool axom::primal::BezierTriangle< T, NDIMS >::isValidIndex ( int  ord,
int  i,
int  j 
)
inlinestaticconstexpr

Check if a given index is valid in the triangular array.

◆ triInterpolate() [1/2]

template<typename T , int NDIMS>
static constexpr PointType axom::primal::BezierTriangle< T, NDIMS >::triInterpolate ( const PointType A,
const PointType B,
const PointType C,
const Barycentric Q 
)
inlinestaticconstexpr

Do a triangular interpolation from three points and a barycentric coordinate.

References axom::primal::Point< T, NDIMS >::array().

◆ triInterpolate() [2/2]

template<typename T , int NDIMS>
static constexpr T axom::primal::BezierTriangle< T, NDIMS >::triInterpolate ( const T &  A,
const T &  B,
const T &  C,
const Barycentric Q 
)
inlinestaticconstexpr

Do a triangular interpolation from three coordinates and a barycentric coordinate.

Friends And Related Function Documentation

◆ BezierTriangle< T, 1 >

template<typename T , int NDIMS>
friend class BezierTriangle< T, 1 >
friend

◆ BezierTriangle< T, 2 >

template<typename T , int NDIMS>
friend class BezierTriangle< T, 2 >
friend

◆ BezierTriangle< T, 3 >

template<typename T , int NDIMS>
friend class BezierTriangle< T, 3 >
friend

The documentation for this class was generated from the following file: