MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _view_axes

Function _view_axes

lib/mpl_toolkits/mplot3d/proj3d.py:49–85  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

47
48
49def _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
88def _view_transformation_uvw(u, v, w, E):

Callers

nothing calls this directly

Calls 3

_rotation_about_vectorFunction · 0.85
dotMethod · 0.80
normMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…