1 #ifndef SimTK_SIMMATH_GEO_BICUBIC_BEZIER_PATCH_H_ 
    2 #define SimTK_SIMMATH_GEO_BICUBIC_BEZIER_PATCH_H_ 
  114 :   B(controlPoints) {} 
 
  208     const RealP tol = getDefaultTol<RealP>();
 
  209     SimTK_ERRCHK1(tol <= u && u <= 1-tol, 
"Geo::BicubicBezierPatch::splitU()",
 
  210         "Can't split patch at parameter u=%g; it is either out of range or" 
  211         " too close to an edge.", (
double)u);
 
  214         for (
int i=0; i<4; ++i) {
 
  220         for (
int i=0; i<4; ++i) {
 
  243     const RealP tol = getDefaultTol<RealP>();
 
  244     SimTK_ERRCHK1(tol <= w && w <= 1-tol, 
"Geo::BicubicBezierPatch::splitW()",
 
  245         "Can't split patch at parameter w=%g; it is either out of range or" 
  246         " too close to an edge.", (
double)w);
 
  249         for (
int i=0; i<4; ++i) {
 
  255         for (
int i=0; i<4; ++i) {
 
  282     const RealP tol = getDefaultTol<RealP>();
 
  283     SimTK_ERRCHK2((tol <= u && u <= 1-tol) && (tol <= w && w <= 1-tol), 
 
  284         "Geo::BicubicBezierPatch::split()",
 
  285         "Can't split patch at parametric point u,w=%g,%g; it is either out of" 
  286         " range or too close to an edge.", (
double)u, (
double)w);
 
  292     if (u == 
Real(0.5)) {
 
  294         patch0.
splitU(u, patch00, patch10); 
 
  295         patch1.
splitU(u, patch01, patch11); 
 
  298         patch0.
splitW(w, patch00, patch01); 
 
  299         patch1.
splitW(w, patch10, patch11); 
 
  347     return Fbu * B * ~Fbw;                              
 
  360     Pu = dFbu * B * ~Fbw;                                
 
  361     Pw = Fbu  * B * ~dFbw;                               
 
  376     Puu = d2Fbu * B * ~Fbw;                               
 
  377     Puw = dFbu  * B * ~dFbw;                              
 
  378     Pww = Fbu   * B * ~d2Fbw;                             
 
  395     Puuu = d3Fbu * B * ~Fbw;                              
 
  396     Puuw = d2Fbu * B * ~dFbw;                             
 
  397     Puww = dFbu  * B * ~d2Fbw;                            
 
  398     Pwww = Fbu   * B * ~d3Fbw;                            
 
  420     typedef const Vec3P& Coef;
 
  421     Coef b11=B(0,0), b12=B(0,1), b13=B(0,2), b14=B(0,3), 
 
  422          b21=B(1,0), b22=B(1,1), b23=B(1,2), b24=B(1,3), 
 
  423          b31=B(2,0), b32=B(2,1), b33=B(2,2), b34=B(2,3), 
 
  424          b41=B(3,0), b42=B(3,1), b43=B(3,2), b44=B(3,3); 
 
  430     Vec3P a= b41-b11+3*(b21-b31), b= b42-b12+3*(b22-b32),   
 
  431           c= b43-b13+3*(b23-b33), d= b44-b14+3*(b24-b34);
 
  432     Vec3P e= 3*(b11+b31)-6*b21,   f= 3*(b12+b32)-6*b22,     
 
  433           g= 3*(b13+b33)-6*b23,   h= 3*(b14+b34)-6*b24;
 
  434     Vec3P p= 3*(b21-b11),         q= 3*(b22-b12),           
 
  435           r= 3*(b23-b13),         s= 3*(b24-b14);
 
  439        ( d-a+3*(b-c),          3*(a+c)-6*b,       3*(b-a),        a,
 
  440          h-e+3*(f-g),          3*(e+g)-6*f,       3*(f-e),        e,
 
  441          s-p+3*(q-r),          3*(p+r)-6*q,       3*(q-p),        p,
 
  442          b14-b11+3*(b12-b13),  3*(b11+b13)-6*b12, 3*(b12-b11),   b11 );
 
  448     typedef const Vec3P& Coef;
 
  449     Coef a33=A(0,0), a32=A(0,1), a31=A(0,2), a30=A(0,3), 
 
  450          a23=A(1,0), a22=A(1,1), a21=A(1,2), a20=A(1,3), 
 
  451          a13=A(2,0), a12=A(2,1), a11=A(2,2), a10=A(2,3), 
 
  452          a03=A(3,0), a02=A(3,1), a01=A(3,2), a00=A(3,3); 
 
  458     Vec3P a=a13/3+a03, b=a12/3+a02, c=a11/3+a01, d=a10/3+a00;   
 
  459     Vec3P e=(a23+2*a13)/3+a03, f=(a22+2*a12)/3+a02,             
 
  460           g=(a21+2*a11)/3+a01, h=(a20+2*a10)/3+a00;
 
  461     Vec3P p=a33+a23+a13+a03, q=a32+a22+a12+a02,                 
 
  462           r=a31+a21+a11+a01, s=a30+a20+a10+a00;
 
  467        ( a00,   a01/3+a00,  (a02+2*a01)/3+a00,     a03+a02+a01+a00,
 
  468           d,      c/3+d,       (b+2*c)/3+d,             a+b+c+d,
 
  469           h,      g/3+h,       (f+2*g)/3+h,             e+f+g+h,
 
  470           s,      r/3+s,       (q+2*r) /3+s,            p+q+r+s     );
 
  476     typedef const Vec3P& Coef;
 
  477     Coef b11=B(0,0), b12=B(0,1), b13=B(0,2), b14=B(0,3), 
 
  478          b21=B(1,0), b22=B(1,1), b23=B(1,2), b24=B(1,3), 
 
  479          b31=B(2,0), b32=B(2,1), b33=B(2,2), b34=B(2,3), 
 
  480          b41=B(3,0), b42=B(3,1), b43=B(3,2), b44=B(3,3); 
 
  483     Vec3P b12mb11=b12-b11, b24mb14=b24-b14, b42mb41=b42-b41, b44mb34=b44-b34;
 
  487        (     b11,         b14,          3*b12mb11,           3*(b14-b13),
 
  488              b41,         b44,          3*b42mb41,           3*(b44-b43),
 
  489          3*(b21-b11),  3*b24mb14,  9*(b22-b21-b12mb11),  9*(b24mb14+b13-b23),
 
  490          3*(b41-b31),  3*b44mb34,  9*(b42mb41+b31-b32),  9*(b44mb34+b33-b43) );
 
  496     typedef const Vec3P& Coef;
 
  497     Coef h00=H(0,0), h01=H(0,1), w00=H(0,2), w01=H(0,3), 
 
  498          h10=H(1,0), h11=H(1,1), w10=H(1,2), w11=H(1,3), 
 
  499          u00=H(2,0), u01=H(2,1), t00=H(2,2), t01=H(2,3), 
 
  500          u10=H(3,0), u11=H(3,1), t10=H(3,2), t11=H(3,3); 
 
  503     Vec3P tmp00=h00+u00/3, tmp01=h01+u01/3, 
 
  504           tmp10=h10-u10/3, tmp11=h11-u11/3;
 
  508        (  h00,       h00+w00/3,          h01-w01/3,       h01,
 
  509          tmp00,  tmp00+w00/3+t00/9,  tmp01-w01/3-t01/9,  tmp01,
 
  510          tmp10,  tmp10+w10/3-t10/9,  tmp11-w11/3+t11/9,  tmp11,
 
  511           h10,       h10+w10/3,          h11-w11/3,       h11  );
 
#define SimTK_ERRCHK2(cond, whereChecked, fmt, a1, a2)
Definition: ExceptionMacros.h:328
 
#define SimTK_ERRCHK1(cond, whereChecked, fmt, a1)
Definition: ExceptionMacros.h:326
 
Defines geometric primitive shapes and algorthms.
 
Provides primitive operations for a single bicubic Bezier curve using either single or double precisi...
 
Includes internal headers providing declarations for the basic SimTK Core classes,...
 
This is the header file that every Simmath compilation unit should include first.
 
This Array_ helper class is the base class for ArrayView_ which is the base class for Array_; here we...
Definition: Array.h:324
 
A 3d box aligned with an unspecified frame F and centered at a given point measured from that frame's...
Definition: Geo_Box.h:457
 
A primitive useful for computations involving a single bicubic Bezier patch.
Definition: Geo_BicubicBezierPatch.h:101
 
static Mat< 4, 4, Vec3P > calcBFromH(const Mat< 4, 4, Vec3P > &H)
Given the vector Hermite coefficients H, return the equivalent Bezier control points B.
Definition: Geo_BicubicBezierPatch.h:495
 
const Mat< 4, 4, Vec3P > & getControlPoints() const
Return a reference to the Bezier control points B that are stored in this object.
Definition: Geo_BicubicBezierPatch.h:146
 
Mat< 4, 4, Vec3P > calcHermiteCoefficients() const
Calculate the Hermite coefficients H from the stored Bezier control points.
Definition: Geo_BicubicBezierPatch.h:158
 
CubicBezierCurve_< P > getBoundaryCurveU1() const
Return the u=1 boundary curve as a Bezier curve segment.
Definition: Geo_BicubicBezierPatch.h:168
 
static Vec3P evalPUsingB(const Mat< 4, 4, Vec3P > &B, RealP u, RealP w)
Given Bezier control points B and values for the curve parameters u and w in [0..1],...
Definition: Geo_BicubicBezierPatch.h:344
 
CubicBezierCurve_< P > getBoundaryCurveW0() const
Return the w=0 boundary curve as a Bezier curve segment.
Definition: Geo_BicubicBezierPatch.h:173
 
static void evalP3UsingB(const Mat< 4, 4, Vec3P > &B, RealP u, RealP w, Vec3P &Puuu, Vec3P &Puuw, Vec3P &Puww, Vec3P &Pwww)
Given Bezier control points B and values for the curve parameters u and w in [0..1],...
Definition: Geo_BicubicBezierPatch.h:385
 
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 th...
Definition: Geo_BicubicBezierPatch.h:132
 
Geo::AlignedBox_< P > calcAxisAlignedBoundingBox() const
Return an axis-aligned bounding box (AABB) that surrounds the entire patch segment in the 0<= u,...
Definition: Geo_BicubicBezierPatch.h:321
 
void splitU(RealP u, BicubicBezierPatch_< P > &patch0, BicubicBezierPatch_< P > &patch1) const
Split this patch into two along the u direction, along an isoparametric curve of constant u=t such th...
Definition: Geo_BicubicBezierPatch.h:206
 
BicubicBezierPatch_(const Mat< 4, 4, Vec3P > &controlPoints)
Construct a bicubic Bezier patch using the given control points B.
Definition: Geo_BicubicBezierPatch.h:113
 
void splitW(RealP w, BicubicBezierPatch_< P > &patch0, BicubicBezierPatch_< P > &patch1) const
Split this patch into two along the w direction, along an isoparametric curve of constant w=t such th...
Definition: Geo_BicubicBezierPatch.h:241
 
Mat< 4, 4, Vec3P > & updControlPoints()
Return a writable reference to the Bezier control points B that are stored in this object.
Definition: Geo_BicubicBezierPatch.h:150
 
void split(RealP u, RealP w, BicubicBezierPatch_< P > &patch00, BicubicBezierPatch_< P > &patch01, BicubicBezierPatch_< P > &patch10, BicubicBezierPatch_< P > &patch11) const
Split this patch into four subpatches at a particular parametric point (u,w) such that 0 < u,...
Definition: Geo_BicubicBezierPatch.h:278
 
static Mat< 4, 4, Vec3P > calcAFromB(const Mat< 4, 4, Vec3P > &B)
Given the Bezier control points B, return the equivalent vector algebraic coefficients A.
Definition: Geo_BicubicBezierPatch.h:419
 
CubicBezierCurve_< P > calcIsoCurveW(RealP w0) const
Given a particular value w0 for patch coordinate w, create a cubic Bezier curve segment P(u)=P(u,...
Definition: Geo_BicubicBezierPatch.h:189
 
Geo::Sphere_< P > calcBoundingSphere() const
Return a sphere that surrounds the entire patch in the 0<= u,w <=1 range.
Definition: Geo_BicubicBezierPatch.h:310
 
static void evalP2UsingB(const Mat< 4, 4, Vec3P > &B, RealP u, RealP w, Vec3P &Puu, Vec3P &Puw, Vec3P &Pww)
Given Bezier control points B and values for the curve parameters u and w in [0..1],...
Definition: Geo_BicubicBezierPatch.h:368
 
CubicBezierCurve_< P > getBoundaryCurveU0() const
Return the u=0 boundary curve as a Bezier curve segment.
Definition: Geo_BicubicBezierPatch.h:163
 
CubicBezierCurve_< P > getBoundaryCurveW1() const
Return the w=1 boundary curve as a Bezier curve segment.
Definition: Geo_BicubicBezierPatch.h:178
 
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,...
Definition: Geo_BicubicBezierPatch.h:125
 
static CubicBezierCurve_< P > calcIsoCurveW(const Mat< 4, 4, Vec3P > &B, RealP w0)
Given a particular value w0 for patch coordinate w, create a cubic Bezier curve segment P(u)=P(u,...
Definition: Geo_BicubicBezierPatch.h:413
 
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/d...
Definition: Geo_BicubicBezierPatch.h:139
 
BicubicBezierPatch_()
Construct an uninitialized patch; control points will be garbage.
Definition: Geo_BicubicBezierPatch.h:107
 
Geo::OrientedBox_< P > calcOrientedBoundingBox() const
Return an oriented bounding box (OBB) that surrounds the entire curve segment in the 0<= u,...
Definition: Geo_BicubicBezierPatch.h:332
 
Mat< 4, 4, Vec3P > calcAlgebraicCoefficients() const
Calculate the algebraic coefficients A from the stored Bezier control points.
Definition: Geo_BicubicBezierPatch.h:154
 
static void evalP1UsingB(const Mat< 4, 4, Vec3P > &B, RealP u, RealP w, Vec3P &Pu, Vec3P &Pw)
Given Bezier control points B and values for the curve parameters u and w in [0..1],...
Definition: Geo_BicubicBezierPatch.h:354
 
static Mat< 4, 4, Vec3P > calcHFromB(const Mat< 4, 4, Vec3P > &B)
Given the Bezier control points B, return the equivalent vector Hermite coefficients H.
Definition: Geo_BicubicBezierPatch.h:475
 
static Mat< 4, 4, Vec3P > calcBFromA(const Mat< 4, 4, Vec3P > &A)
Given the vector algebraic coefficients A, return the equivalent Bezier control points B.
Definition: Geo_BicubicBezierPatch.h:447
 
CubicBezierCurve_< P > calcIsoCurveU(RealP u0) const
Given a particular value u0 for patch coordinate u, create a cubic Bezier curve segment P(w)=P(u0,...
Definition: Geo_BicubicBezierPatch.h:184
 
static CubicBezierCurve_< P > calcIsoCurveU(const Mat< 4, 4, Vec3P > &B, RealP u0)
Given a particular value u0 for patch coordinate u, create a cubic Bezier curve segment P(w)=P(u0,...
Definition: Geo_BicubicBezierPatch.h:405
 
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,...
Definition: Geo_BicubicBezierPatch.h:120
 
This is a primitive useful for computations involving a single cubic Bezier curve segment.
Definition: Geo_CubicBezierCurve.h:137
 
static Row< 4, P > calcDFb(RealP u)
Calculate first derivatives dFb=[B0u..B3u] of the Bernstein basis functions for a given value of the ...
Definition: Geo_CubicBezierCurve.h:336
 
void bisect(CubicBezierCurve_< P > &left, CubicBezierCurve_< P > &right) const
Split this curve into two at the point u=1/2 (halfway in parameter space, not necessarily in arclengt...
Definition: Geo_CubicBezierCurve.h:283
 
void split(RealP u, CubicBezierCurve_< P > &left, CubicBezierCurve_< P > &right) const
Split this curve into two at a point u=t such that 0 < t < 1, such that the first curve coincides wit...
Definition: Geo_CubicBezierCurve.h:259
 
static Row< 4, P > calcD2Fb(RealP u)
Calculate second derivatives d2Fb=[B0uu..B3uu] of the Bernstein basis functions for a given value of ...
Definition: Geo_CubicBezierCurve.h:343
 
static Row< 4, P > calcFb(RealP u)
Calculate the Bernstein basis functions Fb=[B0..B3] for a given value of the parameter u.
Definition: Geo_CubicBezierCurve.h:328
 
static Row< 4, P > calcD3Fb(RealP u)
Calculate third derivatives d3Fb=[B0uuu..B3uuu] of the Bernstein basis functions for a given value of...
Definition: Geo_CubicBezierCurve.h:351
 
const Vec< 4, Vec3P > & getControlPoints() const
Return a reference to the Bezier control points B=[b0 b1 b2 b3] that are stored in this object.
Definition: Geo_CubicBezierCurve.h:162
 
TODO: A 3d box oriented and positioned with respect to an unspecified frame F.
Definition: Geo_Box.h:528
 
static Sphere_< P > calcBoundingSphere(const Vec3P &p)
Create a tiny bounding sphere around a single point.
Definition: Geo_Point.h:333
 
static Geo::OrientedBox_< P > calcOrientedBoundingBox(const Array_< Vec3P > &points, Array_< int > &support, bool optimize=true)
Calculate a tight-fitting oriented bounding box (OBB) that includes all n given points.
 
static Geo::AlignedBox_< P > calcAxisAlignedBoundingBox(const Array_< Vec3P > &points, Array_< int > &support)
Calculate the smallest axis-aligned bounding box including all n given points.
 
A geometric primitive representing a sphere by its radius and center point, and a collection of spher...
Definition: Geo_Sphere.h:47
 
This class represents a small matrix whose size is known at compile time, containing elements of any ...
Definition: Mat.h:97
 
This is a fixed-length row vector designed for no-overhead inline computation.
Definition: Row.h:132
 
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
 
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:607