本文整理汇总了C++中Polynomial::GetDegree方法的典型用法代码示例。如果您正苦于以下问题:C++ Polynomial::GetDegree方法的具体用法?C++ Polynomial::GetDegree怎么用?C++ Polynomial::GetDegree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polynomial
的用法示例。
在下文中一共展示了Polynomial::GetDegree方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: kXPoly
//----------------------------------------------------------------------------
Real NaturalSpline3::GetVariationKey (int iKey, Real fT0, Real fT1,
const Vector3& rkA, const Vector3& rkB) const
{
Polynomial kXPoly(3);
kXPoly[0] = m_akA[iKey].x;
kXPoly[1] = m_akB[iKey].x;
kXPoly[2] = m_akC[iKey].x;
kXPoly[3] = m_akD[iKey].x;
Polynomial kYPoly(3);
kYPoly[0] = m_akA[iKey].y;
kYPoly[1] = m_akB[iKey].y;
kYPoly[2] = m_akC[iKey].y;
kYPoly[3] = m_akD[iKey].y;
Polynomial kZPoly(3);
kZPoly[0] = m_akA[iKey].z;
kZPoly[1] = m_akB[iKey].z;
kZPoly[2] = m_akC[iKey].z;
kZPoly[3] = m_akD[iKey].z;
// construct line segment A + t*B
Polynomial kLx(1), kLy(1), kLz(1);
kLx[0] = rkA.x;
kLx[1] = rkB.x;
kLy[0] = rkA.y;
kLy[1] = rkB.y;
kLz[0] = rkA.z;
kLz[1] = rkB.z;
// compute |X(t) - L(t)|^2
Polynomial kDx = kXPoly - kLx;
Polynomial kDy = kYPoly - kLy;
Polynomial kDz = kZPoly - kLz;
Polynomial kNormSqr = kDx*kDx + kDy*kDy + kDz*kDz;
// compute indefinite integral of |X(t)-L(t)|^2
Polynomial kIntegral(kNormSqr.GetDegree()+1);
kIntegral[0] = 0.0f;
for (int i = 1; i <= kIntegral.GetDegree(); i++)
kIntegral[i] = kNormSqr[i-1]/i;
// compute definite Integral(t0,t1,|X(t)-L(t)|^2)
Real fResult = kIntegral(fT1) - kIntegral(fT0);
return fResult;
}
示例2: kLx
//----------------------------------------------------------------------------
Real PolynomialCurve3::GetVariation (Real fT0, Real fT1,
const Vector3* pkP0, const Vector3* pkP1) const
{
Vector3 kP0, kP1;
if ( !pkP0 )
{
kP0 = GetPosition(fT0);
pkP0 = &kP0;
}
if ( !pkP1 )
{
kP1 = GetPosition(fT1);
pkP1 = &kP1;
}
// construct line segment A + t*B
Real fInvDT = 1.0f/(fT1 - fT0);
Vector3 kB = fInvDT*(*pkP1 - *pkP0);
Vector3 kA = *pkP0 - fT0*kB;
Polynomial kLx(1), kLy(1), kLz(1);
kLx[0] = kA.x;
kLx[1] = kB.x;
kLy[0] = kA.y;
kLy[1] = kB.y;
kLz[0] = kA.z;
kLz[1] = kB.z;
// compute |X(t) - L(t)|^2
Polynomial kDx = *m_pkXPoly - kLx;
Polynomial kDy = *m_pkYPoly - kLy;
Polynomial kDz = *m_pkZPoly - kLz;
Polynomial kNormSqr = kDx*kDx + kDy*kDy + kDz*kDz;
// compute indefinite integral of |X(t)-L(t)|^2
Polynomial kIntegral(kNormSqr.GetDegree()+1);
kIntegral[0] = 0.0f;
for (int i = 1; i <= kIntegral.GetDegree(); i++)
kIntegral[i] = kNormSqr[i-1]/i;
// return definite Integral(t0,t1,|X(t)-L(t)|^2)
Real fResult = kIntegral(fT1) - kIntegral(fT0);
return fResult;
}