2013-07-15 10:14:22 +00:00
|
|
|
#ifndef slic3r_ExtrusionEntity_hpp_
|
|
|
|
#define slic3r_ExtrusionEntity_hpp_
|
|
|
|
|
2013-07-16 19:04:14 +00:00
|
|
|
#include <myinit.h>
|
2013-07-15 10:14:22 +00:00
|
|
|
#include "Polygon.hpp"
|
|
|
|
#include "Polyline.hpp"
|
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
2013-11-21 16:53:50 +00:00
|
|
|
class ExPolygonCollection;
|
|
|
|
class ExtrusionEntityCollection;
|
2014-04-07 23:43:02 +00:00
|
|
|
class Extruder;
|
2013-11-21 16:53:50 +00:00
|
|
|
|
2014-05-12 19:49:17 +00:00
|
|
|
/* Each ExtrusionRole value identifies a distinct set of { extruder, speed } */
|
2013-07-15 10:14:22 +00:00
|
|
|
enum ExtrusionRole {
|
2015-07-02 12:29:20 +00:00
|
|
|
erNone,
|
2013-07-15 10:14:22 +00:00
|
|
|
erPerimeter,
|
|
|
|
erExternalPerimeter,
|
|
|
|
erOverhangPerimeter,
|
2014-05-12 19:49:17 +00:00
|
|
|
erInternalInfill,
|
|
|
|
erSolidInfill,
|
|
|
|
erTopSolidInfill,
|
|
|
|
erBridgeInfill,
|
|
|
|
erGapFill,
|
2013-07-15 10:14:22 +00:00
|
|
|
erSkirt,
|
|
|
|
erSupportMaterial,
|
2014-05-12 20:59:49 +00:00
|
|
|
erSupportMaterialInterface,
|
2014-05-12 19:49:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Special flags describing loop */
|
|
|
|
enum ExtrusionLoopRole {
|
|
|
|
elrDefault,
|
|
|
|
elrContourInternalPerimeter,
|
2013-07-15 10:14:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ExtrusionEntity
|
|
|
|
{
|
|
|
|
public:
|
2015-04-12 18:16:27 +00:00
|
|
|
virtual bool is_collection() const {
|
|
|
|
return false;
|
|
|
|
};
|
2015-01-08 14:19:56 +00:00
|
|
|
virtual bool is_loop() const {
|
|
|
|
return false;
|
|
|
|
};
|
2015-03-09 17:28:07 +00:00
|
|
|
virtual bool can_reverse() const {
|
|
|
|
return true;
|
|
|
|
};
|
2013-08-29 09:47:59 +00:00
|
|
|
virtual ExtrusionEntity* clone() const = 0;
|
2013-07-18 17:09:07 +00:00
|
|
|
virtual ~ExtrusionEntity() {};
|
2013-08-29 09:47:59 +00:00
|
|
|
virtual void reverse() = 0;
|
2014-04-24 14:40:10 +00:00
|
|
|
virtual Point first_point() const = 0;
|
|
|
|
virtual Point last_point() const = 0;
|
2015-01-15 19:06:30 +00:00
|
|
|
virtual Polygons grow() const = 0;
|
2015-05-31 20:04:32 +00:00
|
|
|
virtual double min_mm3_per_mm() const = 0;
|
2013-07-15 10:14:22 +00:00
|
|
|
};
|
|
|
|
|
2013-07-18 17:09:07 +00:00
|
|
|
typedef std::vector<ExtrusionEntity*> ExtrusionEntitiesPtr;
|
|
|
|
|
2013-07-15 10:14:22 +00:00
|
|
|
class ExtrusionPath : public ExtrusionEntity
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Polyline polyline;
|
2014-05-08 09:07:37 +00:00
|
|
|
ExtrusionRole role;
|
|
|
|
double mm3_per_mm; // mm^3 of plastic per mm of linear head motion
|
|
|
|
float width;
|
|
|
|
float height;
|
|
|
|
|
2014-05-12 19:49:17 +00:00
|
|
|
ExtrusionPath(ExtrusionRole role) : role(role), mm3_per_mm(-1), width(-1), height(-1) {};
|
2014-05-08 09:07:37 +00:00
|
|
|
ExtrusionPath* clone() const;
|
2013-07-15 10:14:22 +00:00
|
|
|
void reverse();
|
2014-04-24 14:40:10 +00:00
|
|
|
Point first_point() const;
|
|
|
|
Point last_point() const;
|
2014-03-09 19:19:30 +00:00
|
|
|
void intersect_expolygons(const ExPolygonCollection &collection, ExtrusionEntityCollection* retval) const;
|
|
|
|
void subtract_expolygons(const ExPolygonCollection &collection, ExtrusionEntityCollection* retval) const;
|
2013-11-21 17:03:40 +00:00
|
|
|
void clip_end(double distance);
|
2013-11-21 19:25:24 +00:00
|
|
|
void simplify(double tolerance);
|
2013-11-21 17:03:40 +00:00
|
|
|
double length() const;
|
2014-05-08 09:07:37 +00:00
|
|
|
bool is_perimeter() const;
|
2014-12-16 23:34:00 +00:00
|
|
|
bool is_infill() const;
|
|
|
|
bool is_solid_infill() const;
|
2014-05-08 09:07:37 +00:00
|
|
|
bool is_bridge() const;
|
2015-01-15 19:06:30 +00:00
|
|
|
Polygons grow() const;
|
2015-05-31 20:04:32 +00:00
|
|
|
double min_mm3_per_mm() const {
|
|
|
|
return this->mm3_per_mm;
|
|
|
|
};
|
2014-05-08 09:07:37 +00:00
|
|
|
|
2013-11-21 16:53:50 +00:00
|
|
|
private:
|
2014-03-09 19:19:30 +00:00
|
|
|
void _inflate_collection(const Polylines &polylines, ExtrusionEntityCollection* collection) const;
|
2013-07-15 10:14:22 +00:00
|
|
|
};
|
|
|
|
|
2014-05-08 09:07:37 +00:00
|
|
|
typedef std::vector<ExtrusionPath> ExtrusionPaths;
|
|
|
|
|
2013-07-15 10:14:22 +00:00
|
|
|
class ExtrusionLoop : public ExtrusionEntity
|
|
|
|
{
|
|
|
|
public:
|
2014-05-08 09:07:37 +00:00
|
|
|
ExtrusionPaths paths;
|
2014-05-12 19:49:17 +00:00
|
|
|
ExtrusionLoopRole role;
|
2014-05-07 10:02:09 +00:00
|
|
|
|
2014-05-12 19:49:17 +00:00
|
|
|
ExtrusionLoop(ExtrusionLoopRole role = elrDefault) : role(role) {};
|
2015-01-08 14:19:56 +00:00
|
|
|
bool is_loop() const {
|
|
|
|
return true;
|
|
|
|
};
|
2015-03-09 17:28:07 +00:00
|
|
|
bool can_reverse() const {
|
|
|
|
return false;
|
|
|
|
};
|
2013-08-29 09:47:59 +00:00
|
|
|
ExtrusionLoop* clone() const;
|
2014-05-08 09:07:37 +00:00
|
|
|
bool make_clockwise();
|
2013-08-28 23:40:42 +00:00
|
|
|
bool make_counter_clockwise();
|
2013-08-29 09:47:59 +00:00
|
|
|
void reverse();
|
2014-04-24 14:40:10 +00:00
|
|
|
Point first_point() const;
|
|
|
|
Point last_point() const;
|
2015-01-25 14:21:45 +00:00
|
|
|
Polygon polygon() const;
|
2014-05-08 09:07:37 +00:00
|
|
|
double length() const;
|
2014-11-08 11:56:14 +00:00
|
|
|
bool split_at_vertex(const Point &point);
|
2014-05-08 09:07:37 +00:00
|
|
|
void split_at(const Point &point);
|
|
|
|
void clip_end(double distance, ExtrusionPaths* paths) const;
|
|
|
|
bool has_overhang_point(const Point &point) const;
|
2014-12-17 00:15:47 +00:00
|
|
|
bool is_perimeter() const;
|
|
|
|
bool is_infill() const;
|
|
|
|
bool is_solid_infill() const;
|
2015-01-15 19:06:30 +00:00
|
|
|
Polygons grow() const;
|
2015-05-31 20:04:32 +00:00
|
|
|
double min_mm3_per_mm() const;
|
2013-07-15 10:14:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|