PrusaSlicer-NonPlainar/xs/src/TriangleMesh.hpp

69 lines
1.7 KiB
C++
Raw Normal View History

2013-07-06 13:26:32 +00:00
#ifndef slic3r_TriangleMesh_hpp_
#define slic3r_TriangleMesh_hpp_
#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
namespace Slic3r {
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();
SV* to_SV();
2013-06-24 17:35:49 +00:00
void ReadSTLFile(char* input_file);
void write_ascii(char* output_file);
void write_binary(char* output_file);
2013-07-03 09:38:01 +00:00
void ReadFromPerl(SV* vertices, SV* facets);
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);
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);
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-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-06 13:26:32 +00:00
#endif