math - Calculation of the position of an object moving in a circular motion in 3D -


I have an object that is performing a circular motion in the 3D space, at center or circle X: 0 , Y: 0, z: 0 Radius is a variable I know that the object is on the circle ([he calls from his angle] or from the distance that has moved). The circle can be tilted in all 3 directions, so I get three variables for the angle, call them ax, AI and edge. Now I need to calculate where exactly is the object? I need the X, Y and Z coordinates of this.

  float radius = some value; Float ax = someValue; Float AI = some value; Float az = someValue; Float ar = someValue; // This is representing the angle of the circle object // I have the object x. = Need to know ?; Object.y = ?; Object.z = ?;  

You need to provide more information to get the exact formula. The answer is that the order you apply to your rotation, which direction you are moving in, and what is the initial orientation of your circle. Also, it would be very easy to calculate the position of the object in a rotation at a time.

So, where are all the objects 0?

Suppose it's on (R0,0).

The pseudo-code will look something like this:

  pos0 = (r, 0,0) pos1 = pos0, rotates around Z-axis (not z-axis) by AG May be!) Pos2 = pos1, az pos3 = pos2 rotates around z-axis, rotated by AE pos4 = pos3 around y-axis, rotated around X-axis  < / Pre> 

pos4 will be the status of your object , if everything goes well, if you have trouble installing it, then ax = ay = az = Try to keep 0 and cave Worry about LA AR, unless it's right. Then, start setting up other angles and updating your formula at one time.

can be done with each

  x '= x * cos (angle) - y * sin (angle) y' = y * cos (angle) + X * sin (angle)  

It is rotating on the Z-axis, to rotate on the Y-axis, use z and X instead of X and Y. Also, keep in mind that the angle is in radians. You may have to make angle negative for some rotation (depending on which direction is AR, ax, AI, AG )

You can also complete this rotation with matrix multiplication, such as Marcello said, but it can be overkill for your project.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -