Jump to content

Extract Transform VEX Variant


schiho

Recommended Posts

I'm trying to replicate the 'align' node with VEX.

What I'm looking for is simple matrix transform extraction with few reference point positions.

 

The goal is to calculate a rotation/translation matrix from between the actual geo and rest.

 

Thanks in advance.

Edited by schiho
Link to comment
Share on other sites

vector p = point(0,"P",0); // pivot position
vector u = set(0,1,0);
vector n = normalize(v@v);
vector o = cross(u,n);
matrix3 m3 = set(o.x, o.y, o.z,
                 u.x, u.y, u.z,
                 n.x, n.y, n.z); //3D Rotation Matrix

matrix m4  = set(o.x, o.y, o.z, 0,
                 u.x, u.y, u.z, 0, 
                 n.x, n.y, n.z, 0,
                 p.x, p.y, p.z, 1); //3D Transformation matrix


If you dont have any vectors then you can build it using 3 points reference. Let me know if you need help for this too

 

 

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...