GitHub PullRequestReviewCommentEvent at 2014-11-05 09:42:04
Repository: cocos2d-js
Actor: pandamicro
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/cocos2d/cocos2d-js/pulls/comments/19862608","id":19862608,"diff_hunk":"@@ -1792,6 +1792,56 @@ var Issue1073 = ChipmunkDemo.extend({\n     }\n });\n \n+var Issue1083 = ChipmunkDemo.extend({\n+    ctor:function(){\n+        this._super();\n+        this._subtitle = 'Chipmunk Demo';\n+        this._title = 'Issue 1083';\n+\n+        var space = this.space;\n+\n+        //add a segment\n+        var mass = 1;\n+        var length = 100;\n+        var a = v(-length/2, 0), b = v(length/2, 0);\n+        var body = space.addBody(new cp.Body(mass, cp.momentForSegment(mass, a, b)));\n+        body.setPos(v(320, 340));\n+        var segment = new cp.SegmentShape(body, a, b, 20);\n+        space.addShape(segment);\n+\n+        //add a poly\n+        var mass = 1;\n+        var NUM_VERTS = 5;\n+        var verts = new Array(NUM_VERTS * 2);\n+        for(var i=0; i<NUM_VERTS*2; i+=2){\n+            var angle = -Math.PI*i/NUM_VERTS;\n+            verts[i]   = 30*Math.cos(angle);\n+            verts[i+1] = 30*Math.sin(angle);\n+        }\n+        var body = space.addBody(new cp.Body(mass, cp.momentForPoly(mass, verts, v(0,0))));\n+        body.setPos(v(350+60, 220+60));\n+        var poly = new cp.PolyShape(body, verts, v(0,0));\n+        space.addShape(poly);\n+\n+        cc.assert(segment.a.x == -length/2, \"SegmentShape assertion failed : a.x\");\n+        cc.assert(segment.a.y == 0, \"SegmentShape assertion failed : a.y\");\n+        cc.assert(segment.b.x == length/2, \"SegmentShape assertion failed : b.x\");\n+        cc.assert(segment.a.y == 0, \"SegmentShape assertion failed : a.y\");\n+        var nomal = cp.v.perp(cp.v.normalize(cp.v.sub(b, a)));\n+        cc.assert(segment.n.x == nomal.x, \"SegmentShape assertion failed : n.y\");\n+        cc.assert(segment.n.y == nomal.y, \"SegmentShape assertion failed : n.y\");\n+        cc.assert(segment.r == 20, \"SegmentShape assertion failed : r\");\n+\n+        for(var i = 0; i < verts.length; ++i){\n+            cc.assert(verts[i] == poly.verts[i],\"PolyShape assertion failed : verts\");\n+        }\n+\n+        var plane = poly.planes[0];\n+        cc.assert(plane.d.toFixed(4) == 24.2705, \"PolyShape assertion failed : planes d\");\n+        cc.assert(plane.n.x.toFixed(4) == 0.8090, \"PolyShape assertion failed : planes n\")\n+    }","path":"samples/js-tests/src/ChipmunkTest/ChipmunkTest.js","position":51,"original_position":51,"commit_id":"4024fde0b691a10dd4b5a05834fb2584f5793e4a","original_commit_id":"4024fde0b691a10dd4b5a05834fb2584f5793e4a","user":{"login":"pandamicro","id":632460,"avatar_url":"https://avatars.githubusercontent.com/u/632460?v=2","gravatar_id":"","url":"https://api.github.com/users/pandamicro","html_url":"https://github.com/pandamicro","followers_url":"https://api.github.com/users/pandamicro/followers","following_url":"https://api.github.com/users/pandamicro/following{/other_user}","gists_url":"https://api.github.com/users/pandamicro/gists{/gist_id}","starred_url":"https://api.github.com/users/pandamicro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pandamicro/subscriptions","organizations_url":"https://api.github.com/users/pandamicro/orgs","repos_url":"https://api.github.com/users/pandamicro/repos","events_url":"https://api.github.com/users/pandamicro/events{/privacy}","received_events_url":"https://api.github.com/users/pandamicro/received_events","type":"User","site_admin":false},"body":"Need a onExit function to clean up the space, otherwise the test will crash if we click several time the restart button.","created_at":"2014-11-05T09:42:04Z","updated_at":"2014-11-05T09:42:04Z","html_url":"https://github.com/cocos2d/cocos2d-js/pull/1083#discussion_r19862608","pull_request_url":"https://api.github.com/repos/cocos2d/cocos2d-js/pulls/1083","_links":{"self":{"href":"https://api.github.com/repos/cocos2d/cocos2d-js/pulls/comments/19862608"},"html":{"href":"https://github.com/cocos2d/cocos2d-js/pull/1083#discussion_r19862608"},"pull_request":{"href":"https://api.github.com/repos/cocos2d/cocos2d-js/pulls/1083"}}},"pull_request":{"url":"https://api.github.com/repos/cocos2d/cocos2d-js/pulls/1083","id":23749614,"html_url":"https://github.com/cocos2d/cocos2d-js/pull/1083","diff_url":"https://github.com/cocos2d/cocos2d-js/pull/1083.diff","patch_url":"https://github.com/cocos2d/cocos2d-js/pull/1083.patch","issue_url":"https://api.github.com/repos/cocos2d/cocos2d-js/issues/1083","number":1083,"state":"open","locked":false,"title":"add missing properties of cp.SegmentShape and cp.PolyShape","user":{"login":"joshuastray","id":2784749,"avatar_url":"https://avatars.githubusercontent.com/u/2784749?v=2","gravatar_id":"","url":"https://api.github.com/users/joshuastray","html_url":"https://github.com/joshuastray","followers_url":"https://api.github.com/users/joshuastray/followers","following_url":"https://api.github.com/users/joshuastray/following{/other_user}","gists_url":"https://api.github.com/users/joshuastray/gists{/gist_id}","starred_url":"https://api.github.com/users/joshuastray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshuastray/subscriptions","organizations_url":"https://api.github.com/users/joshuastray/orgs","repos_url":"https://api.github.com/users/joshuastray/repos","events_url":"https://api.github.com/users/joshuastray/events{/privacy}","received_events_url":"https://api.github.com/users/joshuastray/received_events","type":"User","site_admin":false},"body":"#1048 ","created_at":"2014-11-03T09:38:57Z","updated_at":"2014-11-05T09:42:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"265dab970b472dbc5001218874f2c218e0426f4a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cocos2d/cocos2d-js/pulls/1083/commits","review_comments_url":"https://api.github.com/repos/cocos2d/cocos2d-js/pulls/1083/comments","review_comment_url":"https://api.github.com/repos/cocos2d/cocos2d-js/pulls/comments/{number}","comments_url":"https://api.github.com/repos/cocos2d/cocos2d-js/issues/1083/comments","statuses_url":"https://api.github.com/repos/cocos2d/cocos2d-js/statuses/4024fde0b691a10dd4b5a05834fb2584f5793e4a","head":{"label":"joshuastray:shape","ref":"shape","sha":"4024fde0b691a10dd4b5a05834fb2584f5793e4a","user":{"login":"joshuastray","id":2784749,"avatar_url":"https://avatars.githubusercontent.com/u/2784749?v=2","gravatar_id":"","url":"https://api.github.com/users/joshuastray","html_url":"https://github.com/joshuastray","followers_url":"https://api.github.com/users/joshuastray/followers","following_url":"https://api.github.com/users/joshuastray/following{/other_user}","gists_url":"https://api.github.com/users/joshuastray/gists{/gist_id}","starred_url":"https://api.github.com/users/joshuastray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshuastray/subscriptions","organizations_url":"https://api.github.com/users/joshuastray/orgs","repos_url":"https://api.github.com/users/joshuastray/repos","events_url":"https://api.github.com/users/joshuastray/events{/privacy}","received_events_url":"https://api.github.com/users/joshuastray/received_events","type":"User","site_admin":false},"repo":{"id":18319545,"name":"cocos2d-js","full_name":"joshuastray/cocos2d-js","owner":{"login":"joshuastray","id":2784749,"avatar_url":"https://avatars.githubusercontent.com/u/2784749?v=2","gravatar_id":"","url":"https://api.github.com/users/joshuastray","html_url":"https://github.com/joshuastray","followers_url":"https://api.github.com/users/joshuastray/followers","following_url":"https://api.github.com/users/joshuastray/following{/other_user}","gists_url":"https://api.github.com/users/joshuastray/gists{/gist_id}","starred_url":"https://api.github.com/users/joshuastray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshuastray/subscriptions","organizations_url":"https://api.github.com/users/joshuastray/orgs","repos_url":"https://api.github.com/users/joshuastray/repos","events_url":"https://api.github.com/users/joshuastray/events{/privacy}","received_events_url":"https://api.github.com/users/joshuastray/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/joshuastray/cocos2d-js","description":"cocos2d-x for JS","fork":true,"url":"https://api.github.com/repos/joshuastray/cocos2d-js","forks_url":"https://api.github.com/repos/joshuastray/cocos2d-js/forks","keys_url":"https://api.github.com/repos/joshuastray/cocos2d-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joshuastray/cocos2d-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joshuastray/cocos2d-js/teams","hooks_url":"https://api.github.com/repos/joshuastray/cocos2d-js/hooks","issue_events_url":"https://api.github.com/repos/joshuastray/cocos2d-js/issues/events{/number}","events_url":"https://api.github.com/repos/joshuastray/cocos2d-js/events","assignees_url":"https://api.github.com/repos/joshuastray/cocos2d-js/assignees{/user}","branches_url":"https://api.github.com/repos/joshuastray/cocos2d-js/branches{/branch}","tags_url":"https://api.github.com/repos/joshuastray/cocos2d-js/tags","blobs_url":"https://api.github.com/repos/joshuastray/cocos2d-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joshuastray/cocos2d-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joshuastray/cocos2d-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/joshuastray/cocos2d-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joshuastray/cocos2d-js/statuses/{sha}","languages_url":"https://api.github.com/repos/joshuastray/cocos2d-js/languages","stargazers_url":"https://api.github.com/repos/joshuastray/cocos2d-js/stargazers","contributors_url":"https://api.github.com/repos/joshuastray/cocos2d-js/contributors","subscribers_url":"https://api.github.com/repos/joshuastray/cocos2d-js/subscribers","subscription_url":"https://api.github.com/repos/joshuastray/cocos2d-js/subscription","commits_url":"https://api.github.com/repos/joshuastray/cocos2d-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/joshuastray/cocos2d-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/joshuastray/cocos2d-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/joshuastray/cocos2d-js/issues/comments/{number}","contents_url":"https://api.github.com/repos/joshuastray/cocos2d-js/contents/{+path}","compare_url":"https://api.github.com/repos/joshuastray/cocos2d-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joshuastray/cocos2d-js/merges","archive_url":"https://api.github.com/repos/joshuastray/cocos2d-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joshuastray/cocos2d-js/downloads","issues_url":"https://api.github.com/repos/joshuastray/cocos2d-js/issues{/number}","pulls_url":"https://api.github.com/repos/joshuastray/cocos2d-js/pulls{/number}","milestones_url":"https://api.github.com/repos/joshuastray/cocos2d-js/milestones{/number}","notifications_url":"https://api.github.com/repos/joshuastray/cocos2d-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joshuastray/cocos2d-js/labels{/name}","releases_url":"https://api.github.com/repos/joshuastray/cocos2d-js/releases{/id}","created_at":"2014-04-01T06:10:38Z","updated_at":"2014-10-31T14:39:42Z","pushed_at":"2014-11-05T09:09:29Z","git_url":"git://github.com/joshuastray/cocos2d-js.git","ssh_url":"git@github.com:joshuastray/cocos2d-js.git","clone_url":"https://github.com/joshuastray/cocos2d-js.git","svn_url":"https://github.com/joshuastray/cocos2d-js","homepage":"http://www.cocos2d-x.org","size":445619,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"cocos2d:develop","ref":"develop","sha":"4a286bb8089207b2b00fd4b5cb9063ce7804abed","user":{"login":"cocos2d","id":234324,"avatar_url":"https://avatars.githubusercontent.com/u/234324?v=2","gravatar_id":"","url":"https://api.github.com/users/cocos2d","html_url":"https://github.com/cocos2d","followers_url":"https://api.github.com/users/cocos2d/followers","following_url":"https://api.github.com/users/cocos2d/following{/other_user}","gists_url":"https://api.github.com/users/cocos2d/gists{/gist_id}","starred_url":"https://api.github.com/users/cocos2d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cocos2d/subscriptions","organizations_url":"https://api.github.com/users/cocos2d/orgs","repos_url":"https://api.github.com/users/cocos2d/repos","events_url":"https://api.github.com/users/cocos2d/events{/privacy}","received_events_url":"https://api.github.com/users/cocos2d/received_events","type":"Organization","site_admin":false},"repo":{"id":17049596,"name":"cocos2d-js","full_name":"cocos2d/cocos2d-js","owner":{"login":"cocos2d","id":234324,"avatar_url":"https://avatars.githubusercontent.com/u/234324?v=2","gravatar_id":"","url":"https://api.github.com/users/cocos2d","html_url":"https://github.com/cocos2d","followers_url":"https://api.github.com/users/cocos2d/followers","following_url":"https://api.github.com/users/cocos2d/following{/other_user}","gists_url":"https://api.github.com/users/cocos2d/gists{/gist_id}","starred_url":"https://api.github.com/users/cocos2d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cocos2d/subscriptions","organizations_url":"https://api.github.com/users/cocos2d/orgs","repos_url":"https://api.github.com/users/cocos2d/repos","events_url":"https://api.github.com/users/cocos2d/events{/privacy}","received_events_url":"https://api.github.com/users/cocos2d/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cocos2d/cocos2d-js","description":"cocos2d-x for JS","fork":false,"url":"https://api.github.com/repos/cocos2d/cocos2d-js","forks_url":"https://api.github.com/repos/cocos2d/cocos2d-js/forks","keys_url":"https://api.github.com/repos/cocos2d/cocos2d-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cocos2d/cocos2d-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cocos2d/cocos2d-js/teams","hooks_url":"https://api.github.com/repos/cocos2d/cocos2d-js/hooks","issue_events_url":"https://api.github.com/repos/cocos2d/cocos2d-js/issues/events{/number}","events_url":"https://api.github.com/repos/cocos2d/cocos2d-js/events","assignees_url":"https://api.github.com/repos/cocos2d/cocos2d-js/assignees{/user}","branches_url":"https://api.github.com/repos/cocos2d/cocos2d-js/branches{/branch}","tags_url":"https://api.github.com/repos/cocos2d/cocos2d-js/tags","blobs_url":"https://api.github.com/repos/cocos2d/cocos2d-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cocos2d/cocos2d-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cocos2d/cocos2d-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/cocos2d/cocos2d-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cocos2d/cocos2d-js/statuses/{sha}","languages_url":"https://api.github.com/repos/cocos2d/cocos2d-js/languages","stargazers_url":"https://api.github.com/repos/cocos2d/cocos2d-js/stargazers","contributors_url":"https://api.github.com/repos/cocos2d/cocos2d-js/contributors","subscribers_url":"https://api.github.com/repos/cocos2d/cocos2d-js/subscribers","subscription_url":"https://api.github.com/repos/cocos2d/cocos2d-js/subscription","commits_url":"https://api.github.com/repos/cocos2d/cocos2d-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/cocos2d/cocos2d-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/cocos2d/cocos2d-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/cocos2d/cocos2d-js/issues/comments/{number}","contents_url":"https://api.github.com/repos/cocos2d/cocos2d-js/contents/{+path}","compare_url":"https://api.github.com/repos/cocos2d/cocos2d-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cocos2d/cocos2d-js/merges","archive_url":"https://api.github.com/repos/cocos2d/cocos2d-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cocos2d/cocos2d-js/downloads","issues_url":"https://api.github.com/repos/cocos2d/cocos2d-js/issues{/number}","pulls_url":"https://api.github.com/repos/cocos2d/cocos2d-js/pulls{/number}","milestones_url":"https://api.github.com/repos/cocos2d/cocos2d-js/milestones{/number}","notifications_url":"https://api.github.com/repos/cocos2d/cocos2d-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cocos2d/cocos2d-js/labels{/name}","releases_url":"https://api.github.com/repos/cocos2d/cocos2d-js/releases{/id}","created_at":"2014-02-21T08:09:02Z","updated_at":"2014-11-05T09:25:37Z","pushed_at":"2014-11-05T08:40:05Z","git_url":"git://github.com/cocos2d/cocos2d-js.git","ssh_url":"git@github.com:cocos2d/cocos2d-js.git","clone_url":"https://github.com/cocos2d/cocos2d-js.git","svn_url":"https://github.com/cocos2d/cocos2d-js","homepage":"http://www.cocos2d-x.org","size":488925,"stargazers_count":437,"watchers_count":437,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":231,"mirror_url":null,"open_issues_count":231,"forks":231,"open_issues":231,"watchers":437,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/cocos2d/cocos2d-js/pulls/1083"},"html":{"href":"https://github.com/cocos2d/cocos2d-js/pull/1083"},"issue":{"href":"https://api.github.com/repos/cocos2d/cocos2d-js/issues/1083"},"comments":{"href":"https://api.github.com/repos/cocos2d/cocos2d-js/issues/1083/comments"},"review_comments":{"href":"https://api.github.com/repos/cocos2d/cocos2d-js/pulls/1083/comments"},"review_comment":{"href":"https://api.github.com/repos/cocos2d/cocos2d-js/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/cocos2d/cocos2d-js/pulls/1083/commits"},"statuses":{"href":"https://api.github.com/repos/cocos2d/cocos2d-js/statuses/4024fde0b691a10dd4b5a05834fb2584f5793e4a"}}}}