2
$\begingroup$

I'm going to through a list of coordinates and computing the angle between every two adjacent lines. In other words, I'm computing an angle for every 3 consecutive points. Every three consecutive points should form a triangle (where all 3 points are pairwise distinct). In computing their angle, I use the law of cosines and therefore compute

$\gamma = \arccos(\frac{a^2 + b^2 - c^2}{2ab})$

In the process of doing this, I end up with $\frac{a^2 + b^2 - c^2}{2ab} < -1$, which means the inverse cosine has a domain error.

What is flawed about what I am doing?

I do not believe all 3 points lie on the same line, but I will check this.

  • 0
    It would be nice if you displayed the numbers that generated that data.2018-04-02

0 Answers 0