Skip to content

Commit

Permalink
Remove unused post processing
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueDoctor committed Oct 3, 2024
1 parent b669934 commit d7a1b15
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
18 changes: 0 additions & 18 deletions libraries/path-bool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,10 @@ pub use parsing::path_data::{path_from_path_data, path_to_path_data};
pub use path_boolean::{path_boolean, BooleanError, FillRule, PathBooleanOperation, EPS};
pub use path_segment::PathSegment;

pub fn sort_paths(paths: &mut [Vec<PathSegment>]) {
for path in paths.iter_mut() {
let min = path
.iter()
.min_by(|a, b| (a.start().x, a.start().y).partial_cmp(&(b.start().x, b.start().y)).unwrap_or(std::cmp::Ordering::Less));
let index = path.iter().position(|p| p.start() == min.unwrap().start());
// dbg!(&path);
dbg!(index);
// path.rotate_left(index.unwrap());
// dbg!(&path);
// path.rotate_left(20);
}
paths.sort_unstable_by(|a, b| a[0].start().x.partial_cmp(&b[0].start().x).unwrap_or(std::cmp::Ordering::Less));
}

#[cfg(test)]
mod test {
use crate::path_boolean::{self, FillRule, PathBooleanOperation};
use crate::path_data::{path_from_path_data, path_to_path_data};
use crate::sort_paths;
use path_boolean::path_boolean;

#[test]
Expand Down Expand Up @@ -326,7 +310,5 @@ mod test {
// Add more specific assertions about the resulting path if needed
assert_eq!(result.len(), 1);
assert!(!result[0].is_empty());
sort_paths(&mut result);
// dbg!(path_to_path_data(&result[0], 0.001));
}
}
5 changes: 1 addition & 4 deletions node-graph/gstd/src/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,7 @@ fn boolean_union(a: Path, b: Path) -> Vec<Path> {

fn path_bool(a: Path, b: Path, op: PathBooleanOperation) -> Vec<Path> {
match path_bool::path_boolean(&a, FillRule::NonZero, &b, FillRule::NonZero, op) {
Ok(mut results) => {
path_bool::sort_paths(&mut results);
results
}
Ok(results) => results,
Err(e) => {
let a_path = path_bool::path_to_path_data(&a, 0.001);
let b_path = path_bool::path_to_path_data(&b, 0.001);
Expand Down

0 comments on commit d7a1b15

Please sign in to comment.