2013-07-06 13:26:32 +00:00
|
|
|
#ifndef slic3r_TriangleMesh_hpp_
|
|
|
|
#define slic3r_TriangleMesh_hpp_
|
|
|
|
|
2013-07-16 19:04:14 +00:00
|
|
|
#include <myinit.h>
|
2013-06-24 17:35:49 +00:00
|
|
|
#include <admesh/stl.h>
|
2013-09-07 12:06:09 +00:00
|
|
|
#include <vector>
|
2013-08-05 17:52:37 +00:00
|
|
|
#include "Point.hpp"
|
2013-09-07 12:06:09 +00:00
|
|
|
#include "Polygon.hpp"
|
2013-06-24 17:35:49 +00:00
|
|
|
|
2013-07-07 20:36:14 +00:00
|
|
|
namespace Slic3r {
|
|
|
|
|
2013-09-09 20:27:58 +00:00
|
|
|
class TriangleMesh;
|
|
|
|
typedef std::vector<TriangleMesh*> TriangleMeshPtrs;
|
|
|
|
|
2013-06-24 17:35:49 +00:00
|
|
|
class TriangleMesh
|
|
|
|
{
|
|
|
|
public:
|
2013-09-11 18:00:51 +00:00
|
|
|
TriangleMesh();
|
2013-09-09 22:09:56 +00:00
|
|
|
TriangleMesh(const TriangleMesh &other);
|
2013-06-24 17:35:49 +00:00
|
|
|
~TriangleMesh();
|
|
|
|
void ReadSTLFile(char* input_file);
|
2013-09-11 07:49:28 +00:00
|
|
|
void write_ascii(char* output_file);
|
|
|
|
void write_binary(char* output_file);
|
2013-09-09 21:18:33 +00:00
|
|
|
void repair();
|
2013-06-24 17:35:49 +00:00
|
|
|
void WriteOBJFile(char* output_file);
|
2013-08-04 19:34:26 +00:00
|
|
|
void scale(float factor);
|
2013-09-09 21:38:49 +00:00
|
|
|
void scale(std::vector<double> versor);
|
2013-08-05 08:48:38 +00:00
|
|
|
void translate(float x, float y, float z);
|
2013-08-05 17:22:33 +00:00
|
|
|
void align_to_origin();
|
2013-08-05 17:52:37 +00:00
|
|
|
void rotate(double angle, Point* center);
|
2013-09-07 12:06:09 +00:00
|
|
|
std::vector<Polygons>* slice(const std::vector<double> &z);
|
2013-09-09 20:27:58 +00:00
|
|
|
TriangleMeshPtrs split() const;
|
2013-09-09 20:45:22 +00:00
|
|
|
void merge(const TriangleMesh* mesh);
|
2013-06-24 17:35:49 +00:00
|
|
|
stl_file stl;
|
2013-09-09 21:09:56 +00:00
|
|
|
bool repaired;
|
2013-09-13 12:48:40 +00:00
|
|
|
|
|
|
|
#ifdef SLIC3RXS
|
|
|
|
SV* to_SV();
|
|
|
|
void ReadFromPerl(SV* vertices, SV* facets);
|
|
|
|
#endif
|
2013-06-24 17:35:49 +00:00
|
|
|
};
|
|
|
|
|
2013-09-07 19:08:53 +00:00
|
|
|
enum FacetEdgeType { feNone, feTop, feBottom };
|
|
|
|
|
|
|
|
class IntersectionPoint : public Point
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int point_id;
|
|
|
|
int edge_id;
|
|
|
|
IntersectionPoint() : point_id(-1), edge_id(-1) {};
|
|
|
|
};
|
|
|
|
|
|
|
|
class IntersectionLine
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Point a;
|
|
|
|
Point b;
|
|
|
|
int a_id;
|
|
|
|
int b_id;
|
|
|
|
int edge_a_id;
|
|
|
|
int edge_b_id;
|
|
|
|
FacetEdgeType edge_type;
|
2013-09-07 22:44:01 +00:00
|
|
|
bool skip;
|
|
|
|
IntersectionLine() : a_id(-1), b_id(-1), edge_a_id(-1), edge_b_id(-1), edge_type(feNone), skip(false) {};
|
2013-09-07 19:08:53 +00:00
|
|
|
};
|
|
|
|
typedef std::vector<IntersectionLine> IntersectionLines;
|
2013-09-07 22:44:01 +00:00
|
|
|
typedef std::vector<IntersectionLine*> IntersectionLinePtrs;
|
2013-09-07 19:08:53 +00:00
|
|
|
|
2013-07-07 20:36:14 +00:00
|
|
|
}
|
|
|
|
|
2013-07-06 13:26:32 +00:00
|
|
|
#endif
|