Get the unit viewing axes in data coordinates. Parameters ---------- E : 3-element numpy array The coordinates of the eye/camera. R : 3-element numpy array The coordinates of the center of the view box. V : 3-element numpy array Unit vector in the di
(E, R, V, roll)
| 47 | |
| 48 | |
| 49 | def _view_axes(E, R, V, roll): |
| 50 | """ |
| 51 | Get the unit viewing axes in data coordinates. |
| 52 | |
| 53 | Parameters |
| 54 | ---------- |
| 55 | E : 3-element numpy array |
| 56 | The coordinates of the eye/camera. |
| 57 | R : 3-element numpy array |
| 58 | The coordinates of the center of the view box. |
| 59 | V : 3-element numpy array |
| 60 | Unit vector in the direction of the vertical axis. |
| 61 | roll : float |
| 62 | The roll angle in radians. |
| 63 | |
| 64 | Returns |
| 65 | ------- |
| 66 | u : 3-element numpy array |
| 67 | Unit vector pointing towards the right of the screen. |
| 68 | v : 3-element numpy array |
| 69 | Unit vector pointing towards the top of the screen. |
| 70 | w : 3-element numpy array |
| 71 | Unit vector pointing out of the screen. |
| 72 | """ |
| 73 | w = (E - R) |
| 74 | w = w/np.linalg.norm(w) |
| 75 | u = np.cross(V, w) |
| 76 | u = u/np.linalg.norm(u) |
| 77 | v = np.cross(w, u) # Will be a unit vector |
| 78 | |
| 79 | # Save some computation for the default roll=0 |
| 80 | if roll != 0: |
| 81 | # A positive rotation of the camera is a negative rotation of the world |
| 82 | Rroll = _rotation_about_vector(w, -roll) |
| 83 | u = np.dot(Rroll, u) |
| 84 | v = np.dot(Rroll, v) |
| 85 | return u, v, w |
| 86 | |
| 87 | |
| 88 | def _view_transformation_uvw(u, v, w, E): |
nothing calls this directly
no test coverage detected
searching dependent graphs…