Skip to content

[question] Correct order of Mat*Mat and Mat*Vec multiplications using zmath #28

@heysokam

Description

@heysokam

I'm really confused about the correct order of mul operations to create a Transformation matrix using zmath.Mat operations.

The desired goal is this order, from Left.first to Right.last:
First .scaling(by{1,2,3}) -then-> .rotation(by{quat}) -then-> .translation(to{position}) -then-> .apply_matrix(to{input}) -output-> final vector

The problem is that, as my understanding goes, row-major and column-major have different ordering of operations to achieve correct transformations:

row-major[  vec*S*R*T  ]
col-major[  T*R*S*vec  ]

So, in order to achieve an S->R->T order: How should I order my arguments for zmath.mul?

  1. mul(mul(mul(vec, S), R), T)
  2. mul(S, mul(R, mul(vec, T)))
  3. Something else entirely

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions