affine v0.1.0 Affine.Transforms
This module defines all the basic transforms. These include translate, scale, and rotation for 1, 2 or 3 dimensions.
The transform library can be accessed at it’s lowest level giving the best performance and full control to the developer. An example of using the API at this level is:
t_translate = Affine.Transforms.translate ( 3.0, 4.0, 5.0 )
point = Affine.transform t_translate [ 1.0, 2.0, 3.0 ]
assert point == [4.0, 6.0, 8.0]
And to add a transform to the first one:
t_scale = Affine.Transforms.scale (2.0, 2.0, 2.0)
t_scale_then_translate = Affine.multiply t_translate, t_scale
point = Affine.transform t_scale_then_translate [ 1.0, 2.0, 3.0 ]
assert point == [ 5.0, 8.0, 11.0 ]
Keep in mind that the order individual transforms are provided to the multiply function is important since transforms are not commutative. With the same example as above but with t_translate and t_scale reversed, the resulting point is different:
t_translate_then_scale = Affine.multiply t_scale, t_translate
point = Affine.transform t_translate_then_scale [ 1.0, 2.0, 3.0 ]
assert point == [ 8.0, 12.0, 16.0 ]
The last transform, t_translate, in this case will be the first to be done. Of course, the beauty of Affine transforms is that all multiplied transforms are done simultaneously but logically, the last transform multiplied is the first to be applied.
Summary
Functions
Defines a 3d rotation around the x axis in the counter clockwise direction for the specified angle in radians
Defines a 2d otation around in the xy plane and is only for a 2D transformation. Rotation is in the counter clockwise direction for the specified angle in radians
Defines a 3d rotation around the y axis in the counter clockwise direction for the specified angle in radians
Defines a 3d rotation around the z axis in the counter clockwise direction for the specified angle in radians
Defines a 1D scale transform for variable x
Defines a 2D scale transform for variables x and y
Defines a 3D scale transform for variables x, y and z
Defines a 1D tranlation transform for variable x
Defines a 2D tranlation transform for variables x and y
Defines a 3D tranlation transform for variables x, y and z
Types
Functions
Defines a 3d rotation around the x axis in the counter clockwise direction for the specified angle in radians.
Defines a 2d otation around in the xy plane and is only for a 2D transformation. Rotation is in the counter clockwise direction for the specified angle in radians.
Defines a 3d rotation around the y axis in the counter clockwise direction for the specified angle in radians.
Defines a 3d rotation around the z axis in the counter clockwise direction for the specified angle in radians.
Defines a 1D scale transform for variable x.
Defines a 2D scale transform for variables x and y.
Defines a 3D scale transform for variables x, y and z.
Defines a 1D tranlation transform for variable x.
Defines a 2D tranlation transform for variables x and y.
Defines a 3D tranlation transform for variables x, y and z.