refactored algorithm to use AABB tree instead of edge grid
This commit is contained in:
parent
ad4502d96e
commit
51d738c564
2 changed files with 74 additions and 67 deletions
|
@ -1,35 +1,11 @@
|
|||
#ifndef SRC_LIBSLIC3R_AABBTREELINES_HPP_
|
||||
#define SRC_LIBSLIC3R_AABBTREELINES_HPP_
|
||||
|
||||
#include "libslic3r/Point.hpp"
|
||||
#include "libslic3r/EdgeGrid.hpp"
|
||||
#include "libslic3r/AABBTreeIndirect.hpp"
|
||||
#include "libslic3r/Line.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
||||
struct EdgeGridWrapper {
|
||||
EdgeGridWrapper(coord_t edge_width, std::vector<Points> lines) :
|
||||
lines(lines), edge_width(edge_width) {
|
||||
|
||||
grid.create(this->lines, edge_width, true);
|
||||
grid.calculate_sdf();
|
||||
}
|
||||
|
||||
bool signed_distance(const Point &point, coordf_t point_width, coordf_t &dist_out) const {
|
||||
coordf_t tmp_dist_out;
|
||||
bool found = grid.signed_distance(point, edge_width, tmp_dist_out);
|
||||
dist_out = tmp_dist_out - edge_width / 2 - point_width / 2;
|
||||
return found;
|
||||
}
|
||||
|
||||
EdgeGrid::Grid grid;
|
||||
std::vector<Points> lines;
|
||||
coord_t edge_width;
|
||||
};
|
||||
|
||||
|
||||
namespace AABBTreeLines {
|
||||
|
||||
namespace detail {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue