Replaced redundant constructor and pushed the raw pointer constructor into private scope.

This commit is contained in:
Joseph Lenox 2018-07-12 23:48:53 -05:00
parent f0fd8240da
commit 238e32666a
2 changed files with 8 additions and 3 deletions

View File

@ -28,7 +28,6 @@ TriangleMesh::TriangleMesh()
stl_initialize(&this->stl);
}
TriangleMesh::TriangleMesh(const Pointf3s &points, const std::vector<Point3>& facets ) : TriangleMesh(points.data(), facets.data(), facets.size()) {}
TriangleMesh::TriangleMesh(const Pointf3* points, const Point3* facets, size_t n_facets)
: repaired(false)
{

View File

@ -36,10 +36,10 @@ class TriangleMesh
{
public:
TriangleMesh();
TriangleMesh(const Pointf3* points, const Point3* facets, size_t n_facets);
TriangleMesh(const Pointf3s &points, const std::vector<Point3> &facets);
/// Templated constructor to adapt containers that offer .data() and .size()
/// First argument is a container (either vector or array) of Pointf3 for the vertex data.
/// Second argument is container of facets (currently Point3).
template <typename Vertex_Cont, typename Facet_Cont>
TriangleMesh(const Vertex_Cont& vertices, const Facet_Cont& facets) : TriangleMesh(vertices.data(), facets.data(), facets.size()) {}
@ -143,6 +143,12 @@ class TriangleMesh
bool repaired;
private:
/// Private constructor that is called from the public sphere.
/// It doesn't do any bounds checking on points and operates on raw pointers, so we hide it.
/// Other constructors can call this one!
TriangleMesh(const Pointf3* points, const Point3* facets, size_t n_facets);
friend class TriangleMeshSlicer<X>;
friend class TriangleMeshSlicer<Y>;
friend class TriangleMeshSlicer<Z>;