本文整理汇总了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;
}
}
示例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;
}
示例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 );
}
示例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 ) );
}