3D Rotations using Rodrigues Rotation Formula

The problem we are addressing here is the rotation of a general 3D vector v about a given axis of rotation denoted by \hat{n} by \theta radians.

The Rodrigues Rotation Formula is as follows:

v^{'} = (1-\cos(\theta))(v.\hat{n})\hat{n} + \cos(\theta) v + \sin(\theta)(\hat{n}\times v)

Example: for a sanity check we can consider \theta=0 that will result in

v^{'} = (1-\cos(0))(v.\hat{n})\hat{n} + \cos(0) v + \sin(0)(\hat{n}\times v) = v

Example:

Rotate v=[2,0,0] about \hat{n}=[0,0,1] by \theta = \pi/2.

import numpy as np
v = np.array([2.,0.,0.])
n = np.array([0.,0.,1.])
theta = np.pi/2
vp = (1-np.cos(theta))*(np.dot(v,n))*n + np.cos(theta)*v + np.sin(theta)*(np.cross(n,v))
>>> vp
array([1.2246468e-16, 2.0000000e+00, 0.0000000e+00])

 

 

 

About machinelearning1

This weblog is about Machine Learning and all related topics that one needs to challenge real world with artificial intelligence.
This entry was posted in Machine Learning, Robotics and tagged , , , , , , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a comment