GuassJordan to create complete 4x4 matrix

Hey all

Is there a way to use the GaussJordan node to solve a complete 4x4 matrix

Ordinarily we have:

[x y z 1](x y z 1)*Matrix = [w’x’ w’y’ w’z’ w’](w’x’ w’y’ w’z’ w’)
then we divide by w’ to get our transformed coordinates

I can understand how to use this node to solve non perspective transforms
(i.e. the w row is 0 0 0 1)
but is it possible to take into account the w row as well?

thanks!
elliot

GaussJordan solves arbitray systems Ax = b for x, where A is a square matrix with rank ‘vector size’ and b is a vector with size ‘vector size’.

its nothing more than a linear equation solver, you have to define the system yourself… btw, this algorithm is used to calculate the matrix in Homography (Transform 2d) which is a perspective matrix.

would it be at all possible to get an example of how to use this to solve a 4x4 matrix, taking into account the w characteristic?

i’ll buy you a big beer at node if you do! :)

what exactly do you mean by the w characteristic? to solve for a complete 4x4 matrix, you would need 16 equations, means ‘A’ is a 16x16 matrix and ‘b’ a 16d vector…

afaik, to apply a matrix transform
you multiply by the matrix, and then divide by w
so the ‘w charachteristic’ means that you have to divide by w’ at the end, making it into 2 operations.

i guess you can just set target w to 1
then that’s the equivalent


yep, that’d be it. let me have a look…

to multiply a 4x4 matrix with a 4d vector, there is * (4d)

i mean strictly in graphics terms (not general maths)
if w’ != 1, then you divide xyz’ by w’
i’m pretty sure applytransform also has this charachteristic
but you definitely get it in shaders

if i add more than 4 source points then i get more than 16 elements out
but i know that if i use 4 source points (i.e. a homography), then i still have unknowns in the matrix, notably the position of the origin (the view translation)

test of what i’m chatting about (20.4 kB)