Closed Bromeon closed 2 years ago
Is this blocked by the missing translation?
Anyone wanting to translate this to French? :) (not sure it ends well if I try...)
Also, would it make sense to add something like this example to the doc? https://github.com/SFML/SFML-Website/pull/135/files#r356254486
Simple example: you start with a rectangle (black) as shown in the left graphic. The vector
v
represents each vertex' position -- the transformed rectangle is a result of transforming each vertex.
- First, you rotate
v
using the rotation matrixR
. The result (blue) isR * v
, which we callw
.- Now, you apply a translation
T
tow
.
Same as before, the result (green) isT * w
, which isT * (R * v)
.
Matrix multiplication is associative; this is the same asT * R * v
.- Applying an additional scale transform
S
will yieldS * T * R * v
(red).
Even if no one has the time/motivation to translate it to French, might be still worth adding it to the English docs.
Hello, I think it is wrong to say that operations (i.e. transformations) are combined (i.e. matrices are multiplied) in reverse order. Transforming a vector with the combination of transformations T1 and T2 indeed is equivalent to first transforming the vector with T2 and then T1, but the combination still is in the given order T1 * T2. Matrix multiplication is equivalent to function composition. The composition of functions g and f, noted g ∘ f, first applies f and then g when applied to an argument.
So I suggest this wording (not sure when to use the word "transformation" or "operation"):
You can apply several predefined transformations to the same transform as well. They will all be combined sequentially. Note that transforming an object with a combination of transformations is equivalent to applying each operation in reverse order. The last operation (here
scale
) is applied first, and will be affected by operations above it in code (second would betranslate(-10.f, 50.f)
, for example).
@Bromeon what do you think of kimci86's suggestion?
I think kimci86's suggestion makes sense. I wonder if we should even include the example picture that I made, to clarify the order.
About the picture, I find it confusing because R is not only a rotation and S is not only a scale transform. R and S on the picture also include a translation. For example, if R was only a rotation, the bottom left corner of the blue rectangle would still be at the origin (0,0).
Adjusted it.
In French, it can be:
Remarquez que transformer un objet en combinant plusieurs transformations est équivalent à effectuer chaque opération dans l'ordre inverse. La dernière opération (ici
scale
) est appliquée en premier, et sera affectée par les opérations en amont dans le code (la deuxième seraittranslate(-10.f, 50.f)
, par exemple).
Integrated @kimci86's translation, credited him/her/them via Co-authored-by
.
Can we merge this? 🙂
Woops, forgot about this 🙂
Clarify order of transforms, as highlighted by pvigier in https://github.com/SFML/SFML/issues/1608.
Once people agree with the wording, we can backport it to older tutorials.