Law Of Cosines Confusion

235 Views Asked by At

I am trying to understand finding the joint angles to a robot arm and I am reading this tutorial on a website and either I am really dense or it is wrong.

The $5^{th}$ picture from the top where the author starts to label angles for law of cosines, he previously states that $\angle A_1$ is split into $D_1$ and $D_2$, and then he applies law of cosines but it looks more like the Pythagoras Theorem. enter image description here

He is saying that angle $D_1^2 = X^2 + Y^2$ which I didn't understand. He has two unknowns, side $C$ and $\angle c$, so how does he solve for law of cosines?

4

There are 4 best solutions below

0
On

The figure is nonsense. As you say, the Pythagorean theorem involves side lengths, not angles. The correct way to compute D1 is via arctangent (as the author does do later in the code).

5
On

The pythagorean theorem is just a generalization of the Law of Cosines.

As per your given link, the author first uses the pythagorean theorem to find out the value of $D1$. He then uses this value (by substituting it into the formula for the law of cosines) to find $D2$ by considering the second triangle (which is not right-angled).

He then reuses the Law of Cosines but considering another angle now $A2$ to find out its cosine. And Hence. he deduces the value of the angle itself.

In short, he uses the law of cosines two times. One to find out the side $D2$ and one time to find out $A2$

0
On

There are some errors in the text.

Picture must say $dist^2 = x^2+y^2$ and $D1=\text{atan2}(y,x)$.

Note code is ok:

dist := distance(x, y)
D1 := math.Atan2(y, x)
0
On

enter image description here

There is some messy on the author's text. There is a confusion between angle and length.

I will try to write something more clear.

Let's say that $\angle A= \angle D1+ \angle D2$.

We use Pythagoras in order to get $a=dist$:

$$a=\sqrt{x^2+y^2}$$

and use that to calculate $\angle D2$ by cosine rule:

$$c^2=a^2+b^2-2ab\cos (\angle D2) \rightarrow \angle D2=\arccos\left(\frac{a^2+b^2-c^2}{2ab}\right)$$

we also know that

$$\cos(\angle D1)=\frac{x}{a}\rightarrow \angle D1=\arccos\left(\frac{x}{a}\right)$$

Now you can calculate $\angle A= \angle D1+\angle D2$.

I hope this helps.