Esempio n. 1
0
 /// <summary>
 /// Writes Vector3 with -1, 1 range (uniform-spacing) with specified bit precision.
 /// </summary>
 public static void WriteNormalizedSignedVector3(this BitStream stream, Vector3 vec, int bitCount)
 {
     vec = Vector3.Clamp(vec, Vector3.MinusOne, Vector3.One);
     stream.WriteNormalizedSignedFloat(vec.X, bitCount);
     stream.WriteNormalizedSignedFloat(vec.Y, bitCount);
     stream.WriteNormalizedSignedFloat(vec.Z, bitCount);
 }
Esempio n. 2
0
 /// <summary>Get the nearest point between this <see cref="Box3"/> and a <see cref="Vector3"/>. If the <see cref="Vector3"/> is inside this <see cref="Box3"/>, it is returned untouched.</summary>
 public Vector3 NearestPointTo( Vector3 point )
 {
     Vector3 result;
         Containment containment = Intersect(ref point);
         if(containment != Containment.Disjoint)
             result = point;
         else
             point.Clamp(ref Min, ref Max, out result);
         return result;
 }
Esempio n. 3
0
 /// <summary>Get the nearest point between this <see cref="Box3"/> and a <see cref="Vector3"/>. If the <see cref="Vector3"/> is inside this <see cref="Box3"/>, it is returned untouched.</summary>
 public void NearestPointTo( ref  Vector3 point , out Vector3 result)
 {
     Containment containment = Intersect(ref point);
         if(containment != Containment.Disjoint)
             result = point;
         else
             point.Clamp(ref Min, ref Max, out result);
         return;
 }
Esempio n. 4
0
 public static Vector3 Clamp(Vector3 v1, float min, float max)
 {
     v1.Clamp(min, max); return(v1);
 }
Esempio n. 5
0
 public static Vector3 Clamp01(Vector3 value) => Vector3.Clamp(value, Vector3.Zero, Vector3.One);
Esempio n. 6
0
 public static Vector3 Clamp(Vector3 value, Vector3 min, Vector3 max) => Vector3.Clamp(value, min, max);
Esempio n. 7
0
 /// <summary>
 /// Finds the closest point on a bounding box from another point
 /// </summary>
 /// <param name="box"></param>
 /// <param name="point"></param>
 /// <returns></returns>
 public static Vector3 ClosestPoint(this BoundingBox box, Vector3 point)
 {
     return point.Clamp(box.Min, box.Max);
 }
Esempio n. 8
0
 public static Vector3 Clamp(Vector3 v1, float min, float max)
 {
     v1.Clamp(min, max); return v1;
 }