52 for (
auto itr=inVrts.begin(); itr!=inVrts.end(); itr++)
53 vrts.emplace_back(*itr);
59 for (
auto itr=inVrts.begin(); itr!=inVrts.end(); itr++)
60 vrts.emplace_back((*itr)[0], (*itr)[1], (*itr)[2]);
66 std::vector<size_t> indxBuf;
67 quickhull::VertexDataSource<double> vrtBuf;
68 qHull =
new quickhull::QuickHull<double>();
69 auto hull =
qHull->getConvexHull(
vrts,
false,
false, 1.e-14);
70 indxBuf = hull.getIndexBuffer();
71 vrtBuf = hull.getVertexBuffer();
78 for (
int it=0; it<indxBuf.size(); it+=3)
81 for (
int idx=0; idx<3; idx++)
84 pnt.
x = (vrtBuf[indxBuf[it+idx]]).x;
85 pnt.
y = (vrtBuf[indxBuf[it+idx]]).y;
86 pnt.
z = (vrtBuf[indxBuf[it+idx]]).z;
102 for (
Face const& f :
fv) {
104 double d = p2f.
dot(f.normal());
107 constexpr
double bound = -1e-15;
127 std::ofstream myfile;
128 myfile.open((file_name +
".stl").c_str(), std::ios::out | std::ios::binary);
134 for (
auto it =
fv.begin(); it!=
fv.end(); it++){
138 myfile <<
"facet normal ";
139 myfile << n.
x <<
" " << n.
y <<
" " << n.
z <<
"\n";
141 myfile <<
"\touter loop\n";
143 for (
int iv=0; iv<3; iv++)
145 myfile <<
"\t\tvertex " 146 << (it->v[iv]).x <<
" " 147 << (it->v[iv]).y <<
" " 148 << (it->v[iv]).z <<
"\n";
150 myfile <<
"\tendloop\n";
151 myfile <<
"endfacet\n";
153 myfile <<
"endsolid " << file_name <<
"\n";
std::vector< NEM::MTH::Vector > v
void toSTL(std::string file_name) const
generate STL triangulation from the convex hull
double dot(Vector p) const
virtual void computeConvexHull()
calculating the convex hull
std::vector< quickhull::Vector3< double > > vrts
convexContainer()
default constructor
bool isInConvexPoly(NEM::MTH::Vector const &p)
check for point containment
virtual void setVertex(std::vector< std::vector< double > > &verts)
re-/setting vertice coordinates
quickhull::QuickHull< double > * qHull