Commit e02cbd62 authored by Olivier Tilloy's avatar Olivier Tilloy Committed by Federico Mena Quintero

Fix rounding error on i386 (#455).

parent 91bc6e94
Pipeline #74566 failed with stages
in 22 minutes and 49 seconds
......@@ -588,18 +588,15 @@ fn find_outgoing_directionality_forwards(
}
// Normalizes an angle to [0.0, 2*PI)
fn normalize_angle(mut angle: f64) -> f64 {
if angle < 0.0 {
while angle < 0.0 {
angle += PI * 2.0;
}
fn normalize_angle(rad: f64) -> f64 {
let res = rad % (PI * 2.0);
if res.abs() < std::f64::EPSILON {
res.abs()
} else if res < 0.0 {
res + PI * 2.0
} else {
while angle > PI * 2.0 {
angle -= PI * 2.0;
}
res
}
angle
}
fn angle_from_vector(vx: f64, vy: f64) -> f64 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment