Simbody  3.6
SimTK::Geo::BicubicHermitePatch_< P > Class Template Reference

A primitive useful for computations involving a single bicubic Hermite patch. More...

Public Member Functions

 BicubicHermitePatch_ ()
 Construct an uninitialized patch; control points will be garbage. More...
 
 BicubicHermitePatch_ (const Mat< 4, 4, Vec3P > &A)
 Construct a bicubic Hermite patch using the given geometry matrix B. More...
 
const Mat< 4, 4, Vec3P > & getAlgebraicCoefficients () const
 Return a reference to the algebraic coefficients A that are stored in this object. More...
 
Mat< 4, 4, Vec3PcalcHermiteCoefficients () const
 Calculate the Hermite coefficients H from the stored algebraic coefficients. More...
 
Vec3P evalP (RealP u, RealP w) const
 Evaluate a point P(u,w) on this patch given values for the parameters u and w in [0,1]. More...
 
void evalP1 (RealP u, RealP w, Vec3P &Pu, Vec3P &Pw) const
 Evaluate the tangents Pu=dP/du, Pw=dP/dw on this patch given values for the parameters u and w in [0,1]. More...
 
void evalP2 (RealP u, RealP w, Vec3P &Puu, Vec3P &Puw, Vec3P &Pww) const
 Evaluate the second derivatives Puu=d2P/du2, Pww=d2P/dw2, and cross derivative Puw=Pwu=d2P/dudw on this patch given values for the parameters u and w in [0,1]. More...
 
void evalP3 (RealP u, RealP w, Vec3P &Puuu, Vec3P &Puuw, Vec3P &Puww, Vec3P &Pwww) const
 Evaluate the third derivatives Puuu=d3P/du3, Pwww=d3P/dw3, and cross derivatives Puuw=Pwuu=Puwu=d3P/du2dw and Puww=Pwwu=Pwuw=d3P/dudw2 on this patch given values for the parameters u and w in [0,1]. More...
 

Static Public Member Functions

Utility methods

These static methods work with given coefficients.

static Mat< 4, 4, Vec3PcalcAFromH (const Mat< 4, 4, Vec3P > &H)
 Given the vector Hermite coefficients H, return the algebraic coefficients A. More...
 
static Mat< 4, 4, Vec3PcalcHFromA (const Mat< 4, 4, Vec3P > &A)
 Given the vector algebraic coefficients A, return the Hermite coefficients H. More...
 
static Vec3P evalPUsingA (const Mat< 4, 4, Vec3P > &A, RealP u, RealP w)
 Given vector algebraic coefficients A and values for the curve parameters u and w in [0..1], return the point P(u,w)=U*A*~W at that location. More...
 
static void evalP1UsingA (const Mat< 4, 4, Vec3P > &A, RealP u, RealP w, Vec3P &Pu, Vec3P &Pw)
 Given vector algebraic coefficients A and values for the curve parameters u and w in [0..1], return the tangents Pu(u,w)=dU*A*~W and Pw(u,w)=U*A*~dW at that location. More...
 
static void evalP2UsingA (const Mat< 4, 4, Vec3P > &A, RealP u, RealP w, Vec3P &Puu, Vec3P &Puw, Vec3P &Pww)
 Given vector algebraic coefficients A and values for the curve parameters u and w in [0..1], return the second derivatives Puu(u,w)=d2U*A*~W, Puw(u,w)=dU*A*~dW and Pww(u,w)=U*A*~d2W at that location. More...
 
static void evalP3UsingA (const Mat< 4, 4, Vec3P > &A, RealP u, RealP w, Vec3P &Puuu, Vec3P &Puuw, Vec3P &Puww, Vec3P &Pwww)
 Given vector algebraic coefficients A and values for the curve parameters u and w in [0..1], return the third derivatives Puuu(u,w)=d3U*A*~W, Puuw(u,w)=d2U*A*~dW, Puww(u,w)=dU*A*~d2W and Pwww(u,w)=U*A*~d3W at that location. More...
 

Detailed Description

template<class P>
class SimTK::Geo::BicubicHermitePatch_< P >

A primitive useful for computations involving a single bicubic Hermite patch.

Note that a bicubic Hermite spline surface would not necessarily be composed of these, but could use the static methods here for patch computations.

Theory

The primary reference for this implementation is the book "Geometric Modeling, 3rd ed." by Michael E. Mortenson, Industrial Press 2006, chapter 7. We follow Mortenson's notation here (with some name changes) and equation numbers are from the text. See CubicHermiteCurve_ comments for introductory material; here we add the code needed for a bicubic Hermite surface, leaning on the cubic Hermite curve code whenever possible. Note that a bicubic surface is bounded by cubic curves and every cross section is a cubic curve. This class deals with a bicubic patch in algebraic or Hermite (geometric) form. The algebraic form is stored since most operations are faster when the algebraic coefficients are available. Methods are available to convert quickly between the algebraic and Hermite forms. See BicubicBezierPatch_ for additional code for conversions to/from Bezier form and additional operations that are better performed on Bezier control points.

We use H for Hermite coefficients, rather than B, to avoid confusion with Bezier coefficients. We call the Hermite basis matrix Mh (rather than Mf). With that name change, the algebraic and Hermite basis matrices match Mortenson's:

        [ a33 a32 a31 a30 ]         [ h00  h01  w00  w01 ]    u=dp/du
    A = [ a23 a22 a21 a20 ]     H = [ h10  h11  w10  w11 ]    w=dp/dw
        [ a13 a12 a11 a10 ]         [ u00  u01  t00  t01 ]    t=d2p/dudw
        [ a03 a02 a01 a00 ]         [ u10  u11  t10  t11 ]      ("twist")

We store those in a 4x4 hypermatrix with Vec3 elements. Note that the element indices do not match the matrix indices; instead they have different meanings as defined by Mortenson. For the algebraic coefficients we have aij = A[3-i][3-j].

The patch is parameterized by u,w each in range [0..1]. A point P(u,w) on the patch can be calculated as

    P(u,w) = U A ~W = sum_ij( aij u^i w^j )
           = U Mh H ~Mh ~W

where U and W are row vectors U=[u^3 u^2 u 1], W=[w^3 w^2 w 1]. From that you can see how to interconvert between the two forms:

    A = Mh    H ~Mh
    H = Mh^-1 A ~Mh^-1

The Mh matrix is presented explicitly in CubicHermiteCurve_; it has a very simple structure. This can be used to work out low cost interconversions:

Constructor & Destructor Documentation

◆ BicubicHermitePatch_() [1/2]

template<class P >
SimTK::Geo::BicubicHermitePatch_< P >::BicubicHermitePatch_ ( )
inline

Construct an uninitialized patch; control points will be garbage.

◆ BicubicHermitePatch_() [2/2]

template<class P >
SimTK::Geo::BicubicHermitePatch_< P >::BicubicHermitePatch_ ( const Mat< 4, 4, Vec3P > &  A)
inlineexplicit

Construct a bicubic Hermite patch using the given geometry matrix B.

Member Function Documentation

◆ getAlgebraicCoefficients()

template<class P >
const Mat<4,4,Vec3P>& SimTK::Geo::BicubicHermitePatch_< P >::getAlgebraicCoefficients ( ) const
inline

Return a reference to the algebraic coefficients A that are stored in this object.

See the documentation for this class to see how the returned matrix of coefficients is defined.

◆ calcHermiteCoefficients()

template<class P >
Mat<4,4,Vec3P> SimTK::Geo::BicubicHermitePatch_< P >::calcHermiteCoefficients ( ) const
inline

Calculate the Hermite coefficients H from the stored algebraic coefficients.

See the documentation for this class to see how the returned matrix of coefficients is defined. Cost is 168 flops.

◆ evalP()

template<class P >
Vec3P SimTK::Geo::BicubicHermitePatch_< P >::evalP ( RealP  u,
RealP  w 
) const
inline

Evaluate a point P(u,w) on this patch given values for the parameters u and w in [0,1].

Values outside this range are permitted but do not lie on the patch. Cost is 94 flops.

◆ evalP1()

template<class P >
void SimTK::Geo::BicubicHermitePatch_< P >::evalP1 ( RealP  u,
RealP  w,
Vec3P Pu,
Vec3P Pw 
) const
inline

Evaluate the tangents Pu=dP/du, Pw=dP/dw on this patch given values for the parameters u and w in [0,1].

Values outside this range are permitted but do not lie on the curve segment. Cost is 148 flops.

◆ evalP2()

template<class P >
void SimTK::Geo::BicubicHermitePatch_< P >::evalP2 ( RealP  u,
RealP  w,
Vec3P Puu,
Vec3P Puw,
Vec3P Pww 
) const
inline

Evaluate the second derivatives Puu=d2P/du2, Pww=d2P/dw2, and cross derivative Puw=Pwu=d2P/dudw on this patch given values for the parameters u and w in [0,1].

Values outside this range are permitted but do not lie on the curve segment. Cost is 172 flops.

◆ evalP3()

template<class P >
void SimTK::Geo::BicubicHermitePatch_< P >::evalP3 ( RealP  u,
RealP  w,
Vec3P Puuu,
Vec3P Puuw,
Vec3P Puww,
Vec3P Pwww 
) const
inline

Evaluate the third derivatives Puuu=d3P/du3, Pwww=d3P/dw3, and cross derivatives Puuw=Pwuu=Puwu=d3P/du2dw and Puww=Pwwu=Pwuw=d3P/dudw2 on this patch given values for the parameters u and w in [0,1].

Cost is 142 flops. All higher derivatives of a cubic patch are zero.

◆ calcAFromH()

template<class P >
static Mat<4,4,Vec3P> SimTK::Geo::BicubicHermitePatch_< P >::calcAFromH ( const Mat< 4, 4, Vec3P > &  H)
inlinestatic

Given the vector Hermite coefficients H, return the algebraic coefficients A.

All coefficients are 3-vectors. Cost is 3x70=210 flops.

◆ calcHFromA()

template<class P >
static Mat<4,4,Vec3P> SimTK::Geo::BicubicHermitePatch_< P >::calcHFromA ( const Mat< 4, 4, Vec3P > &  A)
inlinestatic

Given the vector algebraic coefficients A, return the Hermite coefficients H.

All coefficients are 3-vectors. Cost is 3x56=168 flops.

◆ evalPUsingA()

template<class P >
static Vec3P SimTK::Geo::BicubicHermitePatch_< P >::evalPUsingA ( const Mat< 4, 4, Vec3P > &  A,
RealP  u,
RealP  w 
)
inlinestatic

Given vector algebraic coefficients A and values for the curve parameters u and w in [0..1], return the point P(u,w)=U*A*~W at that location.

Cost is 3x30+4=94 flops.

◆ evalP1UsingA()

template<class P >
static void SimTK::Geo::BicubicHermitePatch_< P >::evalP1UsingA ( const Mat< 4, 4, Vec3P > &  A,
RealP  u,
RealP  w,
Vec3P Pu,
Vec3P Pw 
)
inlinestatic

Given vector algebraic coefficients A and values for the curve parameters u and w in [0..1], return the tangents Pu(u,w)=dU*A*~W and Pw(u,w)=U*A*~dW at that location.

Cost is 3x48+4=148 flops.

◆ evalP2UsingA()

template<class P >
static void SimTK::Geo::BicubicHermitePatch_< P >::evalP2UsingA ( const Mat< 4, 4, Vec3P > &  A,
RealP  u,
RealP  w,
Vec3P Puu,
Vec3P Puw,
Vec3P Pww 
)
inlinestatic

Given vector algebraic coefficients A and values for the curve parameters u and w in [0..1], return the second derivatives Puu(u,w)=d2U*A*~W, Puw(u,w)=dU*A*~dW and Pww(u,w)=U*A*~d2W at that location.

Cost is 3x56+4=172 flops.

◆ evalP3UsingA()

template<class P >
static void SimTK::Geo::BicubicHermitePatch_< P >::evalP3UsingA ( const Mat< 4, 4, Vec3P > &  A,
RealP  u,
RealP  w,
Vec3P Puuu,
Vec3P Puuw,
Vec3P Puww,
Vec3P Pwww 
)
inlinestatic

Given vector algebraic coefficients A and values for the curve parameters u and w in [0..1], return the third derivatives Puuu(u,w)=d3U*A*~W, Puuw(u,w)=d2U*A*~dW, Puww(u,w)=dU*A*~d2W and Pwww(u,w)=U*A*~d3W at that location.

Cost is 3x46+4=142 flops.


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