1 #ifndef SLA_CONTOUR3D_HPP 2 #define SLA_CONTOUR3D_HPP 3 4 #include <libslic3r/TriangleMesh.hpp> 5 6 namespace Slic3r { 7 8 // Used for quads (TODO: remove this, and convert quads to triangles in OpenVDBUtils) 9 using Vec4i = Eigen::Matrix<int, 4, 1, Eigen::DontAlign>; 10 11 namespace sla { 12 13 class IndexedMesh; 14 15 /// Dumb vertex mesh consisting of triangles (or) quads. Capable of merging with 16 /// other meshes of this type and converting to and from other mesh formats. 17 struct Contour3D { 18 std::vector<Vec3d> points; 19 std::vector<Vec3i> faces3; 20 std::vector<Vec4i> faces4; 21 22 Contour3D() = default; 23 Contour3D(const TriangleMesh &trmesh); 24 Contour3D(TriangleMesh &&trmesh); 25 Contour3D(const IndexedMesh &emesh); 26 27 Contour3D& merge(const Contour3D& ctr); 28 Contour3D& merge(const Pointf3s& triangles); 29 30 // Write the index triangle structure to OBJ file for debugging purposes. 31 void to_obj(std::ostream& stream); 32 void from_obj(std::istream &stream); 33 emptySlic3r::sla::Contour3D34 inline bool empty() const 35 { 36 return points.empty() || (faces4.empty() && faces3.empty()); 37 } 38 }; 39 40 /// Mesh from an existing contour. 41 TriangleMesh to_triangle_mesh(const Contour3D& ctour); 42 43 /// Mesh from an evaporating 3D contour 44 TriangleMesh to_triangle_mesh(Contour3D&& ctour); 45 46 }} // namespace Slic3r::sla 47 48 #endif // CONTOUR3D_HPP 49