本文整理汇总了C#中Matrix4x4.Determinant方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix4x4.Determinant方法的具体用法?C# Matrix4x4.Determinant怎么用?C# Matrix4x4.Determinant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4x4
的用法示例。
在下文中一共展示了Matrix4x4.Determinant方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateUi
private void UpdateUi(Matrix4x4 mat, bool diffAgainstBaseMatrix)
{
// use assimp math data structures because they have Decompose()
// the decomposition algorithm is not very sophisticated - it basically extracts translation
// and row scaling factors and then converts the rest to a quaternion.
// question: what if the matrix is non-invertible? the algorithm then yields
// at least one scaling factor as zero, further results are undefined. We
// therefore catch this case by checking the determinant and inform the user
// that the results may be wrong.
checkBoxNonStandard.Checked = Math.Abs(mat.Determinant()) < 1e-5;
Vector3D scale;
Quaternion rot;
Vector3D trans;
mat.Decompose(out scale, out rot, out trans);
// translation
textBoxTransX.Text = trans.X.ToString(Format);
textBoxTransY.Text = trans.Y.ToString(Format);
textBoxTransZ.Text = trans.Z.ToString(Format);
// scaling - simpler view mode for uniform scalings
var isUniform = Math.Abs(scale.X - scale.Y) < 1e-5 && Math.Abs(scale.X - scale.Z) < 1e-5;
textBoxScaleX.Text = scale.X.ToString(Format);
textBoxScaleY.Text = scale.Y.ToString(Format);
textBoxScaleZ.Text = scale.Z.ToString(Format);
textBoxScaleY.Visible = !isUniform;
textBoxScaleZ.Visible = !isUniform;
labelScalingX.Visible = !isUniform;
labelScalingY.Visible = !isUniform;
labelScalingZ.Visible = !isUniform;
if (diffAgainstBaseMatrix)
{
const double epsilon = 1e-5f;
if (Math.Abs(scale.X-_scale.X) > epsilon)
{
labelScalingX.ForeColor = ColorIsAnimated;
textBoxScaleX.ForeColor = ColorIsAnimated;
}
if (Math.Abs(scale.Y - _scale.Y) > epsilon)
{
labelScalingY.ForeColor = ColorIsAnimated;
textBoxScaleY.ForeColor = ColorIsAnimated;
}
if (Math.Abs(scale.Z - _scale.Z) > epsilon)
{
labelScalingZ.ForeColor = ColorIsAnimated;
textBoxScaleZ.ForeColor = ColorIsAnimated;
}
if (Math.Abs(trans.X - _trans.X) > epsilon)
{
labelTranslationX.ForeColor = ColorIsAnimated;
textBoxTransX.ForeColor = ColorIsAnimated;
}
if (Math.Abs(trans.Y - _trans.Y) > epsilon)
{
labelTranslationY.ForeColor = ColorIsAnimated;
textBoxTransY.ForeColor = ColorIsAnimated;
}
if (Math.Abs(trans.Z - _trans.Z) > epsilon)
{
labelTranslationZ.ForeColor = ColorIsAnimated;
textBoxTransZ.ForeColor = ColorIsAnimated;
}
}
else
{
labelScalingX.ForeColor = ColorNotAnimated;
textBoxScaleX.ForeColor = ColorNotAnimated;
labelScalingY.ForeColor = ColorNotAnimated;
textBoxScaleY.ForeColor = ColorNotAnimated;
labelScalingZ.ForeColor = ColorNotAnimated;
textBoxScaleZ.ForeColor = ColorNotAnimated;
labelTranslationX.ForeColor = ColorNotAnimated;
textBoxTransX.ForeColor = ColorNotAnimated;
labelTranslationY.ForeColor = ColorNotAnimated;
textBoxTransY.ForeColor = ColorNotAnimated;
labelTranslationZ.ForeColor = ColorNotAnimated;
textBoxTransZ.ForeColor = ColorNotAnimated;
_scale = scale;
_trans = trans;
_rot = rot;
}
// rotation - more complicated because the display mode can be changed
//.........这里部分代码省略.........