Skip to content

Commit

Permalink
Fix potential floating point representation error in angle2().
Browse files Browse the repository at this point in the history
See also: #28, #19, e9eeeaa

Co-authored-by: Pierre de Beaucorps <pierre.de-beaucorps@inria.fr>
  • Loading branch information
TaipanRex and deboc committed Apr 14, 2018
1 parent b686f02 commit 2dd5bbe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyvisgraph/visible_vertices.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ def angle2(point_a, point_b, point_c):
a = (point_c.x - point_b.x)**2 + (point_c.y - point_b.y)**2
b = (point_c.x - point_a.x)**2 + (point_c.y - point_a.y)**2
c = (point_b.x - point_a.x)**2 + (point_b.y - point_a.y)**2
return acos((a + c - b) / (2 * sqrt(a) * sqrt(c)))
cos_value = (a + c - b) / (2 * sqrt(a) * sqrt(c))
return acos(int(cos_value*T)/T2)


def ccw(A, B, C):
Expand Down

0 comments on commit 2dd5bbe

Please sign in to comment.