{"action":"created","issue":{"url":"https://api.github.com/repos/opentoonz/opentoonz/issues/432","repository_url":"https://api.github.com/repos/opentoonz/opentoonz","labels_url":"https://api.github.com/repos/opentoonz/opentoonz/issues/432/labels{/name}","comments_url":"https://api.github.com/repos/opentoonz/opentoonz/issues/432/comments","events_url":"https://api.github.com/repos/opentoonz/opentoonz/issues/432/events","html_url":"https://github.com/opentoonz/opentoonz/pull/432","id":159602342,"number":432,"title":"[WIP] Brush stroke stabilizer.","user":{"login":"walkerka","id":10047040,"avatar_url":"https://avatars.githubusercontent.com/u/10047040?v=3","gravatar_id":"","url":"https://api.github.com/users/walkerka","html_url":"https://github.com/walkerka","followers_url":"https://api.github.com/users/walkerka/followers","following_url":"https://api.github.com/users/walkerka/following{/other_user}","gists_url":"https://api.github.com/users/walkerka/gists{/gist_id}","starred_url":"https://api.github.com/users/walkerka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/walkerka/subscriptions","organizations_url":"https://api.github.com/users/walkerka/orgs","repos_url":"https://api.github.com/users/walkerka/repos","events_url":"https://api.github.com/users/walkerka/events{/privacy}","received_events_url":"https://api.github.com/users/walkerka/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/opentoonz/opentoonz/labels/UI","name":"UI","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2016-06-10T10:08:07Z","updated_at":"2016-06-20T14:53:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/opentoonz/opentoonz/pulls/432","html_url":"https://github.com/opentoonz/opentoonz/pull/432","diff_url":"https://github.com/opentoonz/opentoonz/pull/432.diff","patch_url":"https://github.com/opentoonz/opentoonz/pull/432.patch"},"body":"This is a WIP brush stroke stabilizer. Original from my GPU based anime editor.\r\nSee discussion in:[#81](https://github.com/opentoonz/opentoonz/issues/81)\r\n\r\nDemo:\r\n\r\n![demo](https://raw.githubusercontent.com/walkerka/anim_builder/master/doc/OTSmooth.jpg)\r\n[https://www.youtube.com/watch?v=yDV8ketAzCI&feature=youtu.be](https://www.youtube.com/watch?v=yDV8ketAzCI&feature=youtu.be)\r\n\r\nHere's the original full realtime one. Users have better control but it relies on fast stroke rendering backend. I did some optimization to make it work better in OT.\r\n[https://youtu.be/u1iAOpjN84E](https://youtu.be/u1iAOpjN84E)\r\n\r\nThe stabilizer logic is almost done but there're some issues:\r\n\r\n1. I use \"accuracy\" value in tool option bar as smooth range for now. I also removed the extra smoothing step when stroke is done (by using a hardcoded accuracy value 100). I need to add a new control for the smooth range and leave accuracy logic unchanged.\r\n\r\n2. It sometimes crashes when I finish the stroke. The cause is assert failure\r\nIn\r\n[https://github.com/opentoonz/opentoonz/blob/master/toonz/sources/common/tvectorimage/tstroke.cpp#L3578](https://github.com/opentoonz/opentoonz/blob/master/toonz/sources/common/tvectorimage/tstroke.cpp#L3578)\r\n\r\nThe assert fails because \"cs_sign\" is less than 0. \r\n  assert(!(cs_sign < 0) || acos(-sqrt(cs2)) > 10 * TConsts::pi_180);\r\n\r\nIt looks OT converts strokes to quadratic splines before rendering. I don't quite understand the algorithm of this function so if anyone is familar with it. Please tell me how to avoid the wrong input. \r\n\r\nBTW, after I removed this assert, OT still works well. I added log for this and it happened 4 times when I was drawing. Is this assert really important?\r\n\r\nWhen it crashes, input parameters are:\r\n\r\ncubic\r\n\r\n    m_p0 {x=-96.292728088119091 y=-139.08880919302925 } TPointT\r\n    m_p1 {x=-95.989899503066681 y=-137.57465707825921 } TPointT\r\n    m_p2 {x=-95.687068583438844 y=-136.06050543039282 } TPointT\r\n    m_p3 {x=-95.384237031318179 y=-134.54635390902470 } TPointT\r\n\r\nerror\r\n\r\n2.0000000000000000 double\r\n"},"comment":{"url":"https://api.github.com/repos/opentoonz/opentoonz/issues/comments/227166285","html_url":"https://github.com/opentoonz/opentoonz/pull/432#issuecomment-227166285","issue_url":"https://api.github.com/repos/opentoonz/opentoonz/issues/432","id":227166285,"user":{"login":"kogaki","id":17926501,"avatar_url":"https://avatars.githubusercontent.com/u/17926501?v=3","gravatar_id":"","url":"https://api.github.com/users/kogaki","html_url":"https://github.com/kogaki","followers_url":"https://api.github.com/users/kogaki/followers","following_url":"https://api.github.com/users/kogaki/following{/other_user}","gists_url":"https://api.github.com/users/kogaki/gists{/gist_id}","starred_url":"https://api.github.com/users/kogaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kogaki/subscriptions","organizations_url":"https://api.github.com/users/kogaki/orgs","repos_url":"https://api.github.com/users/kogaki/repos","events_url":"https://api.github.com/users/kogaki/events{/privacy}","received_events_url":"https://api.github.com/users/kogaki/received_events","type":"User","site_admin":false},"created_at":"2016-06-20T14:53:55Z","updated_at":"2016-06-20T14:53:55Z","body":"@walkerka Ah sorry, I missed that point because I coudn't reproduce the crash. But with looking at the code, I feel it must be a redundant assertion. Because following if statement will do almost the same and even more assertion in the if statement. And more, if statement seems works more correctly. That means split cubic bezier into more number of quadratic bezier until it reaches good estimation while assertion let program crashes too early.\r\n\r\nLet's remove the stressful assertion :)"}}
{"actor":{"display_login":"kogaki"}}