Jump to content

rotation matrix to degrees


Drughi

Recommended Posts

I don't know if it's what you are looking for exactly, but the instance function create a transformation matrix. You just need to multiply to @P.

https://www.sidefx.com/docs/houdini/vex/functions/instance.html

Here a simple vex code to rotate all points with an axis and pivot attributes previously defined.

// rotate
vector scale, postrotation;
vector4 orient;

float angle = ch("ang");
matrix3 rotm = ident();
rotate(rotm, radians(angle), v@axis);
orient = quaternion(rotm);
scale = 1;
postrotation = 0;
matrix xform;
xform = instance(v@pivot, @N, scale, postrotation , orient, v@pivot);

@P *= xform;


 

EDIT: You can also take a look with quaternion, eulertoquaternion, qrotate, etc.. for rotation

Edited by fsimerey
  • Like 1
Link to comment
Share on other sites

Hi Johannes,

have you looked into cracktransform() yet? It extracts transform vectors one at a time:

// translate (c=0), rotate (c=1), scale (c=2), or shears (c=3)
vector  cracktransform(int trs, int xyz, int c, vector pivot, vector pivot_rotate, matrix xform)

https://www.sidefx.com/docs/houdini/vex/functions/cracktransform.html

  • Like 3
Link to comment
Share on other sites

Hi,

thanks for your replies, but I think I didn't explained well enough what I mean. The setWorldTransform in Python uses a Matrix to set transforms on an object with rotations in degrees.

Basically I want to have euler angles from a given matrix. 

Edited by Drughi
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...