예제 #1
0
 public static FixedVector3 Lerp(FixedVector3 first, FixedVector3 second, FixedFloat blend)
 {
     first.Set(first.x + (second.x - first.x) * blend,
               first.y + (second.y - first.y) * blend,
               first.z + (second.z - first.z) * blend
               );
     return(first);
 }
예제 #2
0
 public static FixedVector3 Clamp(FixedVector3 vec, FixedVector3 min, FixedVector3 max)
 {
     vec.Set(FixedFloat.Clamp(vec.x, min.x, max.x),
             FixedFloat.Clamp(vec.y, min.y, max.y),
             FixedFloat.Clamp(vec.z, min.z, max.z)
             );
     return(vec);
 }
예제 #3
0
 public static FixedVector3 Min(FixedVector3 first, FixedVector3 second)
 {
     first.Set(first.x < second.x ? first.x : second.x,
               first.y < second.y ? first.y : second.y,
               first.z < second.z ? first.z : second.z
               );
     return(first);
 }
예제 #4
0
 public static FixedVector3 Cross(FixedVector3 left, FixedVector3 right)
 {
     //		if (   (left.y != 0 && right.z != 0 && left.y * right.z == 0)
     //		    || (left.z != 0 && right.y != 0 && left.z * right.y == 0)
     //		    || (left.z != 0 && right.x != 0 && left.z * right.x == 0)
     //		    || (left.x != 0 && right.z != 0 && left.x * right.z == 0)
     //		    || (left.x != 0 && right.y != 0 && left.x * right.y == 0)
     //		    || (left.y != 0 && right.x != 0 && left.y * right.x == 0)
     //		){
     //			UnityEngine.Debug.Log("Precision error: CROSS");
     //		}
     left.Set(left.y * right.z - left.z * right.y,
              left.z * right.x - left.x * right.z,
              left.x * right.y - left.y * right.x
              );
     return(left);
 }
예제 #5
0
 public static FixedVector3 Scale(FixedVector3 vec, FixedVector3 scale)
 {
     vec.Set(vec.x * scale.x, vec.y * scale.y, vec.z * scale.z);
     return(vec);
 }