Skip to content

Commit

Permalink
faster rect border_rotation
Browse files Browse the repository at this point in the history
honestly i have no clue how this wasnt the first thing i thought of but whatever
  • Loading branch information
juliapaci committed Aug 9, 2024
1 parent 0c2b790 commit bb7c57a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/rect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,14 @@ impl Vector for VelloRect {
}

fn border_rotation(&self, time: f64) -> f64 {
let diff = self.border_translation(time).abs()
- self.border_translation((4.0 * time).floor() / 4.0);
let time = (time * 4.0).ceil() as u64;

if diff.y > 0.0 {
if time > 3 {
std::f64::consts::FRAC_PI_2
} else if diff.y < 0.0 {
3.0 * std::f64::consts::FRAC_PI_2
} else if diff.x < 0.0 {
} else if time > 2 {
std::f64::consts::PI
} else if time > 1 {
3.0 * std::f64::consts::FRAC_PI_2
} else {
0.0
}
Expand Down

0 comments on commit bb7c57a

Please sign in to comment.