本文整理汇总了C#中Matrix4x4.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix4x4.Equals方法的具体用法?C# Matrix4x4.Equals怎么用?C# Matrix4x4.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4x4
的用法示例。
在下文中一共展示了Matrix4x4.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
// Update is called once per frame
void Update()
{
// We use the transformation matrix of the Background class
Matrix4x4 mat = new Matrix4x4();
for (int i = 0; i < 16; ++i)
mat[i] = (float)Background.transMat[i];
// We move the object only if the transformation matrix is different
// from a matrix with all elements equal to zero .
if (!mat.Equals(Matrix4x4.zero))
TransformFromMatrix(mat, this.transform);
}
示例2: Test_Equals
public void Test_Equals()
{
var a = new Matrix4x4 (1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16);
var delt = 0.00001f;
var b = new Matrix4x4 (1 + delt, 2 + delt, 3 + delt, 4 + delt,
5 + delt, 6 + delt, 7 + delt, 8 + delt,
9 - delt, 10 - delt, 11 - delt, 12 - delt,
13 - delt, 14 - delt, 15 - delt, 16 - delt);
Assert.IsTrue (a.Equals (b)); // 誤差を許容する
Assert.IsFalse (a == b); // 厳密な比較
Assert.IsFalse (a.GetHashCode () == b.GetHashCode ()); // 厳密な比較に基づくハッシュ値
}
示例3: TestEquals
public void TestEquals()
{
Matrix4x4 m1 = new Matrix4x4(1.0f, 2.0f, 3.0f, 5.0f, 0.0f, -5.0f, .5f, 100.25f, .3f, .35f, .025f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f);
Matrix4x4 m2 = new Matrix4x4(1.0f, 2.0f, 3.0f, 5.0f, 0.0f, -5.0f, .5f, 100.25f, .3f, .35f, .025f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f);
Matrix4x4 m3 = new Matrix4x4(0.0f, 2.0f, 25.0f, 5.0f, 1.0f, 5.0f, 5.5f, 100.25f, 1.25f, 8.5f, 2.25f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f);
//Test IEquatable Equals
Assert.IsTrue(m1.Equals(m2), "Test IEquatable equals");
Assert.IsFalse(m1.Equals(m3), "Test IEquatable equals");
//Test object equals override
Assert.IsTrue(m1.Equals((object) m2), "Tests object equals");
Assert.IsFalse(m1.Equals((object) m3), "Tests object equals");
//Test op equals
Assert.IsTrue(m1 == m2, "Testing OpEquals");
Assert.IsFalse(m1 == m3, "Testing OpEquals");
//Test op not equals
Assert.IsTrue(m1 != m3, "Testing OpNotEquals");
Assert.IsFalse(m1 != m2, "Testing OpNotEquals");
}
示例4: Matrix4x4EqualsNanTest
public void Matrix4x4EqualsNanTest()
{
Matrix4x4 a = new Matrix4x4(float.NaN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
Matrix4x4 b = new Matrix4x4(0, float.NaN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
Matrix4x4 c = new Matrix4x4(0, 0, float.NaN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
Matrix4x4 d = new Matrix4x4(0, 0, 0, float.NaN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
Matrix4x4 e = new Matrix4x4(0, 0, 0, 0, float.NaN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
Matrix4x4 f = new Matrix4x4(0, 0, 0, 0, 0, float.NaN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
Matrix4x4 g = new Matrix4x4(0, 0, 0, 0, 0, 0, float.NaN, 0, 0, 0, 0, 0, 0, 0, 0, 0);
Matrix4x4 h = new Matrix4x4(0, 0, 0, 0, 0, 0, 0, float.NaN, 0, 0, 0, 0, 0, 0, 0, 0);
Matrix4x4 i = new Matrix4x4(0, 0, 0, 0, 0, 0, 0, 0, float.NaN, 0, 0, 0, 0, 0, 0, 0);
Matrix4x4 j = new Matrix4x4(0, 0, 0, 0, 0, 0, 0, 0, 0, float.NaN, 0, 0, 0, 0, 0, 0);
Matrix4x4 k = new Matrix4x4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, float.NaN, 0, 0, 0, 0, 0);
Matrix4x4 l = new Matrix4x4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, float.NaN, 0, 0, 0, 0);
Matrix4x4 m = new Matrix4x4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, float.NaN, 0, 0, 0);
Matrix4x4 n = new Matrix4x4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, float.NaN, 0, 0);
Matrix4x4 o = new Matrix4x4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, float.NaN, 0);
Matrix4x4 p = new Matrix4x4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, float.NaN);
Assert.False(a == new Matrix4x4());
Assert.False(b == new Matrix4x4());
Assert.False(c == new Matrix4x4());
Assert.False(d == new Matrix4x4());
Assert.False(e == new Matrix4x4());
Assert.False(f == new Matrix4x4());
Assert.False(g == new Matrix4x4());
Assert.False(h == new Matrix4x4());
Assert.False(i == new Matrix4x4());
Assert.False(j == new Matrix4x4());
Assert.False(k == new Matrix4x4());
Assert.False(l == new Matrix4x4());
Assert.False(m == new Matrix4x4());
Assert.False(n == new Matrix4x4());
Assert.False(o == new Matrix4x4());
Assert.False(p == new Matrix4x4());
Assert.True(a != new Matrix4x4());
Assert.True(b != new Matrix4x4());
Assert.True(c != new Matrix4x4());
Assert.True(d != new Matrix4x4());
Assert.True(e != new Matrix4x4());
Assert.True(f != new Matrix4x4());
Assert.True(g != new Matrix4x4());
Assert.True(h != new Matrix4x4());
Assert.True(i != new Matrix4x4());
Assert.True(j != new Matrix4x4());
Assert.True(k != new Matrix4x4());
Assert.True(l != new Matrix4x4());
Assert.True(m != new Matrix4x4());
Assert.True(n != new Matrix4x4());
Assert.True(o != new Matrix4x4());
Assert.True(p != new Matrix4x4());
Assert.False(a.Equals(new Matrix4x4()));
Assert.False(b.Equals(new Matrix4x4()));
Assert.False(c.Equals(new Matrix4x4()));
Assert.False(d.Equals(new Matrix4x4()));
Assert.False(e.Equals(new Matrix4x4()));
Assert.False(f.Equals(new Matrix4x4()));
Assert.False(g.Equals(new Matrix4x4()));
Assert.False(h.Equals(new Matrix4x4()));
Assert.False(i.Equals(new Matrix4x4()));
Assert.False(j.Equals(new Matrix4x4()));
Assert.False(k.Equals(new Matrix4x4()));
Assert.False(l.Equals(new Matrix4x4()));
Assert.False(m.Equals(new Matrix4x4()));
Assert.False(n.Equals(new Matrix4x4()));
Assert.False(o.Equals(new Matrix4x4()));
Assert.False(p.Equals(new Matrix4x4()));
Assert.False(a.IsIdentity);
Assert.False(b.IsIdentity);
Assert.False(c.IsIdentity);
Assert.False(d.IsIdentity);
Assert.False(e.IsIdentity);
Assert.False(f.IsIdentity);
Assert.False(g.IsIdentity);
Assert.False(h.IsIdentity);
Assert.False(i.IsIdentity);
Assert.False(j.IsIdentity);
Assert.False(k.IsIdentity);
Assert.False(l.IsIdentity);
Assert.False(m.IsIdentity);
Assert.False(n.IsIdentity);
Assert.False(o.IsIdentity);
Assert.False(p.IsIdentity);
// Counterintuitive result - IEEE rules for NaN comparison are weird!
Assert.False(a.Equals(a));
Assert.False(b.Equals(b));
Assert.False(c.Equals(c));
Assert.False(d.Equals(d));
Assert.False(e.Equals(e));
Assert.False(f.Equals(f));
Assert.False(g.Equals(g));
Assert.False(h.Equals(h));
Assert.False(i.Equals(i));
Assert.False(j.Equals(j));
Assert.False(k.Equals(k));
Assert.False(l.Equals(l));
//.........这里部分代码省略.........