Skip to content

Commit 4982e13

Browse files
authored
Fix erroneous agm_elliptic_perimeter if radius y > radius x (#407)
I noticed this while working on the numeric approximation of the `Arc` perimeter. This doesn't (or doesn't easily?) occur for `Ellipse`, as it instead gets a rotation when constructed with radius y > radius x.
1 parent 76ebbde commit 4982e13

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ellipse.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ fn agm_elliptic_perimeter(accuracy: f64, radii: Vec2) -> f64 {
376376
Vec2::new(radii.y, radii.x)
377377
};
378378

379-
let accuracy = accuracy / (2. * PI * radii.x);
379+
let accuracy = accuracy / (2. * PI * x);
380380

381381
let mut sum = 1.;
382382
let mut a = 1.;
@@ -427,7 +427,7 @@ fn agm_elliptic_perimeter(accuracy: f64, radii: Vec2) -> f64 {
427427
a = a_next;
428428
}
429429

430-
2. * PI * radii.x / a * sum
430+
2. * PI * x / a * sum
431431
}
432432

433433
#[cfg(test)]

0 commit comments

Comments
 (0)