/// <summary> /// Distance from the vector to another. /// </summary> /// <param name="b">The other vector.</param> /// <returns></returns> public float dist(V2 b) => (this - b).len;
/// <summary> /// Makes a new 3D vector from a 2D vector. /// </summary> /// <param name="xy">XY components.</param> /// <param name="z">Z component.</param> public V3(V2 xy, float z) { this.x = xy.x; this.y = xy.y; this.z = z; }
/// <summary> /// Gets the dot product of two 2D vectors. /// </summary> /// <param name="a">First vector.</param> /// <param name="b">Second vector.</param> /// <returns></returns> public static float dot(V2 a, V2 b) => (a * b).sum;
/// <summary> /// Gets the distance between two 2D vectors. /// </summary> /// <param name="a">First vector.</param> /// <param name="b">Second vector.</param> /// <returns></returns> public static float dist(V2 a, V2 b) => (b - a).len;
/// <summary> /// Gets the angle between two 2D vectors. /// </summary> /// <param name="a">First vector.</param> /// <param name="b">Second vector.</param> /// <returns></returns> public static float angle(V2 a, V2 b) => ((a.unit * b.unit).sum + 1f) / PI2F;