{"action":"created","comment":{"url":"https://api.github.com/repos/cogneco/ooc-kean/pulls/comments/44921427","id":44921427,"diff_hunk":"@@ -33,42 +35,99 @@ FloatConvexHull2D: class {\n \t\tthis _points add(box rightBottom)\n \t\tthis _points add(box rightTop)\n \t}\n+\tfree: override func {\n+\t\tthis _points free()\n+\t\tsuper()\n+\t}\n \tcontains: func ~Point (point: FloatPoint2D) -> Bool {\n \t\tresult := true\n-\t\tfor (i in 0 .. this count - 1)\n-\t\t\tif (This _isOnLeft(this _points[i], this _points[i + 1], point)) {\n+\t\tfor (i in 0 .. this count)\n+\t\t\tif (result && This _isOnLeft(this _points[i], this _points[(i + 1) % this count], point))\n \t\t\t\tresult = false\n-\t\t\t\tbreak\n-\t\t\t}\n-\t\tif (This _isOnLeft(this _points[this count - 1], this _points[0], point))\n-\t\t\tresult = false\n \t\tresult\n \t}\n \tcontains: func ~ConvexHull (other: This) -> Bool {\n \t\tresult := true\n \t\tfor (i in 0 .. other count)\n-\t\t\tif (!this contains(other points[i])) {\n+\t\t\tif (result && !this contains(other _points[i]))\n \t\t\t\tresult = false\n-\t\t\t\tbreak\n-\t\t\t}\n \t\tresult\n \t}\n \tcontains: func ~FloatBox2D (box: FloatBox2D) -> Bool {\n \t\tthis contains(box leftBottom) && this contains(box rightBottom) && this contains(box leftTop) && this contains(box rightTop)\n \t}\n \ttransform: func (transform: FloatTransform2D) -> This {\n-\t\t// TODO: Re-compute convex hull from new points if necessary, i.e. if transform changes order of points\n \t\tnewPoints := VectorList<FloatPoint2D> new(this count)\n \t\tfor (i in 0 .. this count)\n \t\t\tnewPoints add(transform * this _points[i])\n \t\tThis new(newPoints)\n \t}\n-\t_isOnLeft: static func (leftPoint, rightPoint, queryPoint: FloatPoint2D) -> Bool {\n-\t\t(rightPoint x - leftPoint x) * (queryPoint y - leftPoint y) > (rightPoint y - leftPoint y) * (queryPoint x - leftPoint x)\n+\tcomputeHull: func {\n+\t\tif (this count > 2) {\n+\t\t\t// Uses the Quickhull algorithm if more than two points, average complexity O(n log n)\n+\t\t\t// https://en.wikipedia.org/wiki/Quickhull\n+\t\t\tpoints := this _points copy()","path":"source/math/FloatConvexHull2D.ooc","position":64,"original_position":66,"commit_id":"eb0f2159b2ed9fdda8c913f89e3130b0555c15c2","original_commit_id":"1bd9e087874568dbf1e72b6acb2885a1ac9cd877","user":{"login":"davidhesselbom","id":4319680,"avatar_url":"https://avatars.githubusercontent.com/u/4319680?v=3","gravatar_id":"","url":"https://api.github.com/users/davidhesselbom","html_url":"https://github.com/davidhesselbom","followers_url":"https://api.github.com/users/davidhesselbom/followers","following_url":"https://api.github.com/users/davidhesselbom/following{/other_user}","gists_url":"https://api.github.com/users/davidhesselbom/gists{/gist_id}","starred_url":"https://api.github.com/users/davidhesselbom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidhesselbom/subscriptions","organizations_url":"https://api.github.com/users/davidhesselbom/orgs","repos_url":"https://api.github.com/users/davidhesselbom/repos","events_url":"https://api.github.com/users/davidhesselbom/events{/privacy}","received_events_url":"https://api.github.com/users/davidhesselbom/received_events","type":"User","site_admin":false},"body":"But you're already doing `this _points clear` on the second line, so if anyone else is using this list, they're in trouble already.","created_at":"2015-11-16T13:16:21Z","updated_at":"2015-11-16T13:16:21Z","html_url":"https://github.com/cogneco/ooc-kean/pull/699#discussion_r44921427","pull_request_url":"https://api.github.com/repos/cogneco/ooc-kean/pulls/699","_links":{"self":{"href":"https://api.github.com/repos/cogneco/ooc-kean/pulls/comments/44921427"},"html":{"href":"https://github.com/cogneco/ooc-kean/pull/699#discussion_r44921427"},"pull_request":{"href":"https://api.github.com/repos/cogneco/ooc-kean/pulls/699"}}},"pull_request":{"url":"https://api.github.com/repos/cogneco/ooc-kean/pulls/699","id":49835146,"html_url":"https://github.com/cogneco/ooc-kean/pull/699","diff_url":"https://github.com/cogneco/ooc-kean/pull/699.diff","patch_url":"https://github.com/cogneco/ooc-kean/pull/699.patch","issue_url":"https://api.github.com/repos/cogneco/ooc-kean/issues/699","number":699,"state":"open","locked":false,"title":"Implemented the Quickhull algorithm for FloatConvexHull2D","user":{"login":"marcusnaslund","id":14308896,"avatar_url":"https://avatars.githubusercontent.com/u/14308896?v=3","gravatar_id":"","url":"https://api.github.com/users/marcusnaslund","html_url":"https://github.com/marcusnaslund","followers_url":"https://api.github.com/users/marcusnaslund/followers","following_url":"https://api.github.com/users/marcusnaslund/following{/other_user}","gists_url":"https://api.github.com/users/marcusnaslund/gists{/gist_id}","starred_url":"https://api.github.com/users/marcusnaslund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcusnaslund/subscriptions","organizations_url":"https://api.github.com/users/marcusnaslund/orgs","repos_url":"https://api.github.com/users/marcusnaslund/repos","events_url":"https://api.github.com/users/marcusnaslund/events{/privacy}","received_events_url":"https://api.github.com/users/marcusnaslund/received_events","type":"User","site_admin":false},"body":"`FloatConvexHull2D` now actually computes the convex hull, if asked to do so in the constructor or by calling `computeHull()`.\r\n\r\nI've set the default value to `false` to not accidentally impact performance anywhere, but I'll gladly change that if/when it's OK.\r\n\r\nFixes #562 ","created_at":"2015-11-05T15:07:28Z","updated_at":"2015-11-16T13:16:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"19038161fc04383b34c858efd44a02e006805ee7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cogneco/ooc-kean/pulls/699/commits","review_comments_url":"https://api.github.com/repos/cogneco/ooc-kean/pulls/699/comments","review_comment_url":"https://api.github.com/repos/cogneco/ooc-kean/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cogneco/ooc-kean/issues/699/comments","statuses_url":"https://api.github.com/repos/cogneco/ooc-kean/statuses/eb0f2159b2ed9fdda8c913f89e3130b0555c15c2","head":{"label":"marcusnaslund:quickhull","ref":"quickhull","sha":"eb0f2159b2ed9fdda8c913f89e3130b0555c15c2","user":{"login":"marcusnaslund","id":14308896,"avatar_url":"https://avatars.githubusercontent.com/u/14308896?v=3","gravatar_id":"","url":"https://api.github.com/users/marcusnaslund","html_url":"https://github.com/marcusnaslund","followers_url":"https://api.github.com/users/marcusnaslund/followers","following_url":"https://api.github.com/users/marcusnaslund/following{/other_user}","gists_url":"https://api.github.com/users/marcusnaslund/gists{/gist_id}","starred_url":"https://api.github.com/users/marcusnaslund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcusnaslund/subscriptions","organizations_url":"https://api.github.com/users/marcusnaslund/orgs","repos_url":"https://api.github.com/users/marcusnaslund/repos","events_url":"https://api.github.com/users/marcusnaslund/events{/privacy}","received_events_url":"https://api.github.com/users/marcusnaslund/received_events","type":"User","site_admin":false},"repo":{"id":42990201,"name":"ooc-kean","full_name":"marcusnaslund/ooc-kean","owner":{"login":"marcusnaslund","id":14308896,"avatar_url":"https://avatars.githubusercontent.com/u/14308896?v=3","gravatar_id":"","url":"https://api.github.com/users/marcusnaslund","html_url":"https://github.com/marcusnaslund","followers_url":"https://api.github.com/users/marcusnaslund/followers","following_url":"https://api.github.com/users/marcusnaslund/following{/other_user}","gists_url":"https://api.github.com/users/marcusnaslund/gists{/gist_id}","starred_url":"https://api.github.com/users/marcusnaslund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcusnaslund/subscriptions","organizations_url":"https://api.github.com/users/marcusnaslund/orgs","repos_url":"https://api.github.com/users/marcusnaslund/repos","events_url":"https://api.github.com/users/marcusnaslund/events{/privacy}","received_events_url":"https://api.github.com/users/marcusnaslund/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marcusnaslund/ooc-kean","description":"ooc port of parts of Kean.","fork":true,"url":"https://api.github.com/repos/marcusnaslund/ooc-kean","forks_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/forks","keys_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/teams","hooks_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/hooks","issue_events_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/issues/events{/number}","events_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/events","assignees_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/assignees{/user}","branches_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/branches{/branch}","tags_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/tags","blobs_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/git/refs{/sha}","trees_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/statuses/{sha}","languages_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/languages","stargazers_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/stargazers","contributors_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/contributors","subscribers_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/subscribers","subscription_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/subscription","commits_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/commits{/sha}","git_commits_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/git/commits{/sha}","comments_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/comments{/number}","issue_comment_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/issues/comments{/number}","contents_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/contents/{+path}","compare_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/merges","archive_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/downloads","issues_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/issues{/number}","pulls_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/pulls{/number}","milestones_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/milestones{/number}","notifications_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/labels{/name}","releases_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/releases{/id}","created_at":"2015-09-23T09:03:37Z","updated_at":"2015-09-23T09:03:39Z","pushed_at":"2015-11-16T13:02:04Z","git_url":"git://github.com/marcusnaslund/ooc-kean.git","ssh_url":"git@github.com:marcusnaslund/ooc-kean.git","clone_url":"https://github.com/marcusnaslund/ooc-kean.git","svn_url":"https://github.com/marcusnaslund/ooc-kean","homepage":"","size":27854,"stargazers_count":0,"watchers_count":0,"language":"ooc","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cogneco:master","ref":"master","sha":"90ee61ce17c5385365a44adc54eb83fa80a84d58","user":{"login":"cogneco","id":3601419,"avatar_url":"https://avatars.githubusercontent.com/u/3601419?v=3","gravatar_id":"","url":"https://api.github.com/users/cogneco","html_url":"https://github.com/cogneco","followers_url":"https://api.github.com/users/cogneco/followers","following_url":"https://api.github.com/users/cogneco/following{/other_user}","gists_url":"https://api.github.com/users/cogneco/gists{/gist_id}","starred_url":"https://api.github.com/users/cogneco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cogneco/subscriptions","organizations_url":"https://api.github.com/users/cogneco/orgs","repos_url":"https://api.github.com/users/cogneco/repos","events_url":"https://api.github.com/users/cogneco/events{/privacy}","received_events_url":"https://api.github.com/users/cogneco/received_events","type":"Organization","site_admin":false},"repo":{"id":25256330,"name":"ooc-kean","full_name":"cogneco/ooc-kean","owner":{"login":"cogneco","id":3601419,"avatar_url":"https://avatars.githubusercontent.com/u/3601419?v=3","gravatar_id":"","url":"https://api.github.com/users/cogneco","html_url":"https://github.com/cogneco","followers_url":"https://api.github.com/users/cogneco/followers","following_url":"https://api.github.com/users/cogneco/following{/other_user}","gists_url":"https://api.github.com/users/cogneco/gists{/gist_id}","starred_url":"https://api.github.com/users/cogneco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cogneco/subscriptions","organizations_url":"https://api.github.com/users/cogneco/orgs","repos_url":"https://api.github.com/users/cogneco/repos","events_url":"https://api.github.com/users/cogneco/events{/privacy}","received_events_url":"https://api.github.com/users/cogneco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cogneco/ooc-kean","description":"ooc port of parts of Kean.","fork":false,"url":"https://api.github.com/repos/cogneco/ooc-kean","forks_url":"https://api.github.com/repos/cogneco/ooc-kean/forks","keys_url":"https://api.github.com/repos/cogneco/ooc-kean/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cogneco/ooc-kean/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cogneco/ooc-kean/teams","hooks_url":"https://api.github.com/repos/cogneco/ooc-kean/hooks","issue_events_url":"https://api.github.com/repos/cogneco/ooc-kean/issues/events{/number}","events_url":"https://api.github.com/repos/cogneco/ooc-kean/events","assignees_url":"https://api.github.com/repos/cogneco/ooc-kean/assignees{/user}","branches_url":"https://api.github.com/repos/cogneco/ooc-kean/branches{/branch}","tags_url":"https://api.github.com/repos/cogneco/ooc-kean/tags","blobs_url":"https://api.github.com/repos/cogneco/ooc-kean/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cogneco/ooc-kean/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cogneco/ooc-kean/git/refs{/sha}","trees_url":"https://api.github.com/repos/cogneco/ooc-kean/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cogneco/ooc-kean/statuses/{sha}","languages_url":"https://api.github.com/repos/cogneco/ooc-kean/languages","stargazers_url":"https://api.github.com/repos/cogneco/ooc-kean/stargazers","contributors_url":"https://api.github.com/repos/cogneco/ooc-kean/contributors","subscribers_url":"https://api.github.com/repos/cogneco/ooc-kean/subscribers","subscription_url":"https://api.github.com/repos/cogneco/ooc-kean/subscription","commits_url":"https://api.github.com/repos/cogneco/ooc-kean/commits{/sha}","git_commits_url":"https://api.github.com/repos/cogneco/ooc-kean/git/commits{/sha}","comments_url":"https://api.github.com/repos/cogneco/ooc-kean/comments{/number}","issue_comment_url":"https://api.github.com/repos/cogneco/ooc-kean/issues/comments{/number}","contents_url":"https://api.github.com/repos/cogneco/ooc-kean/contents/{+path}","compare_url":"https://api.github.com/repos/cogneco/ooc-kean/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cogneco/ooc-kean/merges","archive_url":"https://api.github.com/repos/cogneco/ooc-kean/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cogneco/ooc-kean/downloads","issues_url":"https://api.github.com/repos/cogneco/ooc-kean/issues{/number}","pulls_url":"https://api.github.com/repos/cogneco/ooc-kean/pulls{/number}","milestones_url":"https://api.github.com/repos/cogneco/ooc-kean/milestones{/number}","notifications_url":"https://api.github.com/repos/cogneco/ooc-kean/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cogneco/ooc-kean/labels{/name}","releases_url":"https://api.github.com/repos/cogneco/ooc-kean/releases{/id}","created_at":"2014-10-15T13:42:17Z","updated_at":"2015-05-08T13:13:16Z","pushed_at":"2015-11-16T13:03:59Z","git_url":"git://github.com/cogneco/ooc-kean.git","ssh_url":"git@github.com:cogneco/ooc-kean.git","clone_url":"https://github.com/cogneco/ooc-kean.git","svn_url":"https://github.com/cogneco/ooc-kean","homepage":"","size":32829,"stargazers_count":3,"watchers_count":3,"language":"ooc","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":79,"forks":17,"open_issues":79,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cogneco/ooc-kean/pulls/699"},"html":{"href":"https://github.com/cogneco/ooc-kean/pull/699"},"issue":{"href":"https://api.github.com/repos/cogneco/ooc-kean/issues/699"},"comments":{"href":"https://api.github.com/repos/cogneco/ooc-kean/issues/699/comments"},"review_comments":{"href":"https://api.github.com/repos/cogneco/ooc-kean/pulls/699/comments"},"review_comment":{"href":"https://api.github.com/repos/cogneco/ooc-kean/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cogneco/ooc-kean/pulls/699/commits"},"statuses":{"href":"https://api.github.com/repos/cogneco/ooc-kean/statuses/eb0f2159b2ed9fdda8c913f89e3130b0555c15c2"}}}}