// Returns the angle from this vector to b, in radians. public float Angle(Vector3f b) { float div = LengthSq() * b.LengthSq(); Debug.Assert(div != 0); return (float)(System.Math.Acos((this.Dot(b)) / System.Math.Sqrt(div))); }
// Projects this vector onto the argument; in other words, // A.Project(B) returns projection of vector A onto B. public Vector3f ProjectTo(Vector3f b) { float l2 = b.LengthSq(); Debug.Assert(l2 != 0); return b * (Dot(b) / l2); }