Skip to content

Commit

Permalink
fix cosine (#1125)
Browse files Browse the repository at this point in the history
  • Loading branch information
msbarry authored Dec 3, 2024
1 parent 87c658f commit fd7b79a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private static double cos(double ax, double ay, double bx, double by, double cx,
double den = Math.hypot(bx - ax, by - ay) * Math.hypot(cx - bx, cy - by),
cos = 0;
if (den > 0) {
cos = Math.clamp((ax - bx) * (cx - bx) + (ay - by) * (cy - by) / den, -1, 1);
cos = Math.clamp(((ax - bx) * (cx - bx) + (ay - by) * (cy - by)) / den, -1, 1);
}
return cos;
}
Expand Down

0 comments on commit fd7b79a

Please sign in to comment.