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:
Dennis Kobert
2024-09-23 12:16:31 +02:00
committed by GitHub
co-authored by Keavon Chambers
parent 3ddc052538
commit 8a1089938e
175 changed files with 442 additions and 346 deletions
+1 -1
View File
@@ -357,7 +357,7 @@ mod tests {
let bezier2 = Bezier::from_quadratic_coordinates(0., 0., 0., 100., 100., 100.);
assert_eq!(bezier2.project(DVec2::new(100., 0.)), 0.);
let bezier3 = Bezier::from_cubic_coordinates(-50.0, -50.0, -50.0, -50.0, 50.0, -50.0, 50.0, -50.0);
let bezier3 = Bezier::from_cubic_coordinates(-50., -50., -50., -50., 50., -50., 50., -50.);
assert_eq!(DVec2::new(0., -50.), bezier3.evaluate(TValue::Parametric(bezier3.project(DVec2::new(0., -50.)))));
}
}
+2 -2
View File
@@ -513,7 +513,7 @@ mod tests {
let subpath: Subpath<EmptyId> = Subpath::from_bezier(&Bezier::from_quadratic_dvec2(start, handle, end));
assert_eq!(subpath.evaluate(SubpathTValue::GlobalEuclidean(0.0)), start);
assert_eq!(subpath.evaluate(SubpathTValue::GlobalEuclidean(1.0)), end);
assert_eq!(subpath.evaluate(SubpathTValue::GlobalEuclidean(0.)), start);
assert_eq!(subpath.evaluate(SubpathTValue::GlobalEuclidean(1.)), end);
}
}
+1 -1
View File
@@ -607,7 +607,7 @@ mod tests {
)
.all());
let t4 = 1.0;
let t4 = 1.;
assert!(utils::dvec2_compare(
subpath.evaluate(SubpathTValue::GlobalParametric(t4)),
quadratic_bezier.evaluate(TValue::Parametric(1.)),
+2 -2
View File
@@ -357,7 +357,7 @@ impl Bezier1d {
fn value_at(&self, t: f64) -> f64 {
let bz = self;
let order = bz.len() - 1;
let u = 1.0 - t;
let u = 1. - t;
let mut bc = 1.;
let mut tn = 1.;
let mut tmp = bz[0] * u;
@@ -611,7 +611,7 @@ mod tests {
#[test]
fn find_bernstein_roots() {
let bz = Bezier1d(vec![50.0, -100.0, 170.0]);
let bz = Bezier1d(vec![50., -100., 170.]);
let mut solutions = Vec::new();
bz.find_bernstein_roots(&mut solutions, 0, 0., 1.);