There is a function like:
CATransform3DGetAffineTransform
Returns the affine transform represented by 't'. If 't' can not be exactly represented as an affine transform the returned value is undefined.
I'm not so math-orientated, so a easy to understand description would be very nice. Wikipedia was no big help here.
A map f: X → Z is an affine map if there exists a linear map mf : V → W such that mf (x − y) = f (x) − f (y) for all x, y in X.
In fact, coordinates in an affine geometry are defined in terms of these fundamental invariants. An Euclidean transformation, in addition to the above, also preserves lengths and angles. Since an affine (or Euclidean) transformation preserves parallelism it cannot be used to describe a pinhole projection.
A projective transformation shows how the perceived objects change as the observer's viewpoint changes. These transformations allow the creating of perspective distortion. Affine transformations are used for scaling, skewing and rotation. Graphics Mill supports both these classes of transformations.
A non affine transformations is one where the parallel lines in the space are not conserved after the transformations (like perspective projections) or the mid points between lines are not conserved (for example non linear scaling along an axis).
Affine transformations are transformations that do not "overly distort" your geometry in the sense that:
So rotation and scaling are affine - projection, for example, is not.
Affine transformations are transformations, but transformations need not be Affine. For example, a shear of the plane is not Affine because it doesn't send lines to lines.
Affine transformations are by definition those transformations that preserve ratios of distances and send lines to lines (preserving "colinearity"). In finite-dimensional Euclidean geometry, these act by a linear transformation followed by a translation i.e. x -> Ax + b
where x
is a vector, A
is a linear transformation and b
is a vector.
Affine transformations are great for changing co-ordinate systems, perhaps from one that is fairly hard to visualise back to the usual co-ordinates.
The Affine transformations you're likely to come across in practice are translations, dilation (i.e. scaling), rotation and reflection. If you're developing for iOS, say, check out the CGAffineTransform
sections of the developer documentation. These will explain how to create Affine transformations using several convenience methods, and how to apply these to UIView instances with the -setTransform
message.
Last, an important point about Affine transformations is that they're not commutative under composition: Applying transform T1
followed by transform T2
is in general different from applying T2
followed by T1
. That is, the order in which you apply these matters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With