/// <summary>Get the nearest point between this <see cref="Box2"/> and a <see cref="Vector2"/>. If the <see cref="Vector2"/> is inside this <see cref="Box2"/>, it is returned untouched.</summary> public void NearestPointTo( ref Vector2 point , out Vector2 result) { Containment containment = Intersect(ref point); if(containment != Containment.Disjoint) result = point; else point.Clamp(ref Min, ref Max, out result); return; }
/// <summary>Get the nearest point between this <see cref="Box2"/> and a <see cref="Vector2"/>. If the <see cref="Vector2"/> is inside this <see cref="Box2"/>, it is returned untouched.</summary> public Vector2 NearestPointTo( Vector2 point ) { Vector2 result; Containment containment = Intersect(ref point); if(containment != Containment.Disjoint) result = point; else point.Clamp(ref Min, ref Max, out result); return result; }
public static Vector2 Clamp(Vector2 value, Vector2 min, Vector2 max) => Vector2.Clamp(value, min, max);
public static Vector2 Clamp(Vector2 v1, float min, float max) { v1.Clamp(min, max); return(v1); }
public static Vector2 Clamp(Vector2 v1, float min, float max) { v1.Clamp(min, max); return v1; }