{"action":"created","issue":{"url":"https://api.github.com/repos/cinder/Cinder/issues/1411","repository_url":"https://api.github.com/repos/cinder/Cinder","labels_url":"https://api.github.com/repos/cinder/Cinder/issues/1411/labels{/name}","comments_url":"https://api.github.com/repos/cinder/Cinder/issues/1411/comments","events_url":"https://api.github.com/repos/cinder/Cinder/issues/1411/events","html_url":"https://github.com/cinder/Cinder/pull/1411","id":145387883,"number":1411,"title":"Add methods to determine orientation of PolyLine","user":{"login":"drewish","id":68750,"avatar_url":"https://avatars.githubusercontent.com/u/68750?v=3","gravatar_id":"","url":"https://api.github.com/users/drewish","html_url":"https://github.com/drewish","followers_url":"https://api.github.com/users/drewish/followers","following_url":"https://api.github.com/users/drewish/following{/other_user}","gists_url":"https://api.github.com/users/drewish/gists{/gist_id}","starred_url":"https://api.github.com/users/drewish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewish/subscriptions","organizations_url":"https://api.github.com/users/drewish/orgs","repos_url":"https://api.github.com/users/drewish/repos","events_url":"https://api.github.com/users/drewish/events{/privacy}","received_events_url":"https://api.github.com/users/drewish/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cinder/Cinder/labels/geom","name":"geom","color":"000000"}],"state":"open","locked":false,"assignee":{"login":"andrewfb","id":227107,"avatar_url":"https://avatars.githubusercontent.com/u/227107?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewfb","html_url":"https://github.com/andrewfb","followers_url":"https://api.github.com/users/andrewfb/followers","following_url":"https://api.github.com/users/andrewfb/following{/other_user}","gists_url":"https://api.github.com/users/andrewfb/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewfb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewfb/subscriptions","organizations_url":"https://api.github.com/users/andrewfb/orgs","repos_url":"https://api.github.com/users/andrewfb/repos","events_url":"https://api.github.com/users/andrewfb/events{/privacy}","received_events_url":"https://api.github.com/users/andrewfb/received_events","type":"User","site_admin":false},"assignees":[{"login":"andrewfb","id":227107,"avatar_url":"https://avatars.githubusercontent.com/u/227107?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewfb","html_url":"https://github.com/andrewfb","followers_url":"https://api.github.com/users/andrewfb/followers","following_url":"https://api.github.com/users/andrewfb/following{/other_user}","gists_url":"https://api.github.com/users/andrewfb/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewfb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewfb/subscriptions","organizations_url":"https://api.github.com/users/andrewfb/orgs","repos_url":"https://api.github.com/users/andrewfb/repos","events_url":"https://api.github.com/users/andrewfb/events{/privacy}","received_events_url":"https://api.github.com/users/andrewfb/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-04-02T16:01:05Z","updated_at":"2016-10-18T15:21:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cinder/Cinder/pulls/1411","html_url":"https://github.com/cinder/Cinder/pull/1411","diff_url":"https://github.com/cinder/Cinder/pull/1411.diff","patch_url":"https://github.com/cinder/Cinder/pull/1411.patch"},"body":"I'd been using [CGAL's Polygon_2](http://doc.cgal.org/latest/Polygon/classCGAL_1_1Polygon__2.html) to determine the orientation but realized the math isn't that complicated and would be a nice addition to the PolyLine class.\r\n\r\nThe algorithm is based of this answer the [FAQ for comp.graphics.algorithms](http://www.faqs.org/faqs/graphics/algorithms-faq/):\r\n\r\n    Subject 2.07: How do I find the orientation of a simple polygon?\r\n\r\n    Compute the signed area (Subject 2.01).  The orientation is \r\n    counter-clockwise if this area is positive.  \r\n\r\n    A slightly faster method is based on the observation that it isn't\r\n    necessary to compute the area.  Find the lowest vertex (or, if \r\n    there is more than one vertex with the same lowest coordinate, \r\n    the rightmost of those vertices) and then take the cross product \r\n    of the edges fore and aft of it.  Both methods are O(n) for n vertices, \r\n    but it does seem a waste to add up the total area when a single cross\r\n    product (of just the right edges) suffices.  Code for this is\r\n    available at ftp://cs.smith.edu/pub/code/polyorient.C (2K).\r\n\r\n    The reason that the lowest, rightmost (or any other such extreme) point\r\n    works is that the internal angle at this vertex is necessarily convex, \r\n    strictly less than pi (even if there are several equally-lowest points).\r\n\r\nAnd some other details I found on the [Wikipedia Curve orientation page](https://en.wikipedia.org/wiki/Curve_orientation).\r\n\r\nThe code is kind of klunky but works well. It includes some basic unit tests."},"comment":{"url":"https://api.github.com/repos/cinder/Cinder/issues/comments/254542027","html_url":"https://github.com/cinder/Cinder/pull/1411#issuecomment-254542027","issue_url":"https://api.github.com/repos/cinder/Cinder/issues/1411","id":254542027,"user":{"login":"drewish","id":68750,"avatar_url":"https://avatars.githubusercontent.com/u/68750?v=3","gravatar_id":"","url":"https://api.github.com/users/drewish","html_url":"https://github.com/drewish","followers_url":"https://api.github.com/users/drewish/followers","following_url":"https://api.github.com/users/drewish/following{/other_user}","gists_url":"https://api.github.com/users/drewish/gists{/gist_id}","starred_url":"https://api.github.com/users/drewish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewish/subscriptions","organizations_url":"https://api.github.com/users/drewish/orgs","repos_url":"https://api.github.com/users/drewish/repos","events_url":"https://api.github.com/users/drewish/events{/privacy}","received_events_url":"https://api.github.com/users/drewish/received_events","type":"User","site_admin":false},"created_at":"2016-10-18T15:21:58Z","updated_at":"2016-10-18T15:21:58Z","body":"I'd just followed the pattern that CGAL was using so I'm happy to make those changes. Feel free to point out any other spots with formatting issues."}}
{"actor":{"display_login":"drewish"}}