XformRotation

Returns a rotation transformation matrix. The XformRotation provides several ways to compute a rotation transformation.  A positive rotation angle indicates a counter-clockwise (right hand rule) rotation about the axis of rotation.

Syntax

rhinoscriptsyntax.XformRotation1 (initial_plane, final_plane)

rhinoscriptsyntax.XformRotation2 (angle_degrees, rotation_axis, center_point)

rhinoscriptsyntax.XformRotation3 (start_direction, end_direction, center_point)

rhinoscriptsyntax.XformRotation4 (x0, y0, z0, x1, y1, z1)

rhinoscript.transformation.XformRotation1 (initial_plane, final_plane)

rhinoscript.transformation.XformRotation2 (angle_degrees, rotation_axis, center_point)

rhinoscript.transformation.XformRotation3 (start_direction, end_direction, center_point)

rhinoscript.transformation.XformRotation4 (x0, y0, z0, x1, y1, z1)

Parameters

initial_plane

Required.  The starting plane.

final_plane

Required.  The ending plane.

angle

Required.  Number.  The rotation angle in degrees.

rotation_axis

Required.  3-D Vector.  The rotation axis.

start_direction

Required.  3-D Vector.  The starting direction.

end_direction

Required.  3-D Vector.  The ending direction.

center_point

Required.  3-D Point.  The rotation center point.

x0

Required.  3-D Vector.  The initial frame X

y0

Required.  3-D Vector.  The initial frame Y.

z0

Required.  3-D Vector.  The initial frame Z.

x1

Required.  3-D Vector.  The final frame X.

y1

Required.  3-D Vector.  The final frame Y.

z1

Required.  3-D Vector.  The final frame Z.

Returns

Transform

The 4x4 transformation matrix.

None

On error.

Notes

Option 1 creates a rotation transformation that maps initial_plane to final_plane. The planes should be right hand orthonormal planes. This transformations is not the same as the change of basis transformations. For more information, see XformChangeBasis.

Option 3 calculate the minimal transformation that rotates start_direction to end_direction while fixing center_point.

Option 4 required that frames should be right hand orthonormal frames. The resulting rotation fixes the origin (0,0,0), maps initial X to final X, initial Y to final Y, and initial Z to final Z.

Example

import rhinoscriptsyntax as rs

objs = rs.GetObjects("Select objects to rotate")

if objs:

    cplane = rs.ViewCPlane()

    xform = rs.XformRotation2(45.0, cplane[3], cplane[0])

    rs.TransformObjects( objs, xform, True )

Also See

XformMirror

XformPlanarProjection

XformScale

XformShear

XformTranslation