Drughi Posted October 10, 2019 Share Posted October 10, 2019 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? Quote Link to comment Share on other sites More sharing options...
fsimerey Posted October 10, 2019 Share Posted October 10, 2019 (edited) 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 October 10, 2019 by fsimerey 1 Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted October 10, 2019 Share Posted October 10, 2019 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 3 Quote Link to comment Share on other sites More sharing options...
Drughi Posted October 11, 2019 Author Share Posted October 11, 2019 (edited) 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 October 11, 2019 by Drughi Quote Link to comment Share on other sites More sharing options...
toadstorm Posted October 11, 2019 Share Posted October 11, 2019 Konstantin gave you the answer already. Use cracktransform in VEX... this will return euler rotations. 1 Quote Link to comment Share on other sites More sharing options...
Drughi Posted October 11, 2019 Author Share Posted October 11, 2019 You'r right, I misunderstood. Got it now. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.