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:
http://www.sidefx.com/docs/houdini/hom/hou/Matrix4.html

"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 |

Thoughts?

TNKS!

G

Edited by GeordieM

Share on other sites

Hi Geordie,

You can cast your matrix2 into a matrix3:

`matrix3 m = (matrix3) m2;`