public static float ccpCalcRotate(final CGPoint from,final CGPoint to){
  float o=to.x - from.x;
  float a=to.y - from.y;
  float at=ccMacros.CC_RADIANS_TO_DEGREES((float)Math.atan(o / a));
  if (a < 0) {
    if (o < 0)     at=180 + Math.abs(at);
 else     at=180 - Math.abs(at);
  }
  return at;
}

public static float ccpCalcRotate ( final CGPoint from , final CGPoint to ) { float o = to . x - from . x ; float a = to . y - from . y ; float at = ccMacros . CC_RADIANS_TO_DEGREES ( ( float ) Math . atan ( o / a ) ) ; if ( a < 0 ) { if ( o < 0 ) at = 180 + Math . abs ( at ) ; else at = 180 - Math . abs ( at ) ; } return at ; }
caculate the rotation ( in degrees ) between two points , so that when we move from one point to the other , we can set the correct rotation to head to that point .
