Skip to content

Commit

Permalink
Cleanup log statements
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueDoctor committed Sep 16, 2024
1 parent 59e9dee commit 9dabce9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 2 additions & 3 deletions libraries/path-bool/src/intersection_path_segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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() {
Expand Down
10 changes: 9 additions & 1 deletion libraries/path-bool/src/path_boolean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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")]
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions libraries/path-bool/src/path_segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 9dabce9

Please sign in to comment.