Make arc() wrap angles mod 2pi

This commit is contained in:
pylbrecht 2019-12-02 14:33:37 +01:00
parent 02e3325416
commit a02daef7b2

View file

@ -488,10 +488,17 @@ impl GenericPathBuilder for PathBuilder {
&mut self,
origin: Point2D<f32>,
radius: f32,
start_angle: f32,
mut start_angle: f32,
mut end_angle: f32,
anticlockwise: bool,
) {
if (!anticlockwise && start_angle > end_angle + 2. * PI) ||
(anticlockwise && end_angle > start_angle + 2. * PI)
{
start_angle = start_angle % (2. * PI);
end_angle = end_angle % (2. * PI);
}
if (anticlockwise && end_angle > 0.) || (!anticlockwise && end_angle < 0.) {
end_angle = -end_angle;
}