本文整理汇总了C#中Matrix3x3.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix3x3.Equals方法的具体用法?C# Matrix3x3.Equals怎么用?C# Matrix3x3.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix3x3
的用法示例。
在下文中一共展示了Matrix3x3.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEquals
public void TestEquals()
{
Matrix3x3 m1 = new Matrix3x3(1.0f, 2.0f, 3.0f, 0.0f, -5.0f, .5f, .3f, .35f, .025f);
Matrix3x3 m2 = new Matrix3x3(1.0f, 2.0f, 3.0f, 0.0f, -5.0f, .5f, .3f, .35f, .025f);
Matrix3x3 m3 = new Matrix3x3(0.0f, 2.0f, 25.0f, 1.0f, 5.0f, 5.5f, 1.25f, 8.5f, 2.25f);
//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");
}
示例2: Test_Equals
public void Test_Equals()
{
var delta = 0.00001f;
var a = new Matrix3x3 (1, 1, 1,
1, 1, 1,
1, 1, 1);
var b = new Matrix3x3 (1 + delta, 1 + delta, 1 + delta,
1 + delta, 1 + delta, 1 + delta,
1 + delta, 1 + delta, 1 + delta);
Assert.IsTrue (a.Equals (b)); // 誤差許容
Assert.IsFalse (a == b); // 厳密な比較
Assert.IsFalse (a.GetHashCode () == b.GetHashCode ()); // 厳密な比較に基づくハッシュ値
}