I am trying to find the angle between two rectangles when there is a known gap between them.

See this diagram:

enter image description here

I have simplified the problem into three triangles, two of which are the same.

Here is my attempted solution:

$$ \theta = 2\alpha + \beta $$ Finding $\alpha$, this is the angle of a right angle so I can just use $tan$ $$ \begin{align} \tan\alpha &= \frac{a}{2r}\\ \therefore \alpha &= \arctan{\frac{a}{2r}} \end{align} $$

That's easy, when I test $\alpha$ seems reasonable.

Finding $\beta$, this isn't a right angle triangle so I use the cosine rule as I know all three sides:

$$ \begin{align} b^2 &= 2r^2 + 2r^2\cos\beta\\ b^2 - 2r^2 &= 2r^2\cos\beta\\ \frac{b^2 - 2r^2}{2r^2} &= \cos\beta\\ \frac{b^2}{2r^2} - 1 &= cos\beta\\ \therefore\beta &= \arccos\left(\frac{b^2}{2r^2} - 1\right) \end{align} $$

When I now check my $\beta$ value with some reasonable numbers I get an unreasonable angle?

For example: $$ \begin{aligned} \text{let } b &= 4\\ r &= 128\\ \\ \therefore\beta &= \arccos\left(\frac{4^2}{2\times128^2} - 1\right)\\ &\approx 0.99\pi \end{aligned} $$

Why am I getting such a big angle, I expect it to be more like $0.01\pi$!


The comments highlighted a mistake in my diagram, the lengths around $\beta$ aren't of length $r$.

So my new formula for $\beta$ is:

$$ \begin{align} r_2^2 &= \left(\frac{a}{2}\right)^2 + r^2\\ \therefore r_2 &= \sqrt{\left(\frac{a}{2}\right)^2 + r^2}\\ \\ \beta &= \arccos\left(\frac{b^2}{2\left(\frac{a}{2}^2 + r^2\right)} - 1\right)\\ &= \arccos\left(\frac{2b^2}{w^2+4d^2} - 1\right) \end{align} $$

But I still get a ridiculous result!

  • $\begingroup$ Your sketch is wrong: The hypotenuse in the triangle with the angle $\alpha$ cannot have length $r$ since one of the cathesuses has length $r$. So you need to introduce a different length, say $r_{2}$ for the hypothenuse. $\endgroup$ – Sebastian Dec 4 '13 at 10:50
  • $\begingroup$ It's either that or the triangle does not have a right-angle. $\endgroup$ – Sebastian Dec 4 '13 at 10:54
  • $\begingroup$ @Sebastian Ahh of course. The triangles around $\alpha$ are definitely right angles though. I can calculate $r_2$ with Pythagoras so it doesn't make things too much more complicated. $\endgroup$ – Lerp Dec 4 '13 at 11:48
  • $\begingroup$ Just from the sketch it is not clear whether the length of the side of the triangle which is part of the rectangle outline is $\frac{a}{2}$ - if that is the case, you should include this in the problem statement. $\endgroup$ – Sebastian Dec 6 '13 at 12:43

Assuming that the line originating at the point $X$ bisects the line of lenght $a$ of the rectangle in a right angle and that we know $r$, $a$ and $b$. We can calculate $r_{2}$ (like you did) using Pythagoras' Theorem. Now consider the triangle with the sides $b$, $r_{2}$ and $r_{2}$ in your sketch. Then the line which meets $b$ in a right angle and goes through $X$ bisects $b$ (it is just the height line because our triangle is equal-sided). So \begin{equation*} \sin{\frac{\beta}{2}} = \frac{\frac{b}{2}}{r_{2}}\end{equation*} and hence \begin{equation*} \beta = 2 \cdot \arcsin{\frac{b}{2 \cdot r_{2}}} = 2 \cdot \arcsin{\frac{b}{2 \cdot \sqrt{r^{2} + \left(\frac{a}{2}\right)^{2}}}}\end{equation*}

| cite | improve this answer | |

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.