예제 #1
0
        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));
 }
예제 #3
0
 /// <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)));
 }
예제 #4
0
        public static float AngleSigned(CCPoint a, CCPoint b)
        {
            CCPoint cCPoint  = CCPoint.Normalize(a);
            CCPoint cCPoint1 = CCPoint.Normalize(b);
            float   single   = (float)Math.Atan2((double)(cCPoint.x * cCPoint1.y - cCPoint.y * cCPoint1.x), (double)cCPoint.Dot(cCPoint1));

            if (Math.Abs(single) < ccMacros.FLT_EPSILON)
            {
                return(0f);
            }
            return(single);
        }