-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize the scattering of balls in the time panel
Combine close time points into one before scattering
- Loading branch information
Showing
4 changed files
with
138 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
//! rerun viewer. | ||
mod app; | ||
pub(crate) mod math; | ||
mod misc; | ||
mod remote_viewer_app; | ||
mod ui; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use egui::emath::*; | ||
|
||
pub fn line_segment_distance_sq_to_point([a, b]: [Pos2; 2], p: Pos2) -> f32 { | ||
let l2 = a.distance_sq(b); | ||
if l2 == 0.0 { | ||
a.distance_sq(p) | ||
} else { | ||
let t = ((p - a).dot(b - a) / l2).clamp(0.0, 1.0); | ||
let projection = a + t * (b - a); | ||
p.distance_sq(projection) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters