Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to know which value in a transform matrix stores what information?  (Read 1281 times)

0 Members and 1 Guest are viewing this topic.

DasOhmoff San

  • Guest
Hello,

I was searching for a very long time and could not find an answer.
And it does not seem to be easy to find.

When using transforms, there is this method:
const float* sf::Transform::getMatrix() const
It returns a 4x4 matrix of all the transform information, so far everything is clear.
But how do I know which entry in the matrix stands for which information?

For example, out of those 16 values, which one stands for the x position and which for the y position?
Or the x scale and y scale?

Is there some kind of documentation for that?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How to know which value in a transform matrix stores what information?
« Reply #1 on: August 01, 2019, 08:25:01 pm »
First, a transform matrix is generally describing a mapping from one 2D vector onto another. This doesn't need to be translation, rotation or scale only -- it can involve other transformations, such as skewing. This implies that it's not always possible to extract position, rotation and scale exactly.

Second, I would suggest to search for such keywords in general, as it's a recurring topic in graphics programming and mathematics, not something SFML-specific. A good start might be here:

https://math.stackexchange.com/q/237369
https://en.wikipedia.org/wiki/Transformation_matrix#Examples_in_2D_computer_graphics
« Last Edit: August 01, 2019, 08:26:57 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything