本文整理汇总了C++中ON_Xform::Zero方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_Xform::Zero方法的具体用法?C++ ON_Xform::Zero怎么用?C++ ON_Xform::Zero使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_Xform
的用法示例。
在下文中一共展示了ON_Xform::Zero方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetRotation
bool ON_Quaternion::GetRotation(ON_Xform& xform) const
{
bool rc;
ON_Quaternion q(*this);
if ( q.Unitize() )
{
if ( fabs(q.a-a) <= ON_ZERO_TOLERANCE
&& fabs(q.b-b) <= ON_ZERO_TOLERANCE
&& fabs(q.c-c) <= ON_ZERO_TOLERANCE
&& fabs(q.d-d) <= ON_ZERO_TOLERANCE
)
{
// "this" was already unitized - don't tweak bits
q = *this;
}
xform[1][0] = 2.0*(q.b*q.c + q.a*q.d);
xform[2][0] = 2.0*(q.b*q.d - q.a*q.c);
xform[3][0] = 0.0;
xform[0][1] = 2.0*(q.b*q.c - q.a*q.d);
xform[2][1] = 2.0*(q.c*q.d + q.a*q.b);
xform[3][1] = 0.0;
xform[0][2] = 2.0*(q.b*q.d + q.a*q.c);
xform[1][2] = 2.0*(q.c*q.d - q.a*q.b);
xform[3][2] = 0.0;
q.b = q.b*q.b;
q.c = q.c*q.c;
q.d = q.d*q.d;
xform[0][0] = 1.0 - 2.0*(q.c + q.d);
xform[1][1] = 1.0 - 2.0*(q.b + q.d);
xform[2][2] = 1.0 - 2.0*(q.b + q.c);
xform[0][3] = xform[1][3] = xform[2][3] = 0.0;
xform[3][3] = 1.0;
rc = true;
}
else if ( IsZero() )
{
xform.Zero();
rc = false;
}
else
{
// something is seriously wrong
ON_ERROR("ON_Quaternion::GetRotation(ON_Xform) quaternion is invalid");
xform.Identity();
rc = false;
}
return rc;
}
示例2: GetRotation
bool ON_Quaternion::GetRotation(ON_Xform& xform) const
{
ON_Plane plane;
bool rc = GetRotation(plane);
if (rc)
xform.Rotation(ON_Plane::World_xy,plane);
else if (IsZero())
xform.Zero();
else
xform.Identity();
return rc;
}