Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix layout is only partially documented #1895

Open
roelandschoukens opened this issue Oct 28, 2024 · 0 comments
Open

Matrix layout is only partially documented #1895

roelandschoukens opened this issue Oct 28, 2024 · 0 comments

Comments

@roelandschoukens
Copy link

roelandschoukens commented Oct 28, 2024

The documentation of matrix() points out that the 16-float constructor form accepts values in row major order, and the [][] operator accepts first a row and then a column. However that by itself is not meaningful, it also needs to specify if matrices have basis vectors in rows or columns. Depending on that choice:

  • A translation matrix may be either matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, tx, ty, tz, 1), or
    matrix(1, 0, 0, tx, 0, 1, 0, ty, 0, 0, 1, tz, 0, 0, 0, 1).
  • The expression point p3 = transform(M1 * M2, p1) may be equivalent to either
    point p2 = transform(M1, p1) ; point p3 = transform(M2, p2);, or
    point p2 = transform(M2, p1) ; point p3 = transform(M1, p2);

In algebraic terms, that matrix multiplication would look like $\mathbf{p}\mathbf{M}_1\mathbf{M}_2$ (if vectors are rows), or $\mathbf{M}_2\mathbf{M}_1\mathbf{p}$ (if vectors are columns).

@roelandschoukens roelandschoukens changed the title Matrix layout is undocumented Matrix layout is only partially documented Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant