Jump to content
art3mis

Math noob - rotation formulas

Recommended Posts

Posted (edited)

Hi

Trying to implement several of these rotation formulas with simple geometry

https://sites.google.com/site/fujitarium/technical-note/basic-math/rotation

for instance the first example

 

Quote

 

  • add rotation X (x, y*cos(rx) + z*sin(rx), y*-sin(rx) + z*cos(rx))

(x, y*cos(rx) + z*sin(Rx), y*-sin(rx) + z*cos(rx))

 

 

x = x

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

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

 

How would you implement this as Vex within a Point Wrangle?

Edited by art3mis

Share this post


Link to post
Share on other sites

Hi, 

While rotating an object, we are essentially changing the position of the points of the Geo. 

 

So, the above mentioned formula changes the point position along y and z axis but not x axis. To implement it in a point wrangle, just drop in a test object on to the grid followed by a point wrangle and enter the following code in the wrangle :

float angleX = ch("xRad");
float posY = @P.y*cos(angleX) + @P.z*sin(angleX);
float posZ = @P.y*(-sin(angleX)) + @P.z*cos(angleX);
@P = set(@P.x, posY, posZ);

Change the "xRad" parameter, the object "appears" to be rotating along the X-Axis, but in reality, it is just changing the point positions along Y and Z axis.

Hope it helps!

S

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

×