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


C# Vector3D.GetAngleBetween方法代码示例

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


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

示例1: TestAngleBetween

		public void TestAngleBetween()
		{
			const float halfPi = (float)Math.PI/2;
			const float tolerance = 1e-5F;
			var v1 = Vector3D.xUnit;
			var v2 = Vector3D.yUnit;
			Assert.AreEqual(halfPi, v1.GetAngleBetween(v2), tolerance);

			v2 = -Vector3D.yUnit;
			Assert.AreEqual(halfPi, v1.GetAngleBetween(v2), tolerance);

			v2 = Vector3D.zUnit;
			Assert.AreEqual(halfPi, v1.GetAngleBetween(v2), tolerance);

			v2 = -Vector3D.zUnit;
			Assert.AreEqual(halfPi, v1.GetAngleBetween(v2), tolerance);

			v1 = Vector3D.yUnit;
			v2 = Vector3D.zUnit;
			Assert.AreEqual(halfPi, v1.GetAngleBetween(v2), tolerance);

			v2 = -Vector3D.zUnit;
			Assert.AreEqual(halfPi, v1.GetAngleBetween(v2), tolerance);

			v1 = new Vector3D(2.2F, -6.1F, 7.4F);
			v2 = new Vector3D(3.8F, 3.7F, 4.1F);
			const float result = 1.32374F; //75.845 degrees.
			Assert.AreEqual(result, v1.GetAngleBetween(v2), tolerance);

			v1 = v2 = Vector3D.xUnit;
			Assert.AreEqual(0, v1.GetAngleBetween(v2), tolerance);

		}
开发者ID:nhannd,项目名称:Xian,代码行数:33,代码来源:Vector3DTests.cs


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