# How to caculate a cubes Tilt

• IMK

#### IMK

Hello, I am new to this forum so not sure if this is the correct place for this post.
How do I calculate the combined tilt of three axes? Please.

Imagine a cube standing vertical on one corner, from the point where it touches the surface you have three angles x1, y1, z1. (Its initial position).

Now, roll the cube over a little so it is no longer vertical and we have another set of angles x2, y2, z2. So how do I sum these angles please to calculate the tilt?.

I have tried a few ideas but none seem to be correct.

What do you mean by the "tilt" of something?

Move the top corner of the cube a little in any direction so the line that runs from the bottom corner to the top corner is no longer vertical. Thus the x,y,z angles between the edges of the cube and the horizontal base have now changed.

So initially we had x1,y1,z1 when the cube was vertical, and x2,y2,z2 as the cube is now tiled over. So how do I sum x1,y1,z1 with x2,y2,z2 to calculate the angle of tilt .

Do you have a precise definition for tilt as a measurement? It's a pretty vague term, and right now the vector (x2, y2, z2) is seems to be a fine way to measure tilt. If you want a real number, you can take the norm of the vector ($$\sqrt{x_2^2+y_2^2+z_2^2}$$). If you're working with an established definition for how tilt is measured, please post it.

Sorry, if my terms are poor but all I need to know is how I sum
x1,y1,z1 with x2,y2,z2 to find the difference?

x1,y1,z1 was vertical (90degrees) someone moved the top of the cube so it is no longer vertical and all I know is x2,y2,z2. What was once vertical 90degrees) is now some other angle? How do I calculate this please.

I'm still not sure what you're looking for. Maybe it'd help if you said what this is for.

What are "x1", "y1", and "z1"? Real numbers representing some form of angle measurement, right?

You say x1,y1,z1 is 90 degrees. How do you take a triplet of numbers and get one angle out of them?

I think everyone here know that by tilt you mean by rotating the cube slightly. No one here knows how exactly you want to measure this rotation.

Let me ask you this. Is this a problem for homework? Out of a textbook? Or just something you're curious about yourself?

In math and physics, it is common to break down an arbitrary rotation into three angles describing a rotation first around the z axis, then around the rotated x axis, then finally around another axis (often the new z axis again). Other axes can be used instead. The three resulting rotation angles are called Euler angles and they can describe any rotation (or tilt, as you call it). Take a look at this link for a full description
http://mathworld.wolfram.com/EulerAngles.html" [Broken]
Following Eq.  is a procedure for finding the angles given the new x,y,z axis directions.

EDIT: corrected the order of the axes

Last edited by a moderator:
Many thanks for all your help and sorry if I did not manage to explain my problem, no it is not homework but a little project that I am working on.
However I think I have a solution in Cross Products thus:
Tilt = (( y1 * z2 ) - ( y2 * z1 )) / 90 +
(( x1 * z2 ) - ( x2 * z1 )) / 90 +
(( x1 * y2 ) - ( x2 * y1 )) / 90 = Diff between Vertical and Tilt.
This seems to be correct, but is there a better way or have I mist something.
Again many thanks IMK

I don't quite follow what x1,x2, etc represent, but if you have a vector representing the original position and a vector representing the tilted position, you can find the angle between those vectors with

$$\theta = \cos^{-1}{\left(\frac{a \cdot b}{|a||b|}\right)}$$