API Reference for Enthought Tool Suite 3.0.1
Functions for affine matrices.
| Copyright: | Space Telescope Science Institute |
|---|---|
| License: | BSD Style |
| Author: | Eric Jones, Enthought, Inc., eric@enthought.com |
These affine operations are based coordinate system transformations, not translations of pts, etc. To translate a point, you multiply it by the affine transform matrix:
a b 0
[x, y, 1] * c d 0 = [x',y',1]
tx ty 1
This is the opposite order of multiplication from what many are accustomed to.
Here is a useful link:
http://mathworld.wolfram.com/AffineTransformation.html
IDENTITY = affine_identity()
Returns an affine transform rotated by angle in radians.
Returns an affine transform providing the given scaling.
Returns an affine transform with the given translation.
Returns a new identity affine_transform object.
Returns the a, b, c, d, tx, ty values of an affine transform.
Returns the concatenation of transform with other. This is simply transform pre-multiplied by other.
Returns the inverse of the transform, m.
Tests whether an affine transform is the identity transform.
Rotates transform by angle in radians.
Rotation is done using the following formula:
cos(x) sin(x) 0 a b 0 -sin(x) cos(x) 0 * c d 0 = 0 0 1 tx ty 1
cos(x)*a+sin(x)*b cos(x)*b+sin(x)*d 0
-sin(x)*a+cos(x)*c -sin(x)*b+cos(x)*d 0
tx ty 1
where x = angle.
Returns a scaled version of the transform by the given values.
Scaling is done using the following formula:
sx 0 0 a b 0 sx*a sx*b 0 0 sy 0 * c d 0 = sy*c sy*d 0 0 0 1 tx ty 1 0 0 1
Returns pt transformed by the affine transform, ctm.
Transforms an array of points using the affine transform, ctm.
Returns transform translated by (x,y).
Translation:
1 0 0 a b 0 a b 0 0 1 0 * c d 0 = c d 0 x y 1 tx ty 1 x*a+y*c+y x*b+y*d+ty 1
Factors a matrix as if it is the product of translate/rotate/scale matrices applied (i.e., concatenated) in that order. It returns:
tx,ty,sx,sy,angle
where tx and ty are the translations, sx and sy are the scaling values and angle is the rotational angle in radians.
If the input matrix was created in a way other than concatenating t/r/s matrices, the results could be wrong. For example, if there is any skew in the matrix, the returned results are wrong.
Needs Test!
| Local name | Refers to |
|---|---|
| alltrue | numpy.alltrue |
| arctan2 | numpy.arctan2 |
| array | numpy.array |
| cos | numpy.cos |
| dot | numpy.dot |
| eye | numpy.eye |
| float64 | numpy.float64 |
| ones | numpy.ones |
| ravel | numpy.ravel |
| sin | numpy.sin |
| zeros | numpy.zeros |
© Copyright 2002-2008 Enthought, Inc.