discretize.utils.rotation_matrix_from_normals(v0, v1, tol=1e-20)[source]

Performs the minimum number of rotations to define a rotation from the direction indicated by the vector n0 to the direction indicated by n1. The axis of rotation is n0 x n1 https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula

  • v0 (numpy.array) – vector of length 3

  • v1 (numpy.array) – vector of length 3

  • = 1e-20 (tol) – tolerance. If the norm of the cross product between the two vectors is below this, no rotation is performed

Return type

numpy.array, 3x3


rotation matrix which rotates the frame so that n0 is aligned with n1