# Rotation about an Arbitrary Axis

This topic is 3864 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am a newcomer here in the forum, but start with a question that is taking my sleep ... I am making an application to rotate structures. I realized that the best way was to make arbitrary rotation of axes. I studied a bit of linear algebra, Matrix Operations , quaternions ... and other things related. Until I found a code called Arcball, easy to find at google. Well, could implement the code without difficulty, because he considers the object as a ball and the movement of the mouse is calm rotate the object. After testing one realized, however ... He based that the object is centered in the origin of the axes, as if applying a translation can not rotate more correctly the structure ... Someone has some advice to help me? Thank you for your attention

##### Share on other sites
Here is a rotation formula.
http://mathworld.wolfram.com/RotationFormula.html

And your problem might be solved by moving the object into 0,0,0 then move it back after rotation.

##### Share on other sites
apply the translation

GlTranslatef (axis_x, axis_y, axis_z)

after the rotation:

glMultMatrixf (Matrix);

Matrix is provided by arcball
But as the arcball uses as a reference when the center axis of the matrix do the translation changes ... the right would cause the arcball compute matrix modified by the new rotation ... to make a translation is given a change of use viewport, but for more than an object that's not true ... I wonder if you have any way to use the arcball or I will have to develop a new code with the formula of the rotation?

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 33
• 16
• 11
• 10
• ### Forum Statistics

• Total Topics
634122
• Total Posts
3015637
×