From df917c3aa6ade6b8512a637e9c923c09e0ffb504 Mon Sep 17 00:00:00 2001 From: jacob janzen Date: Sun, 28 Aug 2022 11:14:23 -0500 Subject: fixed teleportation issue set author --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 82aa59e..b415e2a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -110,9 +110,9 @@ impl Image { let pos = 2.0 * PI * frame as f64 / self.frames as f64; for ellipse in &mut self.ellipses { let sin_theta = (ellipse.angle + pos).sin(); - let cos_theta = (ellipse.angle + pos).sin(); - let a = ellipse.width; - let b = ellipse.height; + let cos_theta = (ellipse.angle + pos).cos(); + let a = ellipse.width / 2.0; + let b = ellipse.height / 2.0; let radius = (a * b) / (a * a * sin_theta * sin_theta + b * b * cos_theta * cos_theta).sqrt(); ellipse.curr_point.x = (ellipse.centre.x as f64 + radius * pos.sin()) as i64; -- cgit v1.2.3