Skip to content

rodrigues

esta.general.rodrigues

get_rotation_matrix_rodrigues_vec_axis(input_uvec, required_uvec_direction=None)

rotate a vector about an arbitray axis by some angle theta so as to align it along x/y/z axis by using Rodrigues's formula

Or find the rotation matrix using Rodrigues formula (both points are same!!)

Parameters:

  • input_uvec

    3D unit vector (non-unit vector should also work, e.g. for the case of atomic positions)

  • required_uvec_direction

    required unit vector direction, default is x-axis

Returns:

  • R ( array of rank2 ) –

    rotation matrix for rotating the input_vec along the input direction

  • ----------------
  • The Rodrigues rotation formula gives us the following way to rotate a vector v⃗ by some angle θ about an arbitrary axis k⃗
  • v⃗ rot=v⃗ cos(θ)+(k⃗ ×v⃗ )sin(θ)+k⃗ (k⃗ ⋅v⃗ )(1−cosθ)
  • Let's call this the "vector notation" There is also a way to obtain the corresponding rotation matrix R
  • , as such:
  • R=I+(sinθ)K+(1−cosθ)K2
  • v⃗ rot=Rv⃗
  • where K
  • is the cross-product matrix of the rotation axis:
  • K=⎛⎝⎜0kz−ky−kz0kxky−kx0⎞⎠⎟
  • See here: https://math.stackexchange.com/questions/2828802/angle-definition-confusion-in-rodrigues-rotation-matrix

get_rotation_matrix_rodrigues_vectors(vec1, vec2)

Get a rotation matrix which rotates vec1 onto vec2 with the help of Euler-Rodrigues'rotation formula. This method is somewhat more general than the get_rotation_matrix_rodrigues_vec_axis method

..note:: See the question on SO: Calculate Rotation Matrix to align Vector A to Vector B in 3D? https://math.stackexchange.com/questions/180418/calculate-rotation-matrix-to-align-vector-a-to-vector-b-in-3d/476311#476311

Parameters:

vec1 : array 3d array, initial pt in 3D space vec2 : array 3d array target pt after rotation in 3d space

Returns:

rot_mat : array of rank 2 (matrix) Rotation matrix which transforms vec1 into vec2