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;
|
|
|
|
|
2013-07-15 10:14:22 +00:00
|
|
|
enum ExtrusionRole {
|
|
|
|
erPerimeter,
|
|
|
|
erExternalPerimeter,
|
|
|
|
erOverhangPerimeter,
|
|
|
|
erContourInternalPerimeter,
|
|
|
|
erFill,
|
|
|
|
erSolidFill,
|
|
|
|
erTopSolidFill,
|
|
|
|
erBrige,
|
|
|
|
erInternalBridge,
|
|
|
|
erSkirt,
|
|
|
|
erSupportMaterial,
|
|
|
|
erGapFill,
|
|
|
|
};
|
|
|
|
|
|
|
|
class ExtrusionEntity
|
|
|
|
{
|
|
|
|
public:
|
2013-08-29 09:47:59 +00:00
|
|
|
virtual ExtrusionEntity* clone() const = 0;
|
2013-07-18 17:09:07 +00:00
|
|
|
virtual ~ExtrusionEntity() {};
|
2013-07-15 10:14:22 +00:00
|
|
|
ExtrusionRole role;
|
2014-01-03 17:27:46 +00:00
|
|
|
double mm3_per_mm; // mm^3 of plastic per mm of linear head motion
|
2013-08-29 09:47:59 +00:00
|
|
|
virtual void reverse() = 0;
|
2013-09-02 20:33:03 +00:00
|
|
|
virtual Point* first_point() const = 0;
|
|
|
|
virtual Point* last_point() const = 0;
|
2013-11-21 17:03:40 +00:00
|
|
|
bool is_perimeter() const;
|
|
|
|
bool is_fill() const;
|
|
|
|
bool is_bridge() const;
|
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:
|
2013-08-29 09:47:59 +00:00
|
|
|
ExtrusionPath* clone() const;
|
2013-07-15 10:14:22 +00:00
|
|
|
Polyline polyline;
|
|
|
|
void reverse();
|
2013-09-02 20:33:03 +00:00
|
|
|
Point* first_point() const;
|
|
|
|
Point* last_point() const;
|
2013-11-21 16:53:50 +00:00
|
|
|
ExtrusionEntityCollection* intersect_expolygons(ExPolygonCollection* collection) const;
|
|
|
|
ExtrusionEntityCollection* subtract_expolygons(ExPolygonCollection* collection) 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;
|
2013-11-21 16:53:50 +00:00
|
|
|
private:
|
|
|
|
ExtrusionEntityCollection* _inflate_collection(const Polylines &polylines) const;
|
2013-07-15 10:14:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ExtrusionLoop : public ExtrusionEntity
|
|
|
|
{
|
|
|
|
public:
|
2013-08-29 09:47:59 +00:00
|
|
|
ExtrusionLoop* clone() const;
|
2013-07-15 10:14:22 +00:00
|
|
|
Polygon polygon;
|
2013-09-13 13:19:15 +00:00
|
|
|
ExtrusionPath* split_at_index(int index) const;
|
|
|
|
ExtrusionPath* split_at_first_point() const;
|
2013-08-28 23:40:42 +00:00
|
|
|
bool make_counter_clockwise();
|
2013-08-29 09:47:59 +00:00
|
|
|
void reverse();
|
2013-09-02 20:33:03 +00:00
|
|
|
Point* first_point() const;
|
|
|
|
Point* last_point() const;
|
2013-07-15 10:14:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|