mrdoob/three.js — pull request #4769 by lpsinger (2014-05-05 20:41:38+00:00)
Title: Orbitcontrols locking near poles

OrbitControls update condition should check offset and orientation

`OrbitControls` only checks the camera position offset to decide when to
emit a `change` event. When the camera is near either pole and the user
is rotating in azimuth, the position changes very little while the
camera orientation changes a lot. As a result, the view feels 'stuck' in
azimuth near the poles.

This patch modifies the camera update condition to take into account
both the change in offset and orientation between `change` events. The
update condition is now:

(camera displacement)^2 + (camera rotation in radians)^2 > EPS

The additional term is computed from the dot product of the camera's
orientation quaternion at consecutive time steps:

8 * (1 - q.r)

The second-order Taylor expansion of this expression is the square of
the camera rotation angle between frames.