You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Soften the arcball edge using a 'border' parameter
- revise _arcball() to soften the edge, according to border width parameter
- drop _arcball() 'style' function parameter
- add trackballborder rcParam
- _arcball() 'border' case: normalize, so result vector is on unit sphere
- math.sin/cos/sqrt -> np.sin/cos/sqrt: use numpy instead of math for consistency
- remove 'Bell' style
- rename arcball -> sphere, Shoemake -> arcball
- update documentation
- update test
Copy file name to clipboardExpand all lines: doc/api/toolkits/mplot3d/view_angles.rst
+34-28Lines changed: 34 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,23 +70,20 @@ move the mouse in circles with a handedness opposite to the desired rotation,
70
70
counterintuitively.
71
71
72
72
A different variety of trackball rotates along the shortest arc on the virtual
73
-
sphere (``mouserotationstyle: arcball``); it is a variation on Ken Shoemake's
74
-
ARCBALL [Shoemake1992]_. Rotating around the viewing direction is straightforward
75
-
with it (grab the ball near its edge instead of near the center).
73
+
sphere (``mouserotationstyle: sphere``). Rotating around the viewing direction
74
+
is straightforward with it: grab the ball near its edge instead of near the center.
76
75
77
-
Shoemake's original arcball is also available (``mouserotationstyle: Shoemake``);
78
-
it is free of hysteresis, i.e., returning mouse to the original position
79
-
returns the figure to its original orientation, the rotation is independent
76
+
Ken Shoemake's ARCBALL [Shoemake1992]_ is also available (``mouserotationstyle: Shoemake``);
77
+
it resembles the ``sphere`` style, but is free of hysteresis,
78
+
i.e., returning mouse to the original position
79
+
returns the figure to its original orientation; the rotation is independent
80
80
of the details of the path the mouse took, which could be desirable.
81
81
However, Shoemake's arcball rotates at twice the angular rate of the
82
82
mouse movement (it is quite noticeable, especially when adjusting roll),
83
-
and it lacks an obvious mechanical equivalent; arguably, the path-independent rotation is unnatural.
83
+
and it lacks an obvious mechanical equivalent; arguably, the path-independent
84
+
rotation is not natural (however convenient), it could take some getting used to.
84
85
So it is a trade-off.
85
86
86
-
Shoemake's arcball has an abrupt edge; this is remedied in Gavin Bell's arcball
87
-
(``mouserotationstyle: Bell``), originally written for OpenGL [Bell1988]_. It is used
88
-
in Blender and Meshlab.
89
-
90
87
Henriksen et al. [Henriksen2002]_ provide an overview. In summary:
91
88
92
89
.. list-table::
@@ -111,19 +108,13 @@ Henriksen et al. [Henriksen2002]_ provide an overview. In summary:
111
108
- ✔️
112
109
- ❌
113
110
- ✔️
114
-
* - arcball
111
+
* - sphere
115
112
- ❌
116
113
- ✔️
117
114
- ✔️
118
115
- ❌
119
116
- ✔️
120
-
* - Shoemake
121
-
- ❌
122
-
- ✔️
123
-
- ✔️
124
-
- ✔️
125
-
- ❌
126
-
* - Bell
117
+
* - arcball
127
118
- ❌
128
119
- ✔️
129
120
- ✔️
@@ -134,16 +125,16 @@ Henriksen et al. [Henriksen2002]_ provide an overview. In summary:
134
125
.. [1] The way it was prior to v3.10; this is also MATLAB's style
135
126
.. [2] Mouse controls roll too (not only azimuth and elevation)
136
127
.. [3] Figure reacts the same way to mouse movements, regardless of orientation (no difference between 'poles' and 'equator')
137
-
.. [4] Returning mouse to original position returns figure to original orientation (no hysteresis: rotation is independent of the details of the path the mouse took)
128
+
.. [4] Returning mouse to original position returns figure to original orientation (rotation is independent of the details of the path the mouse took)
138
129
.. [5] The style has a corresponding natural implementation as a mechanical device
139
-
.. [6] While it is possible to control roll with the ``trackball`` style, this is not very intuitive (it requires moving the mouse in large circles) and the resulting roll is in the opposite direction
130
+
.. [6] While it is possible to control roll with the ``trackball`` style, this is not immediately obvious (it requires moving the mouse in large circles) and a bit counterintuitive (the resulting roll is in the opposite direction)
140
131
141
132
You can try out one of the various mouse rotation styles using::
142
133
143
134
.. code::
144
135
145
136
import matplotlib as mpl
146
-
mpl.rcParams['axes3d.mouserotationstyle'] = 'trackball' # 'azel', 'trackball', 'arcball', 'Shoemake', or 'Bell'
137
+
mpl.rcParams['axes3d.mouserotationstyle'] = 'trackball' # 'azel', 'trackball', 'sphere', or 'arcball'
147
138
148
139
import numpy as np
149
140
import matplotlib.pyplot as plt
@@ -169,22 +160,37 @@ Alternatively, create a file ``matplotlibrc``, with contents::
169
160
(or any of the other styles, instead of ``arcball``), and then run any of
170
161
the :ref:`mplot3d-examples-index` examples.
171
162
172
-
The size of the virtual trackballor arcball can be adjusted as well,
163
+
The size of the virtual trackball, sphere, or arcball can be adjusted
173
164
by setting :rc:`axes3d.trackballsize`. This specifies how much
174
165
mouse motion is needed to obtain a given rotation angle (when near the center),
175
-
and it controls where the edge of the arcball is (how far from the center,
176
-
how close to the plot edge).
166
+
and it controls where the edge of the sphere or arcball is (how far from
167
+
the center, hence how close to the plot edge).
177
168
The size is specified in units of the Axes bounding box,
178
-
i.e., to make the trackball span the whole bounding box, set it to 1.
169
+
i.e., to make the arcball span the whole bounding box, set it to 1.
179
170
A size of about 2/3 appears to work reasonably well; this is the default.
180
171
181
-
----
172
+
Both arcballs (``mouserotationstyle: sphere`` and
173
+
``mouserotationstyle: arcball``) have a noticeable edge; the edge can be made
174
+
less abrupt by specifying a border width, :rc:`axes3d.trackballborder`.
175
+
This works somewhat like Gavin Bell's arcball, which was
176
+
originally written for OpenGL [Bell1988]_, and is used in Blender and Meshlab.
177
+
Bell's arcball extends the arcball's spherical control surface with a hyperbola;
178
+
the two are smoothly joined. However, the hyperbola extends all the way beyond
179
+
the edge of the plot. In the mplot3d sphere and arcball style, the border extends
180
+
to a radius :rc:`axes3d.trackballsize`/2 + :rc:`axes3d.trackballborder`.
181
+
Beyond the border, the style works like the original: it controls roll only.
182
+
A border width of about 0.2 appears to work well; this is the default.
183
+
To obtain the original Shoemake's arcball with a sharp border,
184
+
set the border width to 0.
185
+
For an extended border similar to Bell's arcball, where the transition from
186
+
the arcball to the border occurs at 45°, set the border width to
187
+
$\sqrt 2 \approx 1.414$.
188
+
182
189
183
190
.. [Shoemake1992] Ken Shoemake, "ARCBALL: A user interface for specifying
184
191
three-dimensional rotation using a mouse", in Proceedings of Graphics
185
192
Interface '92, 1992, pp. 151-156, https://doi.org/10.20380/GI1992.18
186
193
187
-
188
194
.. [Bell1988] Gavin Bell, in the examples included with the GLUT (OpenGL
0 commit comments