next up previous contents index
Next: model.write_data() write Up: The model class: handling Previous: model.orient() center   Contents   Index

model.rotate() -- rotate and translate MODEL

translation = <float:3> 0.0 0.0 0.0 translation vector for MODEL
rotation_matrix = <float:9> 1 0 0 0 1 0 0 0 1 rotation matrix for MODEL
rotation_angle = <float:1> 0.0 rotation of MODEL around axis [degrees]
rotation_axis = <float:3> 1.0 0.0 0.0 rotation axis for MODEL

Description:
This command transforms the Cartesian coordinates of MODEL.

Translation is specified by a translation vector translation and is done first.

Rotation is specified by a rotation matrix rotation_matrix that is given as a vector of 9 elements (three rows times three columns), with column index running first: $a_{11}, a_{12}, a_{13}, a_{21}, a_{22},
a_{23}, a_{31}, a_{32}, a_{33}$. The rotation matrix pre-multiplies the Cartesian coordinate vectors. The matrix corresponds to the view matrix of QUANTA and to the rotation matrix of MOLSCRIPT.

The second kind of rotation is specified by a screw transformation, given by the rotation_axis axis and rotation_angle rotation around the axis (in degrees). This is done last.

If only some transformations are desired, set the other values to 0.

Example: examples/commands/rotate_model.py


# Example for: model.rotate()

# This will orient a model as specified (no change in this example):

# Read the structure and transform it:
env = environ()
mdl = model(env, file='1fas')
mdl.rotate(translation=(0, 0, 0),
           rotation_matrix=(1, 0, 0,
                            0, 1, 0,
                            0, 0, 1),
           rotation_angle=0, rotation_axis=(1, 1, 1))
mdl.write(file='1fas.ini')


next up previous contents index
Next: model.write_data() write Up: The model class: handling Previous: model.orient() center   Contents   Index
Ben Webb 2005-04-21