本文整理汇总了C#中Vector4.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Vector4.Equals方法的具体用法?C# Vector4.Equals怎么用?C# Vector4.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector4
的用法示例。
在下文中一共展示了Vector4.Equals方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Vector4EqualsTest1
public void Vector4EqualsTest1()
{
Vector4 a = new Vector4(1.0f, 2.0f, 3.0f, 4.0f);
Vector4 b = new Vector4(1.0f, 2.0f, 3.0f, 4.0f);
// case 1: compare between same values
bool expected = true;
bool actual = a.Equals(b);
Assert.AreEqual(expected, actual, "Vector4.Equals did not return the expected value.");
// case 2: compare between different values
b.X = 10.0f;
expected = false;
actual = a.Equals(b);
Assert.AreEqual(expected, actual, "Vector4.Equals did not return the expected value.");
}
示例2: Vector4EqualsNanTest
public void Vector4EqualsNanTest()
{
Vector4 a = new Vector4(float.NaN, 0, 0, 0);
Vector4 b = new Vector4(0, float.NaN, 0, 0);
Vector4 c = new Vector4(0, 0, float.NaN, 0);
Vector4 d = new Vector4(0, 0, 0, float.NaN);
Assert.IsFalse(a == Vector4.Zero);
Assert.IsFalse(b == Vector4.Zero);
Assert.IsFalse(c == Vector4.Zero);
Assert.IsFalse(d == Vector4.Zero);
Assert.IsTrue(a != Vector4.Zero);
Assert.IsTrue(b != Vector4.Zero);
Assert.IsTrue(c != Vector4.Zero);
Assert.IsTrue(d != Vector4.Zero);
Assert.IsFalse(a.Equals(Vector4.Zero));
Assert.IsFalse(b.Equals(Vector4.Zero));
Assert.IsFalse(c.Equals(Vector4.Zero));
Assert.IsFalse(d.Equals(Vector4.Zero));
// Counterintuitive result - IEEE rules for NaN comparison are weird!
Assert.IsFalse(a.Equals(a));
Assert.IsFalse(b.Equals(b));
Assert.IsFalse(c.Equals(c));
Assert.IsFalse(d.Equals(d));
}
示例3: Vector4EqualsTest1
public void Vector4EqualsTest1()
{
Vector4 a = new Vector4(1.0f, 2.0f, 3.0f, 4.0f);
Vector4 b = new Vector4(1.0f, 2.0f, 3.0f, 4.0f);
// case 1: compare between same values
Assert.True(a.Equals(b));
// case 2: compare between different values
b.X = 10.0f;
Assert.False(a.Equals(b));
}
示例4: Vector4EqualsTest
public void Vector4EqualsTest()
{
Vector4 a = new Vector4(1.0f, 2.0f, 3.0f, 4.0f);
Vector4 b = new Vector4(1.0f, 2.0f, 3.0f, 4.0f);
// case 1: compare between same values
object obj = b;
bool expected = true;
bool actual = a.Equals(obj);
Assert.AreEqual(expected, actual, "Vector4.Equals did not return the expected value.");
// case 2: compare between different values
b.X = 10.0f;
obj = b;
expected = false;
actual = a.Equals(obj);
Assert.AreEqual(expected, actual, "Vector4.Equals did not return the expected value.");
// case 3: compare between different types.
obj = new Quaternion();
expected = false;
actual = a.Equals(obj);
Assert.AreEqual(expected, actual, "Vector4.Equals did not return the expected value.");
// case 3: compare against null.
obj = null;
expected = false;
actual = a.Equals(obj);
Assert.AreEqual(expected, actual, "Vector4.Equals did not return the expected value.");
}
示例5: Equals
static bool Equals(ref Vector4 a, ref Vector4 b)
{
return a.Equals(b);
}
示例6: TransformVector2Matrix
/*
#region Transform
public static void TransformVector2Matrix (int times)
{
}
public static void TransformVector2MatrixRef (int times)
{
}
public static void TransformVector2Quaternion (int times)
{
}
public static void TransformVector2QuaternionRef (int times)
{
}
public static void TransformVector3Matrix (int times)
{
}
public static void TransformVector3MatrixRef (int times)
{
}
public static void TransformVector3Quaternion (int times)
{
}
public static void TransformVector3QuaternionRef (int times)
{
}
public static void TransformMatrix (int times)
{
}
public static void TransformMatrixRef (int times)
{
}
public static void TransformQuaternon (int times)
{
}
public static void TransformQuaternonRef (int times)
{
}
public static void TransformArrayMatrixWithIndices (int times)
{
}
public static void TransformArrayQuaternionWithIndices (int times)
{
}
public static void TransformArrayMatrix (int times)
{
}
public static void TransformArrayQuaternion (int times)
{
}
#endregion
*/
#region Equality
public static void IEquatableEquals (int times)
{
var value1 = new Vector4 (0f, 0f, 0f, 0.56f);
var value2 = new Vector4 (0f, 0f, 0f, -0.56f);
bool result;
for (int i = 0; i < times; i++) {
result = value1.Equals (value2);
}
}
示例7: Equals
public override bool Equals(object other)
{
if (!(other is BoneWeight))
{
return false;
}
BoneWeight boneWeight = (BoneWeight)other;
bool arg_CC_0;
if (this.boneIndex0.Equals(boneWeight.boneIndex0) && this.boneIndex1.Equals(boneWeight.boneIndex1) && this.boneIndex2.Equals(boneWeight.boneIndex2) && this.boneIndex3.Equals(boneWeight.boneIndex3))
{
Vector4 vector = new Vector4(this.weight0, this.weight1, this.weight2, this.weight3);
arg_CC_0 = vector.Equals(new Vector4(boneWeight.weight0, boneWeight.weight1, boneWeight.weight2, boneWeight.weight3));
}
else
{
arg_CC_0 = false;
}
return arg_CC_0;
}
示例8: Equals
public override bool Equals(object other)
{
if (other is BoneWeight)
{
BoneWeight weight = (BoneWeight) other;
if ((this.boneIndex0.Equals(weight.boneIndex0) && this.boneIndex1.Equals(weight.boneIndex1)) && (this.boneIndex2.Equals(weight.boneIndex2) && this.boneIndex3.Equals(weight.boneIndex3)))
{
Vector4 vector = new Vector4(this.weight0, this.weight1, this.weight2, this.weight3);
return vector.Equals(new Vector4(weight.weight0, weight.weight1, weight.weight2, weight.weight3));
}
}
return false;
}