Returns a change of basis transformation matrix.
rhinoscriptsyntax.XformChangeBasis (initial_plane, final_plane)
rhinoscriptsyntax.XformChangeBasis2 (x0, y0, z0, x1, y1, z1)
rhinoscript.transformation.XformChangeBasis (initial_plane, final_plane)
rhinoscript.transformation.XformChangeBasis2 (x0, y0, z0, x1, y1, z1)
initial_plane |
Required. The initial plane. |
final_plane |
Required. The final plane. |
x0 |
Required. List of 3 numbers, Point3d, or Vector3d. The initial basis X (X0,Y0,Z0 can be any 3-D basis) |
y0 |
Required. List of 3 numbers, Point3d, or Vector3d. The initial basis Y |
z0 |
Required. List of 3 numbers, Point3d, or Vector3d. The initial basis Z |
x1 |
Required. List of 3 numbers, Point3d, or Vector3d. The final basis X (X1,Y1,Z1 can be any 3-D basis) |
y1 |
Required. List of 3 numbers, Point3d, or Vector3d. The final basis Y |
z1 |
Required. List of 3 numbers, Point3d, or Vector3d. The final basis Z |
Transform |
The 4x4 transformation matrix if successful. |
None |
If not successful, or on error. |
If you have points defined with respect to planes, the version of XformChangeBasis that takes two planes computes the transformation to change coordinates from one plane to another. The predefined world plane, WorldXYPlane, can be used as an argument.
The version of XformChangeBasis that takes six vectors maps (a0, b0, c0) to (a1, b1, c1) where a0*X0 + b0*Y0 + c0*Z0 = a1*X1 + b1*Y1 + c1*Z1.
The change of basis transformation is not the same as the rotation transformation that rotates one orthonormal frame to another. See XformRotation.
import rhinoscriptsyntax as rs
import math
objs = rs.GetObjects("Select objects to shear")
if objs:
cplane = rs.ViewCPlane()
cob = rs.XformChangeBasis(rs.WorldXYPlane(), cplane)
shear2d = rs.XformIdentity()
shear2d[0,2] = math.tan(math.radians(45.0))
cob_inverse = rs.XformChangeBasis(cplane, rs.WorldXYPlane())
temp = rs.XformMultiply(shear2d, cob)
xform = rs.XformMultiply(cob_inverse, temp)
rs.TransformObjects( objs, xform, True )