Skip to content

Commit

Permalink
numerical errors can get cos_theta slightly outside -1;1 boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
fnattino committed Nov 22, 2024
1 parent 41321a3 commit 08ed208
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/stroke.R
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ interior_angle <- function(v, p1, p2) {
norm1 <- sqrt(dx1^2 + dy1^2)
norm2 <- sqrt(dx2^2 + dy2^2)
cos_theta <- dot_product / (norm1 * norm2)
angle <- acos(cos_theta)
angle <- acos(round(cos_theta, 6))
return(angle)
}

Expand Down

0 comments on commit 08ed208

Please sign in to comment.