[frames] | no frames]

# Module rotax

source code

This file contains the following functions, rotax mat_to_quat mat_to_axis_angle inverse4X4 rotVectToVect interpolate3DTransform

 Functions
` ` rotax(a, b, tau, transpose=1)
Build 4x4 matrix of clockwise rotation about axis a-->b by angle tau (radians).
` ` rotVectToVect(vect1, vect2, i=None)
returns a 4x4 transformation that will align vect1 with vect2 vect1 and vect2 can be any vector (non-normalized)
` ` mat_to_quat(matrix, transpose=1)
takes a four by four matrix (optionally with shape (16,) and converts it into the axis of rotation and angle to rotate by (x,y,z,theta).
` ` inverse4X4(matrix)
returns the inverse of the given 4x4 transformation matrix t_1: the negetive of Translation vector r_1: the inverse of rotation matrix
` ` mat_to_axis_angle(matrix)
...
` ` interpolate3DTransform(matrixList, indexList, percent)
This function gets input of two list and a percent value.
` ` interpolate3DTransform1(matrixList, indexList, percent)
` ` _interpolateMat(mat, percent)
called only by interpolate3DTransform()

 Variables
` ` degtorad = `0.017453292519943295`

 Function Details

### rotax(a, b, tau, transpose=1)

source code
Build 4x4 matrix of clockwise rotation about axis a-->b by angle tau (radians). a and b are sequences of 3 floats each Result is a homogenous 4x4 transformation matrix. NOTE: This has been changed by Brian, 8/30/01: rotax now returns the rotation matrix, _not_ the transpose. This is to get consistency across rotax, mat_to_quat and the classes in transformation.py when transpose is 1 (default) a C-style rotation matrix is returned i.e. to be used is the following way Mx (opposite of OpenGL style which is using the FORTRAN style)

### rotVectToVect(vect1, vect2, i=None)

source code
returns a 4x4 transformation that will align vect1 with vect2 vect1 and vect2 can be any vector (non-normalized)

### mat_to_quat(matrix, transpose=1)

source code
takes a four by four matrix (optionally with shape (16,) and converts it into the axis of rotation and angle to rotate by (x,y,z,theta). It does not expect an OpenGL style, transposed matrix, so is consistent with rotax

### inverse4X4(matrix)

source code

returns the inverse of the given 4x4 transformation matrix t_1: the negetive of Translation vector r_1: the inverse of rotation matrix

inversed transformation is 1) t_1 applied first 2) then r_1 is applied

to validate the result, N.matrixmultiply(matrix, mat_inverse)==N.identity(4,'f')

### mat_to_axis_angle(matrix)

source code
```
NOTE: This function is added by Yong 2/01/04: given a 4x4 transformation
matrix of hinge motion, now returns the rotation angle and axis (defined by
vector and a point) Please be noticed that if the motion is not hinge, the
function will complain and return none

```

### interpolate3DTransform(matrixList, indexList, percent)

source code
```This function gets input of two list and a percent value.
Return value is a 4x4 matrix corresponding to percent% of the transformation.

matrixList: a list of 4x4 transformation matrix
indexList : a list of sorted index (positive float number)
percent   : a positive float number.
if only one matrix in the matrix list:
percent =   0.0  means no transformation (identity)
1.0  means 100% of the transformation (returns mat)
0.58 means 58% of translation and rotatetion 58% of rotation angle
along the same rotation axis
percent can go above 1.0

If matrixList has more than one matrix:
matrixList=[M1,  M2,  M3]     #Attention: All M uses the same reference frame
indexList =[0.2, 0.5, 1.0]    #Attention: assume the list sorted ascendingly
p = 0.5 means apply M2
p = 0.8 means apply M3
p = 0.9 means apply M2 first, then apply 50% of M'.  M' is the transformation
from M2 to M3.   50% = (0.9-0.8) / (1.0-0.8)
M2 x M' = M3
-->  M2.inverse x M2 x M'= M2.inverse x M3
-->  M'= M2.inverse x M

```

source code
None

### _interpolateMat(mat, percent)

source code
called only by interpolate3DTransform()

 Variables Details

 ```0.017453292519943295                                                   ```