public void Clamped() { Vector4d v = new Vector4d(0.4f, 1.6f, 0.1f, 1.7f); v.Clamp(0.5f, 1.5f); Assert.AreEqual(v, new Vector4d(0.5f, 1.5f, 0.5f, 1.5f)); v = new Vector4d(0.4f, 1.6f, 0.1f, 1.7f); v.Clamp(new Vector4d(0.5f, 1.5f, 0.5f, 1.5f), new Vector4d(0.5f, 1.5f, 0.5f, 1.5f)); Assert.AreEqual(v, new Vector4d(0.5f, 1.5f, 0.5f, 1.5f)); }
/// <summary>Get the nearest point between this <see cref="Box4d"/> and a <see cref="Vector4d"/>. If the <see cref="Vector4d"/> is inside this <see cref="Box4d"/>, it is returned untouched.</summary> public void NearestPointTo( ref Vector4d point , out Vector4d result) { Containment containment = Intersect(ref point); if(containment != Containment.Disjoint) result = point; else point.Clamp(ref Min, ref Max, out result); return; }