public static float AngleSigned(CCPoint a, CCPoint b) { CCPoint a2 = Normalize(a); CCPoint b2 = Normalize(b); float angle = (float)Math.Atan2(a2.x * b2.y - a2.y * b2.x, a2.Dot(b2)); if (Math.Abs(angle) < ccMacros.FLT_EPSILON) { return(0f); } return(angle); }
/// <summary> /// Returns the projection of this over v2. /// </summary> /// <param name="v2"></param> /// <returns></returns> public CCPoint Project(CCPoint v2) { return(v2.Mult(Dot(v2) / v2.Dot(v2))); }