示例#1
0
        public void Clamp()
        {
            Vector3f v = new Vector3f(0.4f, 1.6f, 0.1f);

            v.Clamp(0.5f, 1.5f);
            Assert.AreEqual(v, new Vector3f(0.5f, 1.5f, 0.5f));

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