mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-17 23:22:07 -06:00
New implementation of Avoid crossing perimeters using Voronoi diagrams
This commit is contained in:
parent
f018828bfd
commit
f5b9df2413
6 changed files with 199 additions and 5909 deletions
|
@ -5,7 +5,8 @@
|
|||
#include "ClipperUtils.hpp"
|
||||
#include "ExPolygonCollection.hpp"
|
||||
#include "Polyline.hpp"
|
||||
#include "visilibity.hpp"
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#define MP_INNER_MARGIN scale_(1.0)
|
||||
|
@ -13,6 +14,8 @@
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
class MotionPlannerGraph;
|
||||
|
||||
class MotionPlanner
|
||||
{
|
||||
public:
|
||||
|
@ -25,16 +28,32 @@ class MotionPlanner
|
|||
bool initialized;
|
||||
ExPolygon outer;
|
||||
ExPolygonCollections inner;
|
||||
std::vector<VisiLibity::Environment*> envs;
|
||||
std::vector<VisiLibity::Visibility_Graph*> graphs;
|
||||
std::vector<MotionPlannerGraph*> graphs;
|
||||
|
||||
void initialize();
|
||||
void generate_environment(int island_idx);
|
||||
static VisiLibity::Polyline convert_polyline(const Polyline &polyline);
|
||||
static Polyline convert_polyline(const VisiLibity::Polyline &v_polyline);
|
||||
static VisiLibity::Polygon convert_polygon(const Polygon &polygon);
|
||||
static VisiLibity::Point convert_point(const Point &point);
|
||||
static Point convert_point(const VisiLibity::Point &v_point);
|
||||
MotionPlannerGraph* init_graph(int island_idx);
|
||||
};
|
||||
|
||||
class MotionPlannerGraph
|
||||
{
|
||||
private:
|
||||
typedef size_t node_t;
|
||||
typedef double weight_t;
|
||||
struct neighbor {
|
||||
node_t target;
|
||||
weight_t weight;
|
||||
neighbor(node_t arg_target, weight_t arg_weight)
|
||||
: target(arg_target), weight(arg_weight) { }
|
||||
};
|
||||
typedef std::vector< std::vector<neighbor> > adjacency_list_t;
|
||||
adjacency_list_t adjacency_list;
|
||||
|
||||
public:
|
||||
Points nodes;
|
||||
//std::map<std::pair<size_t,size_t>, double> edges;
|
||||
void add_edge(size_t from, size_t to, double weight);
|
||||
size_t find_node(const Point &point) const;
|
||||
void shortest_path(size_t from, size_t to, Polyline* polyline);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue