Replies: 1 comment
-
It's just a quirk of how they are stored and different programming environments have different opinions about it. Mathematically they're the same thing but computationally it's sometimes more efficient to have the components stored in a certain order. See https://en.wikipedia.org/wiki/Row-_and_column-major_order?wprov=sfla1 and https://en.wikipedia.org/wiki/Matrix_representation?wprov=sfla1 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. Since .net standard20 has left System.Drawing.Common unsupported, I decided to go with SkiaSharp.
Doing to, I read up on linear algebra.
I am confused about the SKMatrix.
In math text book, 3Blue1Brown video series and the wikipedia entry, the transformations are represented like this:
https://en.wikipedia.org/wiki/Transformation_matrix#/media/File:2D_affine_transformation_matrix.svg
The layout for translation is like this
1 0 Tx
0 1 Ty
0 0 1
The unit vector of "i" is here
1 0 0
0 1 0
0 0 1
The unit vector of "j" is here
1 0 0
0 1 0
0 0 1
....Resulting a skew in X direction to be here
1 0.5 0
0 1 0
0 0 1
But SKMatrix seems to have flipped the script.
The SKmatrix layout for translation is like this
1 0 0
0 1 0
Tx Ty 1
The SKMatrix unit vector of "i" is here
1 0 0
0 1 0
0 0 1
The SKMatrix unit vector of "j" is here
1 0 0
0 1 0
0 0 1
....Resulting a skew in X direction to be here
1 0 0
0.5 1 0
0 0 1
Is there a stated reason for this? Are there different school of thoughts on this? I assume this is also why point vectors are 3x1 matrices instead of 1x3. Does this convention have a name so I can try to stick to educational material that uses the same approach as Skiasharp? It doesn't affect working with matrices if you are using the factory and transformation methods on the SKMatrix class, but if you are directly interacting with the internal float array, it seems that it would matter.
Beta Was this translation helpful? Give feedback.
All reactions