Get angle between line formed from two points on two inclined rectangles and x axis.

181 Views Asked by At

I have two rectangles with known dimensions. And I know the angle they make with the horizontal axis which their lower right corner touch.

I want to get the angle the the dashed line (The line connecting the lower right point of the first rectangle with the upper left point of the second rectangle) makes with the horizontal axis.

I know I can get that angle by getting the vector representing the dashed line, but I was wondering if there is a better easier way to get it using geometric construction

Image

1

There are 1 best solutions below

3
On BEST ANSWER

Here's your picture with some added letters:

enter image description here

We know the angles $\alpha$, $\theta$, and the dimensions of the rectangles $k$, $w$, and $h$.

My steps would be to calculate $|AB|$ with the sine rule, then work out $|AC|$, and finally use the cosine rule to calculate $|AE|$, the length you want.

In the triangle $ABD$, we know the angles $\angle BAD=90-\theta$ and $\angle ABD=90+\alpha$. Therefore $\angle ADB = 180-(90-\theta)-(90+\alpha)= \theta-\alpha$. The sine rule gives us:

$$ \frac{\sin(\angle ADB)}{|AB|} = \frac{\sin(\angle ABD)}{|AD|} \\ |AB| = \frac{|AD| \sin(\angle ADB)}{\sin(\angle ABD)}\\ |AB| = \frac{k \sin(\theta-\alpha)}{\sin(90+\alpha)} = \frac{k \sin(\theta-\alpha)}{\cos(\alpha)}$$

The segment $BC$ is the hypotenuse of a right angle, which gives $|BC| = w/\cos(\alpha)$. Therefore

$$ |AC|= |AB|+|BC| = \frac{w + k \sin(\theta-\alpha)}{\cos(\alpha)}$$

For the final step, look at triangle $ACE$. We just calculated $|AC|$. From Pythagoras we know $$|CE|=\sqrt{w^2+h^2}$$

Lastly, we can work out the angle between them:

$$\angle ACE = \alpha + \tan^{-1}(h/w)$$

So now you have a triangle of which you know side-angle-side, and you want to know the side opposite the angle, which cries out for the cosine rule.

$$ |AE|^2 = |AC|^2 + |CE|^2 + 2 |AC| |CE| \cos (\angle ACE) \\ |AE| = \sqrt{|AC|^2 + |CE|^2 + 2 |AC| |CE| \cos (\angle ACE)} $$

Unfortunately the expression that results after substituting what we have for $|AC|$, $|AC|$, and $\angle ACE$ is rather horrible.