mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 16:08:12 +08:00
Path Bool library code cleanup (#2000)
* Remove log statements * Add feature gates to functions in path.rs * Fix infinite parsing loop and add new test * License tweaks * Remove trailing zero in whole number floats * Flatten visual-tests directory * Code review * Clean up printlines * Add error handling to path parsing --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
3ddc052538
commit
8a1089938e
@@ -2,7 +2,7 @@ use glam::DVec2;
|
||||
|
||||
pub type LineSegment = [DVec2; 2];
|
||||
|
||||
const COLLINEAR_EPS: f64 = f64::EPSILON * 64.0;
|
||||
const COLLINEAR_EPS: f64 = f64::EPSILON * 64.;
|
||||
|
||||
#[inline(never)]
|
||||
pub fn line_segment_intersection([p1, p2]: LineSegment, [p3, p4]: LineSegment, eps: f64) -> Option<(f64, f64)> {
|
||||
@@ -21,7 +21,7 @@ pub fn line_segment_intersection([p1, p2]: LineSegment, [p3, p4]: LineSegment, e
|
||||
let s = (c.x * b.y - c.y * b.x) / denom;
|
||||
let t = (a.x * c.y - a.y * c.x) / denom;
|
||||
|
||||
if (-eps..=1.0 + eps).contains(&s) && (-eps..=1.0 + eps).contains(&t) {
|
||||
if (-eps..=1. + eps).contains(&s) && (-eps..=1. + eps).contains(&t) {
|
||||
Some((s, t))
|
||||
} else {
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user