]> git.sur5r.net Git - fstl/blob - src/mesh.h
Mostly complete from the Python original
[fstl] / src / mesh.h
1 #ifndef MESH_H
2 #define MESH_H
3
4 #include <QString>
5
6 #include <Eigen/Dense>
7
8 class Mesh
9 {
10 public:
11     Mesh(const Eigen::Matrix3Xf &vertices, const Eigen::Matrix3Xi &indices);
12     static Mesh* load_stl(const QString& filename);
13
14     float xmin() const { return vertices.row(0).minCoeff(); }
15     float xmax() const { return vertices.row(0).maxCoeff(); }
16     float ymin() const { return vertices.row(1).minCoeff(); }
17     float ymax() const { return vertices.row(1).maxCoeff(); }
18     float zmin() const { return vertices.row(2).minCoeff(); }
19     float zmax() const { return vertices.row(2).maxCoeff(); }
20
21 private:
22     const Eigen::Matrix3Xf vertices;
23     const Eigen::Matrix3Xi indices;
24
25     friend class GLMesh;
26 };
27
28 #endif // MESH_H