本文整理汇总了C++中idMat3::FixDegeneracies方法的典型用法代码示例。如果您正苦于以下问题:C++ idMat3::FixDegeneracies方法的具体用法?C++ idMat3::FixDegeneracies怎么用?C++ idMat3::FixDegeneracies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idMat3
的用法示例。
在下文中一共展示了idMat3::FixDegeneracies方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClipPush
/*
============
idPush::ClipPush
Try to push other entities by moving the given entity.
============
*/
float idPush::ClipPush( trace_t &results, idEntity *pusher, const int flags,
const idVec3 &oldOrigin, const idMat3 &oldAxis,
idVec3 &newOrigin, idMat3 &newAxis ) {
idVec3 translation;
idRotation rotation;
float mass;
mass = 0.0f;
results.fraction = 1.0f;
results.endpos = newOrigin;
results.endAxis = newAxis;
memset( &results.c, 0, sizeof( results.c ) );
// translational push
translation = newOrigin - oldOrigin;
// if the pusher translates
if ( translation != vec3_origin ) {
mass += ClipTranslationalPush( results, pusher, flags, newOrigin, translation );
if ( results.fraction < 1.0f ) {
newOrigin = oldOrigin;
newAxis = oldAxis;
return mass;
}
} else {
newOrigin = oldOrigin;
}
// rotational push
rotation = ( oldAxis.Transpose() * newAxis ).ToRotation();
rotation.SetOrigin( newOrigin );
rotation.Normalize180();
rotation.ReCalculateMatrix(); // recalculate the rotation matrix to avoid accumulating rounding errors
// if the pusher rotates
if ( rotation.GetAngle() != 0.0f ) {
// recalculate new axis to avoid floating point rounding problems
newAxis = oldAxis * rotation.ToMat3();
newAxis.OrthoNormalizeSelf();
newAxis.FixDenormals();
newAxis.FixDegeneracies();
pusher->GetPhysics()->GetClipModel()->SetPosition( newOrigin, oldAxis );
mass += ClipRotationalPush( results, pusher, flags, newAxis, rotation );
if ( results.fraction < 1.0f ) {
newOrigin = oldOrigin;
newAxis = oldAxis;
return mass;
}
} else {
newAxis = oldAxis;
}
return mass;
}