1 #ifndef SimTK_SIMMATH_GEO_CUBIC_HERMITE_CURVE_H_ 2 #define SimTK_SIMMATH_GEO_CUBIC_HERMITE_CURVE_H_ 131 class Geo::CubicHermiteCurve_ {
133 typedef Vec<3,RealP> Vec3P;
173 const RealP u2 = u*u;
180 const RealP u2 = u*u, u3 = u*u2;
181 const RealP t = 3*u2 - 2*u3;
182 return Row<4,P>(1-t, t, u3-2*u2+u, u3-u2);
188 const RealP u2 = u*u, u23=3*u2;
189 const RealP dt = 6*(u-u2);
190 return Row<4,P>(-dt, dt, u23-4*u+1, u23-2*u);
196 const RealP u6 = 6*u;
197 const RealP ddt = 6 - 12*u;
198 return Row<4,P>(-ddt, ddt, u6-4, u6-2);
214 const Vec3P h01 = h0 - h1;
216 -3*h01 - 2*hu0 - hu1,
233 const RealP u2 = u*u, u3 = u*u2;
234 return u3*A[0] + u2*A[1] + u*A[2] + A[3];
239 return (3*u*u)*A[0] + (2*u)*A[1] + A[2];
244 return (6*u)*A[0] + 2*A[1];
301 const RealP v0=v[0], v1=v[1], v2=v[2], v3=v[3];
302 const RealP v01 = v0-v1;
303 return Vec<4,P>(2*v01+v2+v3, -3*v01-2*v2-v3, v2, v0);
321 const RealP v0=v[0], v1=v[1], v2=v[2], v3=v[3];
322 return Vec<4,P>(v3, v0+v1+v2+v3, v2, 3*v0+2*v1+v2);
334 #endif // SimTK_SIMMATH_GEO_CUBIC_HERMITE_CURVE_H_ static Mat< 4, 4, P > getMhInv()
Obtain the inverse inv(Mh) of the Hermite basis matrix explicitly.
Definition: Geo_CubicHermiteCurve.h:310
static Vec3P evalPUsingH(const Vec< 4, Vec3P > &H, RealP u)
Given Hermite coefficients H and a value for the curve parameter u, return the point P(u) at that loc...
Definition: Geo_CubicHermiteCurve.h:259
static Row< 4, P > calcFhuuu(RealP u)
Calculate third derivatives Fhuuu=[F1uuu..F4uuu] of the Hermite basis functions for a given value of ...
Definition: Geo_CubicHermiteCurve.h:204
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
Vec< 4, Vec3P > calcGeometricCoefficients() const
Calculate the Hermite coefficients H=[h0 h1 hu0 hu1] from the stored algebraic coefficients.
Definition: Geo_CubicHermiteCurve.h:149
static Vec3P evalPuUsingH(const Vec< 4, Vec3P > &H, RealP u)
Given Hermite coefficients H and a value for the curve parameter u, return the first derivative Pu(u)...
Definition: Geo_CubicHermiteCurve.h:267
static Vec3P evalPUsingA(const Vec< 4, Vec3P > &A, RealP u)
Given algebraic coefficients A and a value for the curve parameter u, return the point P(u) at that l...
Definition: Geo_CubicHermiteCurve.h:232
Vec3P evalPuuu(RealP u) const
Evaluate the third derivative Puuu=d3P/du3 on this curve.
Definition: Geo_CubicHermiteCurve.h:165
static Mat< 4, 4, P > getMh()
Obtain the Hermite basis matrix Mh explicitly.
Definition: Geo_CubicHermiteCurve.h:291
Vec3P evalPuu(RealP u) const
Evaluate the second derivative Puu=d2P/du2 on this curve given a value for parameter u in [0...
Definition: Geo_CubicHermiteCurve.h:161
Vec3P evalP(RealP u) const
Evaluate a point P(u) on this curve given a value for parameter u in [0,1].
Definition: Geo_CubicHermiteCurve.h:153
static Vec3P evalPuUsingA(const Vec< 4, Vec3P > &A, RealP u)
Given algebraic coefficients A and a value for the curve parameter u, return the first derivative Pu(...
Definition: Geo_CubicHermiteCurve.h:238
static Row< 4, P > calcFh(RealP u)
Calculate the Hermite basis functions Fh=[F1..F4] for a given value of the parameter u...
Definition: Geo_CubicHermiteCurve.h:179
const Vec< 4, Vec3P > & getAlgebraicCoefficients() const
Return a reference to the algebraic coefficients A=[a3 a2 a1 a0] that are stored in this object...
Definition: Geo_CubicHermiteCurve.h:145
static Vec3P evalPuuUsingA(const Vec< 4, Vec3P > &A, RealP u)
Given algebraic coefficients A and a value for the curve parameter u, return the second derivative Pu...
Definition: Geo_CubicHermiteCurve.h:243
This is a fixed-length column vector designed for no-overhead inline computation. ...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:618
CubicHermiteCurve_(const Vec< 4, Vec3P > &A)
Construct a cubic Hermite curve using the given algebraic coefficients A=[a3 a2 a1 a0]...
Definition: Geo_CubicHermiteCurve.h:142
Includes internal headers providing declarations for the basic SimTK Core classes, including Simmatrix.
static Vec< 4, P > multiplyByMh(const Vec< 4, P > &v)
Form the product of the Hermite basis matrix Mh and a 4-vector, exploiting the structure of Mh (which...
Definition: Geo_CubicHermiteCurve.h:300
static Vec< 4, P > multiplyByMhInv(const Vec< 4, P > &v)
Form the product of the inverse Hermite basis matrix inv(Mh) and a 4-vector, exploiting the structure...
Definition: Geo_CubicHermiteCurve.h:320
static Row< 4, P > calcFhuu(RealP u)
Calculate second derivatives Fhuu=[F1uu..F4uu] of the Hermite basis functions for a given value of th...
Definition: Geo_CubicHermiteCurve.h:195
CubicHermiteCurve_()
Construct an uninitialized curve; coefficients will be garbage.
Definition: Geo_CubicHermiteCurve.h:137
static Vec3P evalPuuuUsingA(const Vec< 4, Vec3P > &A, RealP u)
Given algebraic coefficients A and a value for the curve parameter u, return the third derivative Puu...
Definition: Geo_CubicHermiteCurve.h:250
Defines geometric primitive shapes and algorthms.
static Row< 4, P > calcU(RealP u)
Return the row vector U=[u^3 u^2 u 1].
Definition: Geo_CubicHermiteCurve.h:172
static Vec3P evalPuuUsingH(const Vec< 4, Vec3P > &H, RealP u)
Given Hermite coefficients H and a value for the curve parameter u, return the second derivative Puu(...
Definition: Geo_CubicHermiteCurve.h:275
static Row< 4, P > calcFhu(RealP u)
Calculate first derivatives Fhu=[F1u..F4u] of the Hermite basis functions for a given value of the pa...
Definition: Geo_CubicHermiteCurve.h:187
This is the header file that every Simmath compilation unit should include first. ...
This is a fixed-length row vector designed for no-overhead inline computation.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:619
static Vec< 4, Vec3P > calcAFromH(const Vec< 4, Vec3P > &H)
Given the Hermite coefficients H=~[h0 h1 hu0 hu1], return the algebraic coefficients A=~[a3 a2 a1 a0]...
Definition: Geo_CubicHermiteCurve.h:211
static Vec< 4, Vec3P > calcHFromA(const Vec< 4, Vec3P > &A)
Given the algebraic coefficients A=~[a3 a2 a1 a0], return the Hermite coefficients H=~[h0 h1 hu0 hu1]...
Definition: Geo_CubicHermiteCurve.h:224
This class represents a small matrix whose size is known at compile time, containing elements of any ...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:620
static Vec3P evalPuuuUsingH(const Vec< 4, Vec3P > &H, RealP u)
Given Hermite coefficients H and a value for the curve parameter u, return the third derivative Puuu(...
Definition: Geo_CubicHermiteCurve.h:283
Vec3P evalPu(RealP u) const
Evaluate the tangent Pu=dP/du on this curve given a value for parameter u in [0,1].
Definition: Geo_CubicHermiteCurve.h:157