{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/7430","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/7430/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/7430/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/7430/events","html_url":"https://github.com/mrdoob/three.js/pull/7430","id":113162911,"number":7430,"title":"Math: Less mormalization error in Quaternion.slerp.","user":{"login":"tschw","id":3916357,"avatar_url":"https://avatars.githubusercontent.com/u/3916357?v=3","gravatar_id":"","url":"https://api.github.com/users/tschw","html_url":"https://github.com/tschw","followers_url":"https://api.github.com/users/tschw/followers","following_url":"https://api.github.com/users/tschw/following{/other_user}","gists_url":"https://api.github.com/users/tschw/gists{/gist_id}","starred_url":"https://api.github.com/users/tschw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschw/subscriptions","organizations_url":"https://api.github.com/users/tschw/orgs","repos_url":"https://api.github.com/users/tschw/repos","events_url":"https://api.github.com/users/tschw/events{/privacy}","received_events_url":"https://api.github.com/users/tschw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-24T14:13:58Z","updated_at":"2015-10-24T23:52:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mrdoob/three.js/pulls/7430","html_url":"https://github.com/mrdoob/three.js/pull/7430","diff_url":"https://github.com/mrdoob/three.js/pull/7430.diff","patch_url":"https://github.com/mrdoob/three.js/pull/7430.patch"},"body":"Currently `.slerp` produces a high normalization error (at least on glibc/Linux) that stems from the `acos` function. Changing it to use `atan2` (a more frequently used function) yields an error within the range of one epsilon. It also appears to be faster, but I didn't measure it thoroughly enough to guarantee that.\r\n\r\nBased on the `Animation` branch, since it introduces the unit test that revealed the problem."},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/150872776","html_url":"https://github.com/mrdoob/three.js/pull/7430#issuecomment-150872776","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/7430","id":150872776,"user":{"login":"WestLangley","id":1000017,"avatar_url":"https://avatars.githubusercontent.com/u/1000017?v=3","gravatar_id":"","url":"https://api.github.com/users/WestLangley","html_url":"https://github.com/WestLangley","followers_url":"https://api.github.com/users/WestLangley/followers","following_url":"https://api.github.com/users/WestLangley/following{/other_user}","gists_url":"https://api.github.com/users/WestLangley/gists{/gist_id}","starred_url":"https://api.github.com/users/WestLangley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WestLangley/subscriptions","organizations_url":"https://api.github.com/users/WestLangley/orgs","repos_url":"https://api.github.com/users/WestLangley/repos","events_url":"https://api.github.com/users/WestLangley/events{/privacy}","received_events_url":"https://api.github.com/users/WestLangley/received_events","type":"User","site_admin":false},"created_at":"2015-10-24T23:52:46Z","updated_at":"2015-10-24T23:52:46Z","body":"> I was referring to this one in my previous post, and apparently you have met.\r\n\r\nSorry, I do not understand what you are saying in this sentence.\r\n\r\n> in itself [acos is] not a problem.\r\n\r\nOK, based on your discussion above, I will not pursue this further.\r\n\r\nAside: You likely have discovered this, but I'll state it for the record. By convention, three.js does not, in general, check arguments. So, for example, direction vectors are assumed to be of unit length, as are rotational axes. Quaternions are also assumed to be of unit length. So for `slerp()` to work correctly, the inputs must be of unit length. I am not sure if we check for unit quaternions when loading models. Maybe we should. Also, in the case of `slerp()`, I see it does not normalize its output, since in theory at least, normalization is not required -- and of course, doing so is extra computation.\r\n\r\n---\r\n\r\n> I've been wondering whether it would be easier / cleaner to just have an EulerView that compares the quaternion against a copy to know whether it's in sync.\r\n\r\nHehe. You are hijacking your own post. I gues you are allowed to do that. : - )\r\n\r\nYes, yes. It would be great if the `Euler/Quaternion` synchronization could be revisited. I am not sure how much of a computational load it induces, but there is clearly a lot of synchronization going on.\r\n\r\nTo express the issue another way, I like to say: \"three.js is quaternion-based; Euler rotations are provided for user-convenience.\" So, in light of that view, yes, perhaps `object.rotation` could be lazily updated -- updated only when accessed. That is, allowed to get out-of-sync.\r\n\r\nComparing with a known value sounds like an efficient approach, in any event. And by that, I assume you mean that `rotation` keeps a copy of the last value of the `quaternion` it is synchronized to.\r\n\r\n\r\n"}}