mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-03 10:32:40 +00:00
Fixes and improvements to MotionPlanner, much smarter now
This commit is contained in:
@@ -14,27 +14,18 @@
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class MotionPlannerGraph;
|
||||
class MotionPlanner;
|
||||
|
||||
class MotionPlanner
|
||||
class MotionPlannerEnv
|
||||
{
|
||||
friend class MotionPlanner;
|
||||
|
||||
public:
|
||||
MotionPlanner(const ExPolygons &islands);
|
||||
~MotionPlanner();
|
||||
Polyline shortest_path(const Point &from, const Point &to);
|
||||
size_t islands_count() const;
|
||||
|
||||
private:
|
||||
ExPolygons islands;
|
||||
bool initialized;
|
||||
ExPolygon outer;
|
||||
ExPolygonCollections inner;
|
||||
std::vector<MotionPlannerGraph*> graphs;
|
||||
|
||||
void initialize();
|
||||
MotionPlannerGraph* init_graph(int island_idx);
|
||||
ExPolygonCollection get_env(int island_idx) const;
|
||||
Point nearest_env_point(const ExPolygonCollection &env, const Point &from, const Point &to) const;
|
||||
ExPolygon island;
|
||||
ExPolygonCollection env;
|
||||
MotionPlannerEnv() {};
|
||||
MotionPlannerEnv(const ExPolygon &island) : island(island) {};
|
||||
Point nearest_env_point(const Point &from, const Point &to) const;
|
||||
};
|
||||
|
||||
class MotionPlannerGraph
|
||||
@@ -61,6 +52,25 @@ class MotionPlannerGraph
|
||||
Polyline shortest_path(size_t from, size_t to);
|
||||
};
|
||||
|
||||
class MotionPlanner
|
||||
{
|
||||
public:
|
||||
MotionPlanner(const ExPolygons &islands);
|
||||
~MotionPlanner();
|
||||
Polyline shortest_path(const Point &from, const Point &to);
|
||||
size_t islands_count() const;
|
||||
|
||||
private:
|
||||
bool initialized;
|
||||
std::vector<MotionPlannerEnv> islands;
|
||||
MotionPlannerEnv outer;
|
||||
std::vector<MotionPlannerGraph*> graphs;
|
||||
|
||||
void initialize();
|
||||
MotionPlannerGraph* init_graph(int island_idx);
|
||||
const MotionPlannerEnv& get_env(int island_idx) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user