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

Function _rotation_about_vector

lib/mpl_toolkits/mplot3d/proj3d.py:32–46  ·  view source on GitHub ↗

Produce a rotation matrix for an angle in radians about a vector.

(v, angle)

Source from the content-addressed store, hash-verified

30
31
32def _rotation_about_vector(v, angle):
33 """
34 Produce a rotation matrix for an angle in radians about a vector.
35 """
36 vx, vy, vz = v / np.linalg.norm(v)
37 s = np.sin(angle)
38 c = np.cos(angle)
39 t = 2*np.sin(angle/2)**2 # more numerically stable than t = 1-c
40
41 R = np.array([
42 [t*vx*vx + c, t*vx*vy - vz*s, t*vx*vz + vy*s],
43 [t*vy*vx + vz*s, t*vy*vy + c, t*vy*vz - vx*s],
44 [t*vz*vx - vy*s, t*vz*vy + vx*s, t*vz*vz + c]])
45
46 return R
47
48
49def _view_axes(E, R, V, roll):

Callers 1

_view_axesFunction · 0.85

Calls 1

normMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…