0
$\begingroup$

I have the $x$ and $z$ coordinates of 3 points ($S,ドル $E$ and $W$) lying on the $x,ドル $z$ plane. I want to calculate the outer angle made by point $E,ドル and the line going through points $S$ and $E,ドル as shown in figure 1.

$\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:$ figure 1

$\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:$figure 1

I know I can use the cosine rule to calculate this - by calculating the lengths of $SE,ドル $EW$ and $SW$ and then plugging these values into the law of cosines equation. But this involves a lot of calculations. Is there a quicker way?

To calculate the angle between $SE$ and the vertical I used the equation:

$$\theta = \cos^{-1} \frac{1 - E_y}{\sqrt{(E_y - 1)^2 + (E_z - 1)^2}}.$$

Which was derived from the dot product equation. Is there a similar equation to calculate the outer angle between $SE$ and $EW$? (the yellow elbow flextion angle shown in figure 1)

asked Feb 26, 2015 at 21:44
$\endgroup$
2
  • $\begingroup$ Find the angle between $EW$ and vertical line, subtract one from another. $\endgroup$ Commented Feb 26, 2015 at 21:48
  • 1
    $\begingroup$ You mention x and z coordinates, but the picture in in the y z coordinates. $\endgroup$ Commented Feb 26, 2015 at 22:04

1 Answer 1

1
$\begingroup$

See https://stackoverflow.com/a/21486462/380384

Or follow these steps

  1. Create two vectors $A=(S-E)$ and $B=(W-E)$
  2. Calculate the dot product $$\cos\theta = A\cdot B = A_x B_x + A_z B_z$$
  3. Calculate the magnitude of the cross product $$\sin\theta = |A \times B| = A_x B_y - A_y B_x $$
  4. Use the ATAN2() function to get the included angle $$\theta = {\rm atan2}(\sin \theta, \cos \theta)$$
  5. Get the desired angle by $\pi - \theta$
answered Feb 26, 2015 at 22:08
$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.