{"action":"created","issue":{"url":"https://api.github.com/repos/cinder/Cinder/issues/1615","repository_url":"https://api.github.com/repos/cinder/Cinder","labels_url":"https://api.github.com/repos/cinder/Cinder/issues/1615/labels{/name}","comments_url":"https://api.github.com/repos/cinder/Cinder/issues/1615/comments","events_url":"https://api.github.com/repos/cinder/Cinder/issues/1615/events","html_url":"https://github.com/cinder/Cinder/pull/1615","id":183241054,"number":1615,"title":"Distance to curve.","user":{"login":"paulhoux","id":304908,"avatar_url":"https://avatars.githubusercontent.com/u/304908?v=3","gravatar_id":"","url":"https://api.github.com/users/paulhoux","html_url":"https://github.com/paulhoux","followers_url":"https://api.github.com/users/paulhoux/followers","following_url":"https://api.github.com/users/paulhoux/following{/other_user}","gists_url":"https://api.github.com/users/paulhoux/gists{/gist_id}","starred_url":"https://api.github.com/users/paulhoux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulhoux/subscriptions","organizations_url":"https://api.github.com/users/paulhoux/orgs","repos_url":"https://api.github.com/users/paulhoux/repos","events_url":"https://api.github.com/users/paulhoux/events{/privacy}","received_events_url":"https://api.github.com/users/paulhoux/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-16T00:22:50Z","updated_at":"2016-10-17T13:29:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cinder/Cinder/pulls/1615","html_url":"https://github.com/cinder/Cinder/pull/1615","diff_url":"https://github.com/cinder/Cinder/pull/1615.diff","patch_url":"https://github.com/cinder/Cinder/pull/1615.patch"},"body":"With the current attention to text rendering and signed distance fields, I thought it would be a good idea to have proper functions in Cinder that will help us calculate distances from points to lines, quadratic curves and cubic curves. There was no functionality in ```Path2d``` or ```Shape2d``` for that yet.\r\n\r\nIn this PR, I have added proper, high quality algorithms to ```CinderMath.h```. The ```getClosestPointCubic()``` method is quite involved, but compared to the implementation in Chlumsky's MSDFGEN library it is *between three and five times* faster and *much* more accurate. This will allow us to create much higher quality signed distance fields, without the need for additional libraries.\r\n\r\nNew methods in ```Path2d``` and ```Shape2d``` allow easy calculation of (signed) distances and/or finding the closest point to a shape or path.\r\n\r\nTo exercise the new functions, I have added a ```ShapeTest``` application to the test folder. It is similar to the ```Triangulation``` sample, but it focuses on distance calculations instead. \r\n\r\nLet me know what you think."},"comment":{"url":"https://api.github.com/repos/cinder/Cinder/issues/comments/254207352","html_url":"https://github.com/cinder/Cinder/pull/1615#issuecomment-254207352","issue_url":"https://api.github.com/repos/cinder/Cinder/issues/1615","id":254207352,"user":{"login":"paulhoux","id":304908,"avatar_url":"https://avatars.githubusercontent.com/u/304908?v=3","gravatar_id":"","url":"https://api.github.com/users/paulhoux","html_url":"https://github.com/paulhoux","followers_url":"https://api.github.com/users/paulhoux/followers","following_url":"https://api.github.com/users/paulhoux/following{/other_user}","gists_url":"https://api.github.com/users/paulhoux/gists{/gist_id}","starred_url":"https://api.github.com/users/paulhoux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulhoux/subscriptions","organizations_url":"https://api.github.com/users/paulhoux/orgs","repos_url":"https://api.github.com/users/paulhoux/repos","events_url":"https://api.github.com/users/paulhoux/events{/privacy}","received_events_url":"https://api.github.com/users/paulhoux/received_events","type":"User","site_admin":false},"created_at":"2016-10-17T13:29:16Z","updated_at":"2016-10-17T13:29:16Z","body":"I was able to optimize the code a bit more and it now runs in 9.6secs compared to 15secs earlier."}}
{"actor":{"display_login":"paulhoux"}}