-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gimbal lock issue #194
Comments
d3-geo doesn’t implement interactive rotation, so the concept of gimbal lock doesn’t really apply. Please see these examples of dragging using versors: https://observablehq.com/@d3/versor-dragging |
The mentioned issue happens in the examples you mentioned. Add a line of code I'm almost certain this is due to a Gimbal lock, as two axes are aligned and therefore the mouse input rotates both axes, in opposite ways, at the same time, causing the weird behaviour |
Suggestions are welcome on the notebook! |
And where might that be? |
The instability comes from the computation of Euler angles from the versor: We can fix it by switching to I'll push the changes tomorrow—a complication is that we have 3 versions floating around (versor 0.0.3, 0.1, and attitude). The issue in any case belongs to those projects not to d3-geo. |
Ok thank you very much |
@Fil Would you mind moving that repo into the D3 org so I can contribute? |
The fix I proposed earlier was not exact, it only stops the jumps but doesn't return the correct angles. Now I think I've managed to fix the North Pole rotations, but for the South Pole there is another issue—it looks like the versor we create from the angles is wrong. So I'm not sure I'll be able to solve this today! (Note: I work on the attitude code base rather than versor.) |
fixes d3/d3-geo#194 closes #5
I've just fixed it in the attitude module, as you can verify at Surprisingly, the issue was different for the north polar and south polar rotations! In one case it was the way we transformed euler angles into a versor that was buggy; in the other it was the way around. |
It is inevitable that there are some singularities in the values of Euler angles for certain rotations. Shuster’s 1993 review of attitude representations has a nice discussion: https://scholar.google.com/scholar?cluster=7745064288898196753 (scroll down to the bottom half of page 460) Of course, for the purpose of just drawing a globe, as long as the rotations are nearby and accurately converted to some Euler angle representation, then the output images should also be nearby, even if there are sometimes discontinuous jumps in the intermediate parameters. Has there been any consideration of adding an ability to d3-geo to rotate points by passing in a quaternion or similar rotation representation, instead of only the z-x-y flavor of Euler angles? |
I’d be opening to changing the internal representation as long as it’s backwards-compatible. |
d3-geo uses Euler rotation angles, which means Gimbal locks can occur. This means that, depending on the rotation of the globe visualization, the rotation will start being weird. In the case of an orthographic projection, this happens at either pole of the globe. An example of this issue can be seen here, on a globe that uses d3 geo.
I would personally suggest using unit quaternions (versors) instead of Euler angles, as they would solve this issue.
The text was updated successfully, but these errors were encountered: