Jump to content
Drughi

rotation matrix to degrees

Recommended Posts

In Python is this function setWorldTransform wich translates a matirx to "transforms". How to do this in vex? Scale and transformation is easy, but is there a function for rotation?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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 2

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Konstantin gave you the answer already. Use cracktransform in VEX... this will return euler rotations.

  • Like 1

Share this post


Link to post
Share on other sites

You'r right, I misunderstood. Got it now. Thanks. 

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

×