{"action":"created","issue":{"url":"https://api.github.com/repos/paperjs/paper.js/issues/773","labels_url":"https://api.github.com/repos/paperjs/paper.js/issues/773/labels{/name}","comments_url":"https://api.github.com/repos/paperjs/paper.js/issues/773/comments","events_url":"https://api.github.com/repos/paperjs/paper.js/issues/773/events","html_url":"https://github.com/paperjs/paper.js/issues/773","id":105789594,"number":773,"title":"Assumptions for Self Intersections of Curves are not fully reliable","user":{"login":"iconexperience","id":2122773,"avatar_url":"https://avatars.githubusercontent.com/u/2122773?v=3","gravatar_id":"","url":"https://api.github.com/users/iconexperience","html_url":"https://github.com/iconexperience","followers_url":"https://api.github.com/users/iconexperience/followers","following_url":"https://api.github.com/users/iconexperience/following{/other_user}","gists_url":"https://api.github.com/users/iconexperience/gists{/gist_id}","starred_url":"https://api.github.com/users/iconexperience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iconexperience/subscriptions","organizations_url":"https://api.github.com/users/iconexperience/orgs","repos_url":"https://api.github.com/users/iconexperience/repos","events_url":"https://api.github.com/users/iconexperience/events{/privacy}","received_events_url":"https://api.github.com/users/iconexperience/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-09-10T11:44:09Z","updated_at":"2015-09-11T10:16:18Z","closed_at":null,"body":"When checking for self intersection of a curve, the algorithm currently follows these steps:\r\n\r\n1. Check if the handles or negative handles of the curve intersect. It is assumed that curves can only self-intersect if this condition is fulfilled.\r\n2. Split the curve at <code>t=0.5</code> and check if the two curve parts intersect. A curve that self intersects always forms a loop, and the point at <code>t=0.5</code> is assumed to always lie within the loop.\r\n\r\nThis works for the vast majority (maybe more than 99.9%) of all curves. But there are actually cases, where both assumptions are not true.\r\n\r\n<a href=\"http://sketch.paperjs.org/#S/lZNNb6MwEIb/isUpkVjH30CqHlY5rbSHSj2GHFyYAgoxlXFSrar+9x1MqqRptdJayMB8vY9n4C1x9gDJOnncQ6jaJE2qoZ7eVysytsMrqY7+BClprat7GFcOGhu6E3wYUoJ3ElogL0PnArGBhHtGdelWq5P15MWGltwTB6/kAR8XbyM0B3BhXG+3POMpkbpICYsXL6g0JjeyYFoKrSSaOKeK5SJXTEQf36Vkq4xOiTJZSn7IXOCulJmL7Hbvy7vS/a+y1IJKVlwW1udCUK7ZZRVRWhiqZa4Mn3fUVbmk2uRMZVJmIsv5hCVprgQGM6k1E0Vh4vFEzgrkVlobPmncIMdeI/OETp87P4bNZEHvbDn2/Z9H6KEKUGNY8Ec4Zx66GqdxdVy66XzVw+KmFG0gPEyD+hkWOKU01limREwIcxGM7vvN0A8ey5XJwTbYNFsmZ6Xz3Pm11u/OwSLC0/gVcDoen4K3VThb5ySOQp+ibF3fBEwYHwp0DH7YwwWl8QAugpxDxL8gxPcQ4jOE+AIhriHEFwgPdUQoXTW4ccB+9UMztxl7+8sF8CMOqEPnwuHAlrQH14R2GXNKh3/Ykwe7j+pjst4mXCW7978=\">Here is an example.</a>\r\n\r\n![image](https://cloud.githubusercontent.com/assets/2122773/9787255/75283dca-57c1-11e5-8f22-1b3ccc11643a.png)\r\n\r\nAs you can see there is a small loop, but the handles do not intersect and the magenta colored point at <code>t=0.5</code> is far outside of the loop.\r\n\r\n*Note that this issue is currently merely for documentation purpose. I do not think that it causes problems in real world applications, but finally to have a perfect algorithm, this issue should be worked on.*"},"comment":{"url":"https://api.github.com/repos/paperjs/paper.js/issues/comments/139507676","html_url":"https://github.com/paperjs/paper.js/issues/773#issuecomment-139507676","issue_url":"https://api.github.com/repos/paperjs/paper.js/issues/773","id":139507676,"user":{"login":"lehni","id":213275,"avatar_url":"https://avatars.githubusercontent.com/u/213275?v=3","gravatar_id":"","url":"https://api.github.com/users/lehni","html_url":"https://github.com/lehni","followers_url":"https://api.github.com/users/lehni/followers","following_url":"https://api.github.com/users/lehni/following{/other_user}","gists_url":"https://api.github.com/users/lehni/gists{/gist_id}","starred_url":"https://api.github.com/users/lehni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lehni/subscriptions","organizations_url":"https://api.github.com/users/lehni/orgs","repos_url":"https://api.github.com/users/lehni/repos","events_url":"https://api.github.com/users/lehni/events{/privacy}","received_events_url":"https://api.github.com/users/lehni/received_events","type":"User","site_admin":false},"created_at":"2015-09-11T10:16:18Z","updated_at":"2015-09-11T10:16:18Z","body":"Well, you're not doing anything with the number of roots found before the filtering, so I guess we might as well filter them straight ahead : )\r\nSo what you used to call a 'peak' in the offestting code is actually a velocity extreme, as pointed out by @kuribas. This sounds like a useful method to have on Curve, so it can be shared by both modules later. \r\n"}}