Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Feb 16, 2023
1 parent fc4ae56 commit 3ca98bb
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions crates/fj-math/src/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ impl Arc {
/ (2. * (angle_rad.abs().into_f64() / 2.).sin());

let center = {
let midpoint = (p0.coords + p1.coords) / 2.;
let midpoint = Point {
coords: (p0.coords + p1.coords) / 2.,
};
let unit_vector_midpoint_to_center = {
let clockwise_turn = angle_rad <= Scalar::ZERO;
let f = match (clockwise_turn, more_than_half_turn) {
Expand All @@ -54,11 +56,8 @@ impl Arc {
- (distance_between_endpoints.powi(2) / 4.))
.sqrt();

Point {
coords: midpoint
+ unit_vector_midpoint_to_center
* distance_center_to_midpoint,
}
midpoint
+ unit_vector_midpoint_to_center * distance_center_to_midpoint
};

let start_angle = {
Expand Down

0 comments on commit 3ca98bb

Please sign in to comment.