PrusaSlicer-NonPlainar/xs/src/ExtrusionEntity.hpp

89 lines
2.2 KiB
C++
Raw Normal View History

#ifndef slic3r_ExtrusionEntity_hpp_
#define slic3r_ExtrusionEntity_hpp_
#include <myinit.h>
#include "Polygon.hpp"
#include "Polyline.hpp"
namespace Slic3r {
class ExPolygonCollection;
class ExtrusionEntityCollection;
class Extruder;
enum ExtrusionRole {
erPerimeter,
erExternalPerimeter,
erOverhangPerimeter,
erContourInternalPerimeter,
erFill,
erSolidFill,
erTopSolidFill,
erBrige,
erInternalBridge,
erSkirt,
erSupportMaterial,
erGapFill,
};
class ExtrusionEntity
{
public:
ExtrusionEntity() : mm3_per_mm(-1), width(-1), height(-1) {};
virtual ExtrusionEntity* clone() const = 0;
2013-07-18 17:09:07 +00:00
virtual ~ExtrusionEntity() {};
ExtrusionRole role;
double mm3_per_mm; // mm^3 of plastic per mm of linear head motion
float width;
float height;
virtual void reverse() = 0;
virtual Point first_point() const = 0;
virtual Point last_point() const = 0;
bool is_perimeter() const;
bool is_fill() const;
bool is_bridge() const;
};
2013-07-18 17:09:07 +00:00
typedef std::vector<ExtrusionEntity*> ExtrusionEntitiesPtr;
class ExtrusionPath : public ExtrusionEntity
{
public:
ExtrusionPath* clone() const;
Polyline polyline;
void reverse();
Point first_point() const;
Point last_point() const;
void intersect_expolygons(const ExPolygonCollection &collection, ExtrusionEntityCollection* retval) const;
void subtract_expolygons(const ExPolygonCollection &collection, ExtrusionEntityCollection* retval) const;
void clip_end(double distance);
void simplify(double tolerance);
double length() const;
#ifdef SLIC3RXS
std::string gcode(Extruder* extruder, double e, double F,
double xofs, double yofs, std::string extrusion_axis,
std::string gcode_line_suffix) const;
#endif
private:
void _inflate_collection(const Polylines &polylines, ExtrusionEntityCollection* collection) const;
};
class ExtrusionLoop : public ExtrusionEntity
{
public:
ExtrusionLoop* clone() const;
Polygon polygon;
2013-09-13 13:19:15 +00:00
ExtrusionPath* split_at_index(int index) const;
ExtrusionPath* split_at_first_point() const;
bool make_counter_clockwise();
void reverse();
Point first_point() const;
Point last_point() const;
};
}
#endif