Ejemplo 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);
 }
Ejemplo 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;
 }
Ejemplo 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;
 }
Ejemplo n.º 4
0
 public static Vector3 Clamp(Vector3 v1, float min, float max)
 {
     v1.Clamp(min, max); return(v1);
 }
Ejemplo n.º 5
0
 public static Vector3 Clamp01(Vector3 value) => Vector3.Clamp(value, Vector3.Zero, Vector3.One);
Ejemplo n.º 6
0
 public static Vector3 Clamp(Vector3 value, Vector3 min, Vector3 max) => Vector3.Clamp(value, min, max);
Ejemplo 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);
 }
Ejemplo n.º 8
0
 public static Vector3 Clamp(Vector3 v1, float min, float max)
 {
     v1.Clamp(min, max); return v1;
 }