本文整理汇总了C++中LTRotation::ConvertFromMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ LTRotation::ConvertFromMatrix方法的具体用法?C++ LTRotation::ConvertFromMatrix怎么用?C++ LTRotation::ConvertFromMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LTRotation
的用法示例。
在下文中一共展示了LTRotation::ConvertFromMatrix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ApplyCapsuleBuoyancy
//given a capsule specified with a transform, two points, and a radius, this will approximate how much is submerged
//and distribute that force to the appropriate points on the capsule
static bool ApplyCapsuleBuoyancy(const LTVector& vPt1, const LTVector& vPt2, float fLength, float fRadius,
const LTPlane& WSPlane, float& fVolume, LTVector& vApplyAt,
float& fSurfaceArea)
{
//convert the capsule to an OBB and apply it
//determine information about the main axis
LTVector vMainAxis = vPt2 - vPt1;
LTASSERT( fLength > 0.0f, "Invalid capsule length." );
LTVector vUnitAxis = vMainAxis / fLength;
//we can now build up a rotation given the plane normal and the axis to build our transform
LTVector vUp = WSPlane.Normal();
if(fabsf(vUp.Dot(vUnitAxis)) > 0.99f)
{
//too close to use, built an arbitrary orthonormal
vUp = vUnitAxis.BuildOrthonormal();
}
LTMatrix3x4 mTemp;
LTVector vRight = vUnitAxis.Cross(vUp);
vRight.Normalize( );
LTVector vTrueUp = vRight.Cross( vUnitAxis );
mTemp.SetBasisVectors(vRight, vTrueUp, vUnitAxis);
LTRotation rRot;
rRot.ConvertFromMatrix(mTemp);
//now we can form our transform
LTRigidTransform tTransform((vPt1 + vPt2) * 0.5f, rRot);
LTVector vHalfDims(fRadius, fRadius, fLength * 0.5f + fRadius);
return ApplyOBBBuoyancy(tTransform, vHalfDims, WSPlane, fVolume, vApplyAt, fSurfaceArea);
}