diff --git a/libraries/path-bool/src/intersection_path_segment.rs b/libraries/path-bool/src/intersection_path_segment.rs index 6d61fdce7b..6836f84905 100644 --- a/libraries/path-bool/src/intersection_path_segment.rs +++ b/libraries/path-bool/src/intersection_path_segment.rs @@ -72,7 +72,7 @@ pub fn segments_equal(seg0: &PathSegment, seg1: &PathSegment, point_epsilon: f64 let direction2 = sample_path_segment_at(seg1, 0.1); let angles_equal = (direction1 - p00).angle_to(direction2 - p00).abs() < point_epsilon * 4.; if angles_equal { - eprintln!("deduplicating {:?} {:?} because the angles are equal", seg0, seg1); + // eprintln!("deduplicating {:?} {:?} because the angles are equal", seg0, seg1); } start_and_end_equal && (parameter_equal || angles_equal) @@ -134,8 +134,7 @@ pub fn path_segment_intersection(seg0: &PathSegment, seg1: &PathSegment, endpoin if pairs.len() > 1000 { // TODO: check for intersections of the start/end points. If the two lines overlap, return split points for the start/end points. Use a binary search to check where the points are on the line. - return dbg!(calculate_overlap_intersections(seg0, seg1, eps)); - return vec![]; + return calculate_overlap_intersections(seg0, seg1, eps); } for (seg0, seg1) in pairs.iter() { diff --git a/libraries/path-bool/src/path_boolean.rs b/libraries/path-bool/src/path_boolean.rs index eddab03e6e..89d3430d77 100644 --- a/libraries/path-bool/src/path_boolean.rs +++ b/libraries/path-bool/src/path_boolean.rs @@ -684,7 +684,7 @@ fn sort_outgoing_edges_by_angle(graph: &mut MinorGraph) { .outgoing_edges .iter() .map(|key| (*key, &graph.edges[*key])) - .map(|(key, edge)| ((key.0.as_ffi() & 0xFF), (dbg!(edge.start_segment()).start_angle()))) + .map(|(key, edge)| ((key.0.as_ffi() & 0xFF), (edge.start_segment()).start_angle())) .collect(); #[cfg(feature = "logging")] dbg!(edges); @@ -936,6 +936,7 @@ fn compute_dual(minor_graph: &MinorGraph) -> Result<DualGraph, BooleanError> { .iter() .map(|face_key| (face_key, compute_signed_area(&dual_vertices[*face_key], &dual_edges))) .collect(); + #[cfg(feature = "logging")] dbg!(&areas); #[cfg(feature = "logging")] @@ -962,11 +963,13 @@ fn compute_dual(minor_graph: &MinorGraph) -> Result<DualGraph, BooleanError> { } let outer_face_key = if count != 1 { // return Err(BooleanError::MultipleOuterFaces); + #[cfg(feature = "logging")] eprintln!("Found multiple outer faces: {areas:?}, falling back to area calculation"); *areas.iter().max_by_key(|(_, area)| ((area.abs() * 1000.) as u64)).unwrap().0 } else { *windings.iter().find(|(&_, winding)| (winding < &0) ^ reverse_winding).expect("No outer face of a component found.").0 }; + #[cfg(feature = "logging")] dbg!(outer_face_key); components.push(DualGraphComponent { @@ -1386,6 +1389,11 @@ pub fn path_boolean(a: &Path, a_fill_rule: FillRule, b: &Path, b_fill_rule: Fill let mut flags = HashMap::new(); flag_faces(&nesting_trees, a_fill_rule, b_fill_rule, edges, vertices, &mut flags); + #[cfg(feature = "logging")] + for (face, flag) in &flags { + eprintln!("{:?}: {:b}", face.0, flag); + } + let predicate = OPERATION_PREDICATES[op as usize]; match op { diff --git a/libraries/path-bool/src/path_segment.rs b/libraries/path-bool/src/path_segment.rs index 3f05882bb6..aa289f4bb3 100644 --- a/libraries/path-bool/src/path_segment.rs +++ b/libraries/path-bool/src/path_segment.rs @@ -25,6 +25,7 @@ impl PathSegment { PathSegment::Cubic(start, control1, control2, _) => { let diff = control1 - start; if vectors_equal(diff, DVec2::ZERO, EPS.point) { + // if this diff were empty too, the segments would have been convertet to a line (control2 - start).to_angle() } else { diff.to_angle()