0
\$\begingroup\$

I came across the statement "rotation about a pivot and an axis" in javafx. The axis is defined byPoint3D and the pivotX, pivotY and pivotZ are of double type. I could not form a relation about what these actually deal with the rotation. Can anyone explain the geometry behind this with an example?

\$\endgroup\$
1
\$\begingroup\$

Well, the pivotX/Y/Z are the effective origin point of the rotation. Pretend these are (0,0,0) at first and that the center of the cube is at the origin.

The Point3D object is a unit vector describing the arbitrary line around which the cube will be rotated. E.g. (1,0,0) would cause it to rotate around the x-axis. If the vector was (1,1,1) it would be a (non-normalized) axis that runs from one corner of the cube to the opposite corner (imagine holding a die between your fingers, on opposite corners, and spinning it).

To take the pivot point into account, just translate the object by that amount time -1, then rotate it, then translate back by that amount.

\$\endgroup\$
2
  • \$\begingroup\$ This means that if I have a cube and I want to rotate it about one of its edges then I must translate the cube to one of end point that edge, then apply the required degrees of rotation and then again translate the cube back to its original position ? \$\endgroup\$ Dec 7 '15 at 20:30
  • \$\begingroup\$ I will say "it depends" because I don't know how the engine you are working with handles such things. Generally speaking rotations are handled about the object-origin (as rotations around (0,0,0) are easy to calculate and many engines hide the translation to global (0,0,0) and back inside the Black Box known as the Graphics Library, so this is called "local rotation"). But ostensibly yes: rotation around an arbitrary point causes the object-origin to move to a new location in global space. \$\endgroup\$ Dec 7 '15 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.