How to calculate the angle between a vertical line and a tilted plane?

1.1k Views Asked by At

I have a surface (square, real object) that is a bit tilted (not parallel to the ground). Now, for this surface, I measured the coordinates (x,y and most important z) of 3 of its corners (centimeters), relative to the ground on which the surface stays (let's say that the bottom-left corner is x=0,y=0).

I need to know towards which direction is this plane inclined (relative to an imaginary vertical line that goes through the middle of the surface).

I guess I actually need two angles. One will give the tilt on the x-axis, and the other the tilt on the y-axis.

4

There are 4 best solutions below

0
On

If you know three points in the plane then you can calculate two vectors in the plane (if the three points are $(x_0, y_0, z_0)$, $(x_1, y_1, z_1)$, $(x_2, y_2, z_2)$ then $<x_1-x_0, y_1-y_0, z_1-z_0>$ and $<x_2-x_0, y_2-y_0, z_2-z_0>$ are vectors lying in the plane). The angle between either of those vectors and the given line is the angle between the plane and the line.

2
On

Given the three points

$$ \cases{ p_1 =(x_1,y_1,z_1)\\ p_2 = (x_2,y_2,z_2)\\ p_3 =(x_3,y_3,z_3) } $$

we have the normal to the plane as

$$ \vec n = (p_2-p_1)\times(p_3-p_1) $$

and then giving a vertical direction $\vec v = (0,0,1)$ we have

$$ \cos\theta = \frac{\vec n\cdot\vec v}{\|\vec n\|\|\vec v\|} = \frac{x_2 y_3-x_2 y_1 + x_3 y_1 + x_1 y_2 - x_3 y_2 - x_1 y_3}{\sqrt{(x_2 y_1 - x_3 y_1 - x_1 y_2 + x_3 y_2 + x_1 y_3 - x_2 y_3)^2 + (x_2 z_1 - x_3 z_1 - x_1 z_2 + x_3 z_2 + x_1 z_3 - x_2 z_3)^2 + (y_2 z_1 - y_3 z_1 - y_1 z_2 + y_3 z_2 +y_1 z_3 - y_2 z_3)^2}} $$

Here $\theta$ is the angle between the plane and the vertical (or almost). It is necessary to verify also the $\theta$'s complement to $\pi$

3
On

@Gravity, from the comments in the original problem, you indicate this is a perfect square part with one corner resting on the horizontal plane of Z reference.

Using the calculation that follows, we come up with two-equations and two-unknowns, which we then solve. (At the time, the X and Y locations of the the corners relative to the ground were unknown.)

Imagine a perfect circle canted at an angle, reletive to the ground's vertical, and a perfect square randomly placed on the circle such that the four corners, of the square, lie on the periphery of the circle. This is what you have (the circle is imaginary and for calculation purposes). The two diagonals of the square both represent the DIAMETER of the imaginary circle. The DIAMETER will be used at the end (along with the calculated HEIGHT) to calculate the CantedAngleOfTheCircle (the flagpole normal of the square off of the ground's vertical in degrees).

I am trying to solve this in terms that you know (or can measure), since you don't know the X, and Y locations of each corner (reletive to the ground's plane of reference), just the Z locations (reletive to the ground's plane of reference).

What I visualize is:

  1. The elevation difference between the highest point and the lowest points of the imaginary circle is one variable, $HEIGHT$.

  2. The other variable is the $ANGLE$ between two lines (described below), $$( 0º < ANGLE < 90º )$$ The line between the two opposite corners of the square with the largest height difference and the line between the highest and lowest points of the imaginar circle (as measured in the plane of your square part).

Let’s call the shortest elevation difference across one diagonal of the square $MIN$. And let’s call the longest elevation difference across the other diagonal $MAX$. Both $MIN$ and $MAX$ are known numerical values.

Since we are referencing $ANGLE$ relative to the largest elevation difference, $MAX$, I will use the cosine in my function.

Angles are measured in degrees.

$$MAX = HEIGHT · COS ( ANGLE )$$ $$MIN = HEIGHT · COS ( 90 + ANGLE )$$

Let’s solve the second equation for $HEIGHT$ and place it into the first equation and then the first equation becomes,

$$MAX = MIN · COS ( ANGLE ) / COS ( 90 + ANGLE )$$

Then we'll solve for $ANGLE$.

Since $SIN ( 90 + ANGLE ) = COS ( ANGLE )$ we can say,

$MAX = MIN · TAN ( 90 + ANGLE )$

Thus $ANGLE = ARCTAN ( MAX / MIN ) - 90$

Let’s set $MIN$ as $10-mm$ and $MAX$ as $15-mm$.

Then $ANGLE = -33.7º$ and $HEIGHT = 18.0-mm$.

Finally (to answer your original question), use the value $HEIGHT = DIAMETER \cdot SIN(CantedAngleOfTheCircle)$ in order to calculate the circle's normal angle relative to the vertical. Do this by using,$$CantedAngleOfTheCircle = ASIN (HEIGHT / DIAMETER )$$

Use the values you know (DIAMETER (from the hypotenuse of the square)) or have measured (MIN, MAX) and see if this algorythm provides an answer that solves your concern.

3
On

Set up the coordinate axes such that the $z$-axis is vertical, and one of the three given corners (whichever one) is the origin $O.$ Let the position vectors of the other two given corners be $\begin{pmatrix}x_2\\y_2\\z_2\end{pmatrix}$ and $\begin{pmatrix}x_3\\y_3\\z_3\end{pmatrix}.$

Then $\begin{pmatrix}x_2\\y_2\\z_2\end{pmatrix}$ and $\begin{pmatrix}x_3\\y_3\\z_3\end{pmatrix}$ are collinear to the given plane; so, $\mathbf n=\begin{pmatrix}x_2\\y_2\\z_2\end{pmatrix}\times\begin{pmatrix}x_3\\y_3\\z_3\end{pmatrix}=\begin{pmatrix}y_2z_3-y_3z_2\\-x_2z_3+x_3z_2\\x_2y_3-x_3y_2\end{pmatrix}$ is normal to the plane.

Noting that $\mathbf v=\begin{pmatrix}0\\0\\1\end{pmatrix}$ is a vertical vector, using this formula, the angle between the plane and the vertical҂ is $$\theta=\arcsin\left|\frac{\mathbf v \cdot\mathbf n}{\left|\mathbf v\right| \,\left|\mathbf n\right|} \right|\\ =\arcsin\left|\frac{x_2y_3-x_3y_2}{\sqrt{\left(y_2z_3-y_3z_2\right)^2+\left(-x_2z_3+x_3z_2\right)^2+\left(x_2y_3-x_3y_2\right)^2} } \right|.$$

$\large҂$

  1. which direction is this plane inclined (relative to an imaginary vertical line that goes through the middle of the surface)

    The above angle $\theta$ is made with the vertical, i.e., is independent of the location of the imaginary vertical line.

  2. I guess I actually need two angles. One will give the tilt on the x-axis, and the other the tilt on the y-axis.

    You just need one angle to fully specify the plane's tilt; the angle that the plane makes with the horizontal is simply $(90^\circ-\theta).$