8.1.9 Affine transformations

scale( scale)
Returns a copy scaled with scale[i] in direction i.

The scale should be a list of 3 numbers, or a single number. In the latter case, the scaling is homothetic.

translate( dir,distance=None)
Returns a copy translated over distance in direction dir.

dir is either an axis number (0,1,2) or a direction vector.

If a distance is given, the translation is over the specified distance in the specified direction. If no distance is given, and dir is specified as an axis number, translation is over a distance 1. If no distance is given, and dir is specified as a vector, translation is over the specified vector.

Thus, the following are all equivalent: F.translate(1); F.translate(1,1); F.translate([0,1,0]); F.translate([0,2,0],1)

rotate( angle,axis=2)
Return a copy rotated over angle around axis.

The angle is specified in degrees. The axis is either one of 0,1,2 designating one of the global axes, or a 3-component vector specifying an axis through the origin. If no axis is specified, rotation is around the 2(z)-axis. This is convenient for working on 2D-structures.

Positive angles rotate clockwise when looking in the positive direction of the axis.

As a convenience, the user may also specify a 3x3 rotation matrix as argument. In that case rotate(mat) is equivalent to affine(mat).

shear( dir,dir1,skew)
Returns a copy skewed in the direction dir of plane (dir,dir1).

The coordinate dir is replaced with (dir + skew * dir1).

reflect( dir,pos=0)
Returns a Formex mirrored in direction dir against plane at pos.

Default position of the plane is through the origin.

affine( mat,vec=None)
Returns a general affine transform of the Formex.

The returned Formex has coordinates given by mat * xorig + vec, where mat is a 3x3 matrix and vec a length 3 list.