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


C# Quaternion.RotateVector方法代码示例

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


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

示例1: Test_Quat_Generic_Vector_Multiplication_Against_Unity

        public static void Test_Quat_Generic_Vector_Multiplication_Against_Unity(float a, float b, float c, float d)
        {
            //arrange
            Quaternion<float> genericQuat = new Quaternion<float>(a, b, c, d);
            Vector3<float> genericVec3 = new Vector3<float>(b, c, d);

            //arrange
            UnityEngine.Quaternion unityQuat = new UnityEngine.Quaternion(a, b, c, d);
            UnityEngine.Vector3 unityVec3 = new UnityEngine.Vector3(b, c, d);

            //act
            Vector3<float> genericResultVec3 = genericQuat.RotateVector(genericVec3);
            UnityEngine.Vector3 unityResultVec3 = unityQuat * unityVec3;

            //assert
            for (int i = 0; i < 3; i++)
                //for Vector3 I rewrote the code so that it mostly matched UnityEngine after JIT values, not that I looked at the JIT compiled code but the values matched
                //after changing it. However, for some reason these do not line up like before. Operator overloads aren't equivalent to methods and something is happening
                //to make this not equivalent even though it's the same exact floating point math C# code.
                Assert.AreEqual(genericResultVec3[i], unityResultVec3[i], Math.Abs((((int)unityResultVec3[i]) * Vector3<float>.kEpsilon)));
        }
开发者ID:HelloKitty,项目名称:Testity,代码行数:21,代码来源:GenericQuatAgainstUnity.cs


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