@@ -225,21 +225,26 @@ pub fn polylabel<T>(polygon: &Polygon<T>, tolerance: &T) -> Point<T>
while !cell_queue.is_empty() {
let cell = cell_queue.pop().unwrap();
// Update the best cell if we find a cell with greater distance
+ println!("Popped cell with max distance: {:?}", (cell.max_distance, cell.x, cell.y));
if cell.distance > best_cell.distance {
+ println!("Found greater distance: {:?}", (cell.distance, best_cell.distance));
best_cell.x = cell.x;
best_cell.y = cell.y;
best_cell.h = cell.h;
best_cell.distance = cell.distance;
best_cell.max_distance = cell.max_distance;
+ println!("New best coords: {:?}", (best_cell.x, best_cell.y));
}
// Bail out of this iteration if we can't find a better solution
if cell.max_distance - best_cell.distance <= *tolerance {
continue;
}
// Otherwise, add a new quadtree node and start again
+ println!("Splitting");
h = cell.h / two;
add_quad(&mut cell_queue, &cell, &h, polygon);
}
+ println!("Queue empty");
// We've exhausted the queue, so return the best solution we've found
Point::new(best_cell.x, best_cell.y)
}
--
2.11.0