They say an affine transformation preserves points, lines, parallel lines etc. I can see this if I think in terms of translation [Is there any other affine transformation you can give as an example, btw] But, what does a linear transformation preserve? By its definition, it seems like they preserve vector space structure. Geometrically what does that correspond to? For example, some of them preserve angles and distance but not all of them. Some preserve linear independence but I am guessing not all of them. What geometric property all of these linear transformations preserve?

  • \$\begingroup\$ Sounds like a job for math.stackexchange.com! \$\endgroup\$ – Almo Mar 26 '18 at 15:45
  • 1
    \$\begingroup\$ I actually searched there before asking here. They generally prefer proof-oriented questions. \$\endgroup\$ – meguli Mar 26 '18 at 15:48
  • \$\begingroup\$ Ok, got it. Makes sense to me. :) \$\endgroup\$ – Almo Mar 26 '18 at 15:57
  • 1
    \$\begingroup\$ "Is there any other affine transformation you can give as an example, btw" rotation, scale, skew, etc. \$\endgroup\$ – Bálint Mar 26 '18 at 21:29

Linear transformations preserve:

  • Collinearity. If three points are collinear before the transformation, they remain collinear afterwards.
  • Parallelism. If two lines are parallel before the transformation, they remain parallel afterwards. This implies that a grid will remain a grid after the transformation.
  • The Origin. The origin point will be the origin after the transformation.
  • Any other property that is consequence of the ones mentioned above.

Note: Lengths are not preserved, but their ratios are.1 In addition, angles may or may not be preserved.1

Going further, linear transformations also preserve addition and scalar multiplication.

What does that mean?

It means that:

  1. Applying the transformation to an addition of things, is the same as adding the transformation of those things.

  2. Applying the transformation to a multiplication of a thing a scalar, is the same as doing a multiplication of the transformation of the thing and the scalar.

Note: I am being vague here when saying "thing". It can be a number, a vector, a matrix, a function, a set of numbers, a set of vectors, a set of matrices, a set of functions... whatever. What matters is that you have addition and scalar multiplication defined for them. For your game, a thing can be a position, a vector (e.g. velocity), a model, a set of models, a scene, etc.

About ratios of length: Ratios of lengths will be preserved for objects on a stright line. This means that for two objects on the same orientation, if one has a measure of a factor of the measure of the other, this factor will remain correct after the transformation.

Addendum about Linear independence: Mapping all points to the origin is a valid linear transformation. This is a trivial example of linear independence not being preserved.

Affine transformation preserve the following:

  • Collinearity.
  • Parallelism.
  • Any other property that is consequence of the ones mentioned above.

Note 1: Affine transformations may or may not preserve the origin. As a result, there are affine transformations that are not linear transformations.

Note 2: Ratios of lengths are preserved on the same conditions as in linear transformations.

The following are the affine transformations for vector spaces:

  • Identity (No change).
  • Translation.
  • Scaling.
  • Rotation.
  • Shear mapping.
  • Reflection (flipping).
  • Combinations of the above mentioned ones.

Note: Perspective projection is not an affine, nor a linear transformation. I only mention that because it is of common use in video games. Plenty of other transformation exist that are neither affine nor linear.

Translation is an affine transformation, but not a linear transformation (notice it does not preserve the origin). Consequently, when you combine it with the rest of operations (by using augmented transformation matrices, for example, which is common practice in game development) you lose commutativity. Thus, the order in which you apply the transformation becomes important.

Addendum: As noted by DMGregory, 3D shear and rotations are also non commutative.

1 Note that these statements do not ordinarily make sense in the cases of projections (ratios can become undefined in that case due to division by zero). However, we can slightly refine our definition to say that a ratio a:b is "preserved" after a transformation T to T(a):T(b) if the equations a = c b and T(a) = c T(b) both hold true. In that case, we can say ratios of lengths are preserved after a linear transformation T.

  • \$\begingroup\$ A couple of clarifications: Ratios of lengths are preserved only along a given direction. A trivial example: T(x, y) = (x, 2*y) preserves the ratio of distances along the x axis, or along the y axis, but doubles the ratio of a distance along the y axis relative to a distance along the x axis. It's still linear though: T(x1 + k*x2,y1 + k*y2) = T(x1,y1) + k*T(x2, y2) Also, rotations (in 3+ dimensions) and shears are also non-commutative, not just translation. \$\endgroup\$ – DMGregory Mar 26 '18 at 16:18
  • \$\begingroup\$ It's strange how this origin concept can make so much difference, while it seems like it is just a convenience to express numerical coordinates. \$\endgroup\$ – meguli Mar 26 '18 at 17:24
  • \$\begingroup\$ @meguli you could create transformation with a different fixed point. A very simple way to do it is to compose a linear transformation with translation. In fact, that is what you do if you want to rotate around a point that is not the origin. Edit: Remember to compose the inverse of the tranlsation. Considering that, the origin is not really that special. But, very, very convinient. \$\endgroup\$ – Theraot Mar 26 '18 at 17:32
  • \$\begingroup\$ I think you mean 3 points. 2 points are always colinear \$\endgroup\$ – MooseBoys Mar 26 '18 at 20:08
  • \$\begingroup\$ @MooseBoys right, looks like I am sloppy today. Fixed. \$\endgroup\$ – Theraot Mar 26 '18 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.