Jump to content
Sign in to follow this  

Use VEX eigenvalues function on 2x2 matrix

Recommended Posts

Hi all, I'm working with flow fields and want to calculate eigen vectors from the flow field values.

I'm working with 2D volumes in ZX plane.  Originally I had 2x vector volumes (I know this is actually 6x float volumes under the hood) representing a vector to the closest point on a curve and vector perpendicular the curve.

I'm now converting this to use a single matrix volume.  This would work well since the only Rank matrix option on a Volume SOP is 3x3 matrix and that's what the VEX eigenvalues function takes.

BUT I'm unclear on how to map 2x 2D vectors (or even 2x 3D vectors for that matter) into the 3x3 matrix so I can just pass it to the eigenvalues function.

hou.Matrix4 class docs has some interesting statements:

"Note that Houdini’s matrices are stored in row-major format, and vectors that are multiplied with matrices are treated as row vectors."

"Both VEX and the UT_DMatrix4 class in the Houdini Development Kit (HDK) also store matrices in row-major format."

So I'm guessing something like:

Row major zero matrix:

| x1, y1, 0 |

| x2, y2, 0 |

| 0,  0  , 0 |

Row major unit matrix:

| x1, y1, 0 |

| x2, y2, 0 |

| 0,  0  , 1 |





Edited by GeordieM

Share this post

Link to post
Share on other sites

Hi Geordie,

You can cast your matrix2 into a matrix3:

matrix3 m = (matrix3) m2;


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this