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


C# Vector2.Max方法代码示例

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


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

示例1: Prepare

        //Calculate bounds, and reset indices
        internal void Prepare()
        {
            Vector2 left, right;
            _boxMin = new Vector2(0);
            _boxMax = new Vector2(0);

            foreach (CollisionPlane plane in _planes)
            {
                //Normalize plane direction

                //Get bounds
                left = plane.PointLeft;
                right = plane.PointRight;

                _boxMin.Min(left);
                _boxMin.Min(right);
                _boxMax.Max(left);
                _boxMax.Max(right);

                //Reset encode indices
                plane._encodeIndex = -1;
                if (plane._linkLeft != null)
                    plane._linkLeft._encodeIndex = -1;
                if (plane._linkRight != null)
                    plane._linkRight._encodeIndex = -1;
            }
        }
开发者ID:blahblahblahblah831,项目名称:brawltools2,代码行数:28,代码来源:CollisionNode.cs

示例2: ClosestSurfacePoint

        /// <summary>
        /// Return the closest point to 'point' that lies on the surface of the primitive.
        /// If that point is inside the primitive, sign is negative.
        /// </summary>
        public void ClosestSurfacePoint( Vector2 point, out Vector2 ret, out float sign )
        {
            Vector2 closest = point.Max( Min ).Min( Max );

            if ( closest != point )
            {
                ret = closest;
                sign = 1.0f;
                return;
            }

            Vector2 l = closest; l.X = Min.X; float dl = closest.X - Min.X;
            Vector2 r = closest; r.X = Max.X; float dr = Max.X - closest.X;
            Vector2 t = closest; t.Y = Min.Y; float dt = closest.Y - Min.Y;
            Vector2 b = closest; b.Y = Max.Y; float db = Max.Y - closest.Y;

            ret = l;
            float d = dl;

            if ( d > dr )
            {
                ret = r;
                d = dr;
            }

            if ( d > dt )
            {
                ret = t;
                d = dt;
            }

            if ( d > db )
            {
                ret = b;
                d = db;
            }

            sign = -1.0f;
        }
开发者ID:artron33,项目名称:PsmFramework,代码行数:43,代码来源:Bounds2.cs

示例3: IsInside

 /// <summary>
 /// Return true if 'point' is inside the primitive (in its negative space).
 /// </summary>
 public bool IsInside( Vector2 point )
 {
     return point == point.Max( Min ).Min( Max );
 }
开发者ID:artron33,项目名称:PsmFramework,代码行数:7,代码来源:Bounds2.cs

示例4: SafeBounds

 /// <summary>
 /// Create a Bounds2 that goes through 2 points, the min and max are recalculated.
 /// </summary>
 /// <param name="min">First point.</param>
 /// <param name="max">Second point.</param>
 public static Bounds2 SafeBounds( Vector2 min, Vector2 max )
 {
     return new Bounds2( min.Min( max ), min.Max( max ) );
 }
开发者ID:artron33,项目名称:PsmFramework,代码行数:9,代码来源:Bounds2.cs


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