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


C# Vector4.GetHashCode方法代码示例

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


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

示例1: TestGetHashCode

		public void TestGetHashCode()
		{
			{
				Vector2 a = new Vector2(10, 11);
				Vector2 b = new Vector2(10, 11);
				Assert.IsTrue(a.GetHashCode() == b.GetHashCode());
			}
			{
				Vector3 a = new Vector3(10, 11, 12);
				Vector3 b = new Vector3(10, 11, 12);
				Assert.IsTrue(a.GetHashCode() == b.GetHashCode());
			}
			{
				Vector4 a = new Vector4(10, 11, 12, 13);
				Vector4 b = new Vector4(10, 11, 12, 13);
				Assert.IsTrue(a.GetHashCode() == b.GetHashCode());
			}
			{
				Quaternion a = new Quaternion(10, 11, 12, 13);
				Quaternion b = new Quaternion(10, 11, 12, 13);
				Assert.IsTrue(a.GetHashCode() == b.GetHashCode());
			}
			{
				Matrix4X4 a = Matrix4X4.CreateRotationX(3);
				Matrix4X4 b = Matrix4X4.CreateRotationX(3);
				Assert.IsTrue(a.GetHashCode() == b.GetHashCode());
			}
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:28,代码来源:VectorMathTests.cs

示例2: Vector4GetHashCodeTest

        public void Vector4GetHashCodeTest()
        {
            Vector4 v1 = new Vector4(2.5f, 2.0f, 3.0f, 3.3f);

            Vector4 v3 = new Vector4(2.5f, 2.0f, 3.0f, 3.3f);
            Vector4 v5 = new Vector4(3.3f, 3.0f, 2.0f, 2.5f);
            Assert.True(v1.GetHashCode() == v1.GetHashCode());
            Assert.False(v1.GetHashCode() == v5.GetHashCode());
            Assert.True(v1.GetHashCode() == v3.GetHashCode());
            Vector4 v4 = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
            Vector4 v6 = new Vector4(1.0f, 0.0f, 0.0f, 0.0f);
            Vector4 v7 = new Vector4(0.0f, 1.0f, 0.0f, 0.0f);
            Vector4 v8 = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
            Vector4 v9 = new Vector4(1.0f, 1.0f, 0.0f, 0.0f);
            Assert.False(v4.GetHashCode() == v6.GetHashCode());
            Assert.False(v4.GetHashCode() == v7.GetHashCode());
            Assert.False(v4.GetHashCode() == v8.GetHashCode());
            Assert.False(v7.GetHashCode() == v6.GetHashCode());
            Assert.False(v8.GetHashCode() == v6.GetHashCode());
            Assert.False(v8.GetHashCode() == v7.GetHashCode());
            Assert.False(v9.GetHashCode() == v7.GetHashCode());
        }
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:22,代码来源:Vector4Tests.cs

示例3: Vector4GetHashCodeTest

 public void Vector4GetHashCodeTest()
 {
     Vector4 v1 = new Vector4(2.5f, 2.0f, 3.0f, 3.3f);
     Vector4 v2 = new Vector4(2.5f, 2.0f, 3.0f, 3.3f);
     Vector4 v3 = new Vector4(2.5f, 2.0f, 3.0f, 3.3f);
     Vector4 v5 = new Vector4(3.3f, 3.0f, 2.0f, 2.5f);
     Assert.Equal(v1.GetHashCode(), v1.GetHashCode());
     Assert.Equal(v1.GetHashCode(), v2.GetHashCode());
     Assert.NotEqual(v1.GetHashCode(), v5.GetHashCode());
     Assert.Equal(v1.GetHashCode(), v3.GetHashCode());
     Vector4 v4 = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
     Vector4 v6 = new Vector4(1.0f, 0.0f, 0.0f, 0.0f);
     Vector4 v7 = new Vector4(0.0f, 1.0f, 0.0f, 0.0f);
     Vector4 v8 = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
     Vector4 v9 = new Vector4(1.0f, 1.0f, 0.0f, 0.0f);
     Assert.NotEqual(v4.GetHashCode(), v6.GetHashCode());
     Assert.NotEqual(v4.GetHashCode(), v7.GetHashCode());
     Assert.NotEqual(v4.GetHashCode(), v8.GetHashCode());
     Assert.NotEqual(v7.GetHashCode(), v6.GetHashCode());
     Assert.NotEqual(v8.GetHashCode(), v6.GetHashCode());
     Assert.NotEqual(v8.GetHashCode(), v7.GetHashCode());
     Assert.NotEqual(v9.GetHashCode(), v7.GetHashCode());
 }
开发者ID:Corillian,项目名称:corefx,代码行数:23,代码来源:Vector4Tests.cs

示例4: HashTest

        public static void HashTest()
        {
            Random rand = new Random(84329);
            Vector4 vector4 = new Vector4(
                Convert.ToSingle(rand.NextDouble()),
                Convert.ToSingle(rand.NextDouble()),
                Convert.ToSingle(rand.NextDouble()),
                Convert.ToSingle(rand.NextDouble()));

            foreach (var iteration in Benchmark.Iterations)
            {
                using (iteration.StartMeasurement())
                {
                    for (int i = 0; i < Benchmark.InnerIterationCount; i++)
                    {
                        vector4.GetHashCode();
                    }
                }
            }
        }
开发者ID:SamuelEnglard,项目名称:corefx,代码行数:20,代码来源:HashCodeTest.cs

示例5: HashCode

		public static void HashCode (int times)
		{
			var value = new Vector4 (0.1f, -2f, -0.2f, 0.56f);
			int result;
			
			for (int i = 0; i < times; i++) {
				result = value.GetHashCode ();
			}
		}
开发者ID:CodesInChaos,项目名称:Mono.GameMath,代码行数:9,代码来源:Vector4Test.cs


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