コード例 #1
0
 /// <summary>
 /// Clamp the each component to specified min and max.
 /// </summary>
 public void Clamp(Vector3f min, Vector3f max)
 {
     x = Math.Max(Math.Min(x, max.x), min.x);
     y = Math.Max(Math.Min(y, max.y), min.y);
     z = Math.Max(Math.Min(z, max.z), min.z);
 }
コード例 #2
0
 /// <summary>
 /// Create a rotation out of a vector.
 /// </summary>
 static public Matrix4x4f Rotate(Vector3f euler)
 {
     return(Quaternion3f.FromEuler(euler).ToMatrix4x4f());
 }
コード例 #3
0
 /// <summary>
 /// The minimum value between each component in vectors.
 /// </summary>
 public void Min(Vector3f v)
 {
     x = Math.Min(x, v.x);
     y = Math.Min(y, v.y);
     z = Math.Min(z, v.z);
 }
コード例 #4
0
 /// <summary>
 /// The maximum value between each component in vectors.
 /// </summary>
 public void Max(Vector3f v)
 {
     x = Math.Max(x, v.x);
     y = Math.Max(y, v.y);
     z = Math.Max(z, v.z);
 }
コード例 #5
0
 /// <summary>
 /// Distance between two vectors.
 /// </summary>
 public static float Distance(Vector3f v0, Vector3f v1)
 {
     return(FMath.SafeSqrt(SqrDistance(v0, v1)));
 }
コード例 #6
0
 /// <summary>
 /// Cross two vectors.
 /// </summary>
 public static Vector3f Cross(Vector3f v0, Vector3f v1)
 {
     return(new Vector3f(v0.y * v1.z - v0.z * v1.y, v0.z * v1.x - v0.x * v1.z, v0.x * v1.y - v0.y * v1.x));
 }
コード例 #7
0
 /// <summary>
 /// Cross two vectors.
 /// </summary>
 public Vector3f Cross(Vector3f v)
 {
     return(new Vector3f(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x));
 }
コード例 #8
0
 /// <summary>
 /// The dot product of two vectors.
 /// </summary>
 public static float Dot(Vector3f v0, Vector3f v1)
 {
     return(v0.x * v1.x + v0.y * v1.y + v0.z * v1.z);
 }
コード例 #9
0
 /// <summary>
 /// Are these vectors equal.
 /// </summary>
 public bool Equals(Vector3f v)
 {
     return(this == v);
 }