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


C# Vec3.Normalize方法代码示例

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


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

示例1: Normalize_Vec3_LengthIsEqualToOne

 public void Normalize_Vec3_LengthIsEqualToOne()
 {
     Vec3 v = new Vec3(26, 23, 135);
     v.Normalize();
     Assert.IsTrue(v.Length == 1);
 }
开发者ID:samneirinck,项目名称:cemono,代码行数:6,代码来源:Vec3Tests.cs

示例2: ClosestPointSphereSphere

        /// <summary>
        /// Determines the closest point between a <see cref="CryEngine.BoundingSphere"/> and a <see cref="CryEngine.BoundingSphere"/>.
        /// </summary>
        /// <param name="sphere1">The first sphere to test.</param>
        /// <param name="sphere2">The second sphere to test.</param>
        /// <param name="result">When the method completes, contains the closest point between the two objects;
        /// or, if the point is directly in the center of the sphere, contains <see cref="CryEngine.Vec3"/>.</param>
        /// <remarks>
        /// If the two spheres are overlapping, but not directly ontop of each other, the closest point
        /// is the 'closest' point of intersection. This can also be considered is the deepest point of
        /// intersection.
        /// </remarks>
        public static void ClosestPointSphereSphere(ref BoundingSphere sphere1, ref BoundingSphere sphere2, out Vec3 result)
        {
            // Source: Jorgy343
            // Reference: None

            // Get the unit direction from the first sphere's center to the second sphere's center.
            result = sphere2.Center - sphere1.Center;
            result.Normalize();

            // Multiply the unit direction by the first sphere's radius to get a vector
            // the length of the first sphere.
            result *= sphere1.Radius;

            // Add the first sphere's center to the direction to get a point on the first sphere.
            result += sphere1.Center;
        }
开发者ID:RogierWV,项目名称:315GR,代码行数:28,代码来源:Collision.cs


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