当前位置: 首页>>代码示例>>C#>>正文


C# Vector3D.Equals方法代码示例

本文整理汇总了C#中Vector3D.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3D.Equals方法的具体用法?C# Vector3D.Equals怎么用?C# Vector3D.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vector3D的用法示例。


在下文中一共展示了Vector3D.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestEquals

        public void TestEquals()
        {
            float x = 1, y = 2, z = 5;
            float x2 = 3, y2 = 4, z2 = 10;

            Vector3D v1 = new Vector3D(x, y, z);
            Vector3D v2 = new Vector3D(x, y, z);
            Vector3D v3 = new Vector3D(x2, y2, z2);

            //Test IEquatable Equals
            Assert.IsTrue(v1.Equals(v2), "Test IEquatable equals");
            Assert.IsFalse(v1.Equals(v3), "Test IEquatable equals");

            //Test object equals override
            Assert.IsTrue(v1.Equals((object) v2), "Tests object equals");
            Assert.IsFalse(v1.Equals((object) v3), "Tests object equals");

            //Test op equals
            Assert.IsTrue(v1 == v2, "Testing OpEquals");
            Assert.IsFalse(v1 == v3, "Testing OpEquals");

            //Test op not equals
            Assert.IsTrue(v1 != v3, "Testing OpNotEquals");
            Assert.IsFalse(v1 != v2, "Testing OpNotEquals");
        }
开发者ID:dkushner,项目名称:Assimp-Net,代码行数:25,代码来源:Vector3DTestFixture.cs

示例2: TestEquals

 public void TestEquals()
 {
     Vector3D v0 = new Vector3D(678.0, 234.8, -123.987);
       Vector3D v1 = new Vector3D(678.0, 234.8, -123.987);
       Vector3D v2 = new Vector3D(67.0, 234.8, -123.987);
       Vector3D v3 = new Vector3D(678.0, 24.8, -123.987);
       Vector3D v4 = new Vector3D(678.0, 234.8, 123.987);
       Assert.IsTrue(v0.Equals(v0));
       Assert.IsTrue(v0.Equals(v1));
       Assert.IsFalse(v0.Equals(v2));
       Assert.IsFalse(v0.Equals(v3));
       Assert.IsFalse(v0.Equals(v4));
       Assert.IsFalse(v0.Equals(v0.ToString()));
 }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:14,代码来源:Vector3DTest.cs

示例3: PointIsInPlane

 public static bool PointIsInPlane(Vector3D point, Vector3D planeNormal, Vector3D planePosition)
 {
     const float accuracy = 0.001f;
     if (point.Equals(planePosition))
         return true;
     Vector3D pointDirection = (point - planePosition).Normalize();
     planeNormal = planeNormal.Normalize();
     if (Math.Abs(pointDirection.Dot(planeNormal)) < accuracy)
         return true;
     return false;
 }
开发者ID:CuriousX,项目名称:annotation-and-image-markup,代码行数:11,代码来源:SegmentationGraphicsHelpers.cs

示例4: TestEquals

        public void TestEquals()
        {
            Vector3D a = new Vector3D(1.0, 2.0, 3.0);
            Vector3D b = new Vector3D(4.0, 5.0, 6.0);
            Vector3D c = new Vector3D(1.0, 2.0, 3.0);

            Assert.IsTrue(a.Equals(c));
            Assert.IsTrue(c.Equals(a));
            Assert.IsTrue(a == c);
            Assert.IsTrue(c == a);
            Assert.IsFalse(c != a);
            Assert.IsFalse(c != a);
            Assert.IsFalse(a.Equals(b));
            Assert.IsFalse(b.Equals(a));
            Assert.IsFalse(a == b);
            Assert.IsFalse(b == a);
            Assert.IsTrue(a != b);
            Assert.IsTrue(b != a);

            object objA = a;
            object objB = b;
            object objC = c;

            Assert.IsTrue(a.Equals(objA));
            Assert.IsTrue(a.Equals(objC));
            Assert.IsFalse(a.Equals(objB));

            Assert.IsTrue(objA.Equals(objC));
            Assert.IsFalse(objA.Equals(objB));

            Assert.IsFalse(a.Equals(null));
            Assert.IsFalse(a.Equals(5));
        }
开发者ID:jpespartero,项目名称:OpenGlobe,代码行数:33,代码来源:Vector3DTests.cs


注:本文中的Vector3D.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。