Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Commits on Nov 21, 2011
@myrddinus myrddinus add rotateByAngle method with no garbage. 3f609b4
Commits on Nov 22, 2011
@ZhouWeikuan Merge pull request #48 from myrddinus/master
add rotateByAngle method with no garbage in CGPointUtil
ee6221f
Showing with 11 additions and 0 deletions.
  1. +11 −0 cocos2d-android/src/org/cocos2d/types/util/CGPointUtil.java
View
11 cocos2d-android/src/org/cocos2d/types/util/CGPointUtil.java
@@ -70,4 +70,15 @@ public static float distance(CGPoint p1, CGPoint p2) {
float dy = p2.y - p1.y;
return (float)Math.sqrt(dx * dx + dy * dy);
}
+
+ public static void rotateByAngle(CGPoint v, CGPoint pivot, float angle, CGPoint ret)
+ {
+ CGPointUtil.sub(v, pivot,ret);
+ float t = ret.x;
+ float cosa = (float)Math.cos(angle);
+ float sina = (float)Math.sin(angle);
+ ret.x = t*cosa - ret.y*sina;
+ ret.y = t*sina + ret.y*cosa;
+ CGPointUtil.add(ret, pivot);
+ }
}

No commit comments for this range

Something went wrong with that request. Please try again.