mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 07:34:03 -06:00
Fixes and improvements to MotionPlanner, much smarter now
This commit is contained in:
parent
f7e97f7e9b
commit
1a286fc906
12 changed files with 198 additions and 202 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue