Rotation Formula

   2013   3   2
User Avatar
Member
350 posts
Joined: June 2016
Offline
How would you implement the following as Vex within a Point Wrangle?


x = x

y = y*cos(rx) + z*sin(Rx)

z = y*-sin(rx) + z*cos(rx)
Edited by art3mis - Oct. 1, 2018 16:16:19
User Avatar
Member
694 posts
Joined: March 2009
Offline
one way:
@P.y = (@P.y * cos(rx)) + (@P.z * sin(rx));
@P.y = (@P.y * -sin(rx)) + (@P.z * cos(rx));

Assuming rx is a float values…
Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
User Avatar
Staff
5156 posts
Joined: July 2005
Offline
It's worth noting that the VEX cos() function expects radians, unlike the expression cos() function which expects degrees.
User Avatar
Member
472 posts
Joined: July 2005
Offline
Hi,

as a small addition, I've figured out, that it might be better to to save @P into a seperate variable to avoid that some values of @P are overwritten too early.

Attachments:
rotate.hipnc (77.0 KB)

  • Quick Links