Exemplo n.º 1
0
 /// <summary>
 /// Gets the distance between two 3D vectors.
 /// </summary>
 /// <param name="a">First vector.</param>
 /// <param name="b">Second vector.</param>
 /// <returns></returns>
 public static float dist(V3 a, V3 b) => (b - a).len;
Exemplo n.º 2
0
 /// <summary>
 /// Gets the cross product of two 3D vectors.
 /// </summary>
 /// <param name="a">First vector.</param>
 /// <param name="b">Second vector.</param>
 /// <returns></returns>
 public static V3 cross(V3 a, V3 b) => new V3(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y - b.x);
Exemplo n.º 3
0
 /// <summary>
 /// Gets the dot product of two 3D vectors.
 /// </summary>
 /// <param name="a">First vector.</param>
 /// <param name="b">Second vector.</param>
 /// <returns></returns>
 public static float dot(V3 a, V3 b) => (a * b).sum;
Exemplo n.º 4
0
 public static float angle(V3 a, V3 b) => ((a.unit * b.unit).sum + 1f) / PI2F;