outer_hull.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. #include "outer_hull.h"
  2. #include "outer_facet.h"
  3. #include "sortrows.h"
  4. #include "facet_components.h"
  5. #include "winding_number.h"
  6. #include "triangle_triangle_adjacency.h"
  7. #include "unique_edge_map.h"
  8. #include "barycenter.h"
  9. #include "per_face_normals.h"
  10. #include <Eigen/Geometry>
  11. #include <vector>
  12. #include <map>
  13. #include <queue>
  14. #include <iostream>
  15. //#define IGL_OUTER_HULL_DEBUG
  16. template <
  17. typename DerivedV,
  18. typename DerivedF,
  19. typename DerivedN,
  20. typename DerivedG,
  21. typename DerivedJ,
  22. typename Derivedflip>
  23. IGL_INLINE void igl::outer_hull(
  24. const Eigen::PlainObjectBase<DerivedV> & V,
  25. const Eigen::PlainObjectBase<DerivedF> & F,
  26. const Eigen::PlainObjectBase<DerivedN> & N,
  27. Eigen::PlainObjectBase<DerivedG> & G,
  28. Eigen::PlainObjectBase<DerivedJ> & J,
  29. Eigen::PlainObjectBase<Derivedflip> & flip)
  30. {
  31. using namespace Eigen;
  32. using namespace std;
  33. using namespace igl;
  34. typedef typename DerivedF::Index Index;
  35. Matrix<Index,DerivedF::RowsAtCompileTime,1> C;
  36. typedef Matrix<typename DerivedV::Scalar,Dynamic,DerivedV::ColsAtCompileTime> MatrixXV;
  37. typedef Matrix<typename DerivedF::Scalar,Dynamic,DerivedF::ColsAtCompileTime> MatrixXF;
  38. typedef Matrix<typename DerivedG::Scalar,Dynamic,DerivedG::ColsAtCompileTime> MatrixXG;
  39. typedef Matrix<typename DerivedJ::Scalar,Dynamic,DerivedJ::ColsAtCompileTime> MatrixXJ;
  40. typedef Matrix<typename DerivedN::Scalar,1,3> RowVector3N;
  41. const Index m = F.rows();
  42. const auto & duplicate_simplex = [&F](const int f, const int g)->bool
  43. {
  44. return
  45. (F(f,0) == F(g,0) && F(f,1) == F(g,1) && F(f,2) == F(g,2)) ||
  46. (F(f,1) == F(g,0) && F(f,2) == F(g,1) && F(f,0) == F(g,2)) ||
  47. (F(f,2) == F(g,0) && F(f,0) == F(g,1) && F(f,1) == F(g,2)) ||
  48. (F(f,0) == F(g,2) && F(f,1) == F(g,1) && F(f,2) == F(g,0)) ||
  49. (F(f,1) == F(g,2) && F(f,2) == F(g,1) && F(f,0) == F(g,0)) ||
  50. (F(f,2) == F(g,2) && F(f,0) == F(g,1) && F(f,1) == F(g,0));
  51. };
  52. #ifdef IGL_OUTER_HULL_DEBUG
  53. cout<<"outer hull..."<<endl;
  54. #endif
  55. #ifdef IGL_OUTER_HULL_DEBUG
  56. cout<<"edge map..."<<endl;
  57. #endif
  58. typedef Matrix<typename DerivedF::Scalar,Dynamic,2> MatrixX2I;
  59. typedef Matrix<typename DerivedF::Index,Dynamic,1> VectorXI;
  60. MatrixX2I E,uE;
  61. VectorXI EMAP;
  62. vector<vector<typename DerivedF::Index> > uE2E;
  63. unique_edge_map(F,E,uE,EMAP,uE2E);
  64. // TODO:
  65. // uE --> face-edge index, sorted CCW around edge according to normal
  66. // uE --> sorted order index
  67. // uE --> bool, whether needed to flip face to make "consistent" with unique
  68. // edge
  69. // Place order of each half-edge in its corresponding sorted list around edge
  70. VectorXI diIM(3*m);
  71. // Whether face's edge used for sorting is consistent with unique edge
  72. VectorXI dicons(3*m);
  73. // dihedral angles of faces around edge with face of edge in dicons
  74. vector<vector<typename DerivedV::Scalar> > di(uE2E.size());
  75. // For each list of face-edges incide on a unique edge
  76. for(size_t ui = 0;ui<(size_t)uE.rows();ui++)
  77. {
  78. // Base normal vector to orient against
  79. const auto fe0 = uE2E[ui][0];
  80. const RowVector3N & eVp = N.row(fe0%m);
  81. MatrixXd di_I(uE2E[ui].size(),2);
  82. const typename DerivedF::Scalar d = F(fe0%m,((fe0/m)+2)%3);
  83. const typename DerivedF::Scalar s = F(fe0%m,((fe0/m)+1)%3);
  84. // Edge vector
  85. const auto & eV = (V.row(d)-V.row(s)).normalized();
  86. vector<bool> cons(uE2E[ui].size());
  87. // Loop over incident face edges
  88. for(size_t fei = 0;fei<uE2E[ui].size();fei++)
  89. {
  90. const auto & fe = uE2E[ui][fei];
  91. const auto f = fe % m;
  92. const auto c = fe / m;
  93. // source should match destination to be consistent
  94. cons[fei] = (d == F(f,(c+1)%3));
  95. assert( cons[fei] || (d == F(f,(c+2)%3)));
  96. assert(!cons[fei] || (s == F(f,(c+2)%3)));
  97. assert(!cons[fei] || (d == F(f,(c+1)%3)));
  98. // Angle between n and f
  99. const RowVector3N & n = N.row(f);
  100. di_I(fei,0) = M_PI - atan2( eVp.cross(n).dot(eV), eVp.dot(n));
  101. if(!cons[fei])
  102. {
  103. di_I(fei,0) = di_I(fei,0) + M_PI;
  104. if(di_I(fei,0)>=2.*M_PI)
  105. {
  106. di_I(fei,0) = di_I(fei,0) - 2.*M_PI;
  107. }
  108. }
  109. // This signing is very important to make sure different edges sort
  110. // duplicate faces the same way, regardless of their orientations
  111. di_I(fei,1) = (cons[fei]?1.:-1.)*f;
  112. }
  113. // Despite the effort to get stable normals the atan2 up doesn't
  114. // compute (exactly) -θ for -n if it computes θ for n. So just
  115. // explicitly check if there's a duplicate face
  116. // Shitty O(val^2) implementation
  117. for(size_t fei = 0;fei<uE2E[ui].size();fei++)
  118. {
  119. const auto & fe = uE2E[ui][fei];
  120. const auto f = fe % m;
  121. for(size_t gei = fei+1;gei<uE2E[ui].size();gei++)
  122. {
  123. const auto & ge = uE2E[ui][gei];
  124. const auto g = ge % m;
  125. if(duplicate_simplex(f,g))
  126. {
  127. #ifdef IGL_OUTER_HULL_DEBUG
  128. cout<<"Forcing duplicate: "<<(f+1)<<","<<(g+1)<<endl;
  129. #endif
  130. di_I(gei,0) = di_I(fei,0);
  131. }
  132. }
  133. }
  134. VectorXi IM;
  135. //igl::sort(di[ui],true,di[ui],IM);
  136. // Sort, but break ties using "signed index" to ensure that duplicates
  137. // always show up in same order.
  138. MatrixXd s_di_I;
  139. igl::sortrows(di_I,true,s_di_I,IM);
  140. di[ui].resize(uE2E[ui].size());
  141. for(size_t i = 0;i<di[ui].size();i++)
  142. {
  143. di[ui][i] = s_di_I(i,0);
  144. }
  145. // copy old list
  146. vector<typename DerivedF::Index> temp = uE2E[ui];
  147. for(size_t fei = 0;fei<uE2E[ui].size();fei++)
  148. {
  149. uE2E[ui][fei] = temp[IM(fei)];
  150. const auto & fe = uE2E[ui][fei];
  151. diIM(fe) = fei;
  152. dicons(fe) = cons[IM(fei)];
  153. }
  154. }
  155. vector<vector<vector<Index > > > TT,_1;
  156. triangle_triangle_adjacency(E,EMAP,uE2E,false,TT,_1);
  157. VectorXI counts;
  158. #ifdef IGL_OUTER_HULL_DEBUG
  159. cout<<"facet components..."<<endl;
  160. #endif
  161. facet_components(TT,C,counts);
  162. assert(C.maxCoeff()+1 == counts.rows());
  163. const size_t ncc = counts.rows();
  164. G.resize(0,F.cols());
  165. J.resize(0,1);
  166. flip.setConstant(m,1,false);
  167. #ifdef IGL_OUTER_HULL_DEBUG
  168. cout<<"reindex..."<<endl;
  169. #endif
  170. // H contains list of faces on outer hull;
  171. vector<bool> FH(m,false);
  172. vector<bool> EH(3*m,false);
  173. vector<MatrixXG> vG(ncc);
  174. vector<MatrixXJ> vJ(ncc);
  175. vector<MatrixXJ> vIM(ncc);
  176. for(size_t id = 0;id<ncc;id++)
  177. {
  178. vIM[id].resize(counts[id],1);
  179. }
  180. // current index into each IM
  181. vector<size_t> g(ncc,0);
  182. // place order of each face in its respective component
  183. for(Index f = 0;f<m;f++)
  184. {
  185. vIM[C(f)](g[C(f)]++) = f;
  186. }
  187. #ifdef IGL_OUTER_HULL_DEBUG
  188. cout<<"barycenters..."<<endl;
  189. #endif
  190. // assumes that "resolve" has handled any coplanar cases correctly and nearly
  191. // coplanar cases can be sorted based on barycenter.
  192. MatrixXV BC;
  193. barycenter(V,F,BC);
  194. #ifdef IGL_OUTER_HULL_DEBUG
  195. cout<<"loop over CCs (="<<ncc<<")..."<<endl;
  196. #endif
  197. for(Index id = 0;id<(Index)ncc;id++)
  198. {
  199. auto & IM = vIM[id];
  200. // starting face that's guaranteed to be on the outer hull and in this
  201. // component
  202. int f;
  203. bool f_flip;
  204. #ifdef IGL_OUTER_HULL_DEBUG
  205. cout<<"outer facet..."<<endl;
  206. #endif
  207. outer_facet(V,F,N,IM,f,f_flip);
  208. #ifdef IGL_OUTER_HULL_DEBUG
  209. cout<<"outer facet: "<<f<<endl;
  210. #endif
  211. int FHcount = 1;
  212. FH[f] = true;
  213. // Q contains list of face edges to continue traversing upong
  214. queue<int> Q;
  215. Q.push(f+0*m);
  216. Q.push(f+1*m);
  217. Q.push(f+2*m);
  218. flip(f) = f_flip;
  219. //cout<<"flip("<<f<<") = "<<(flip(f)?"true":"false")<<endl;
  220. #ifdef IGL_OUTER_HULL_DEBUG
  221. cout<<"BFS..."<<endl;
  222. #endif
  223. while(!Q.empty())
  224. {
  225. // face-edge
  226. const int e = Q.front();
  227. Q.pop();
  228. // face
  229. const int f = e%m;
  230. // corner
  231. const int c = e/m;
  232. // Should never see edge again...
  233. if(EH[e] == true)
  234. {
  235. continue;
  236. }
  237. EH[e] = true;
  238. // source of edge according to f
  239. const int fs = flip(f)?F(f,(c+2)%3):F(f,(c+1)%3);
  240. // destination of edge according to f
  241. const int fd = flip(f)?F(f,(c+1)%3):F(f,(c+2)%3);
  242. // edge valence
  243. const size_t val = uE2E[EMAP(e)].size();
  244. //// find overlapping face-edges
  245. //const auto & neighbors = uE2E[EMAP(e)];
  246. //// normal after possible flipping
  247. //const auto & fN = (flip(f)?-1.:1.)*N.row(f);
  248. //// Edge vector according to f's (flipped) orientation.
  249. ////const auto & eV = (V.row(fd)-V.row(fs)).normalized();
  250. //#warning "EXPERIMENTAL, DO NOT USE"
  251. //// THIS IS WRONG! The first face is---after sorting---no longer the face
  252. //// used for orienting the sort.
  253. //const auto ui = EMAP(e);
  254. //const auto fe0 = uE2E[ui][0];
  255. //const auto es = F(fe0%m,((fe0/m)+1)%3);
  256. // is edge consistent with edge of face used for sorting
  257. const int e_cons = (dicons(e) ? 1: -1);
  258. int nfei = -1;
  259. // Loop once around trying to find suitable next face
  260. for(size_t step = 1; step<val+2;step++)
  261. {
  262. const int nfei_new = (diIM(e) + 2*val + e_cons*step*(flip(f)?-1:1))%val;
  263. const int nf = uE2E[EMAP(e)][nfei_new] % m;
  264. // Don't consider faces with identical dihedral angles
  265. if((di[EMAP(e)][diIM(e)] != di[EMAP(e)][nfei_new]))
  266. //#warning "THIS IS HACK, FIX ME"
  267. // if( abs(di[EMAP(e)][diIM(e)] - di[EMAP(e)][nfei_new]) < 1e-16 )
  268. {
  269. #ifdef IGL_OUTER_HULL_DEBUG
  270. cout<<"Next facet: "<<(f+1)<<" --> "<<(nf+1)<<", |"<<
  271. di[EMAP(e)][diIM(e)]<<" - "<<di[EMAP(e)][nfei_new]<<"| = "<<
  272. abs(di[EMAP(e)][diIM(e)] - di[EMAP(e)][nfei_new])
  273. <<endl;
  274. #endif
  275. // Only use this face if not already seen
  276. if(!FH[nf])
  277. {
  278. nfei = nfei_new;
  279. }
  280. break;
  281. }
  282. //#ifdef IGL_OUTER_HULL_DEBUG
  283. // cout<<"Skipping co-planar facet: "<<(f+1)<<" --> "<<(nf+1)<<endl;
  284. //#endif
  285. }
  286. int max_ne = -1;
  287. //// Loop over and find max dihedral angle
  288. //typename DerivedV::Scalar max_di = -1;
  289. //for(const auto & ne : neighbors)
  290. //{
  291. // const int nf = ne%m;
  292. // if(nf == f)
  293. // {
  294. // continue;
  295. // }
  296. // // Corner of neighbor
  297. // const int nc = ne/m;
  298. // // Is neighbor oriented consistently with (flipped) f?
  299. // //const int ns = F(nf,(nc+1)%3);
  300. // const int nd = F(nf,(nc+2)%3);
  301. // const bool cons = (flip(f)?fd:fs) == nd;
  302. // // Normal after possibly flipping to match flip or orientation of f
  303. // const auto & nN = (cons? (flip(f)?-1:1.) : (flip(f)?1.:-1.) )*N.row(nf);
  304. // // Angle between n and f
  305. // const auto & ndi = M_PI - atan2( fN.cross(nN).dot(eV), fN.dot(nN));
  306. // if(ndi>=max_di)
  307. // {
  308. // max_ne = ne;
  309. // max_di = ndi;
  310. // }
  311. //}
  312. ////cout<<(max_ne != max_ne_2)<<" =?= "<<e_cons<<endl;
  313. //if(max_ne != max_ne_2)
  314. //{
  315. // cout<<(f+1)<<" ---> "<<(max_ne%m)+1<<" != "<<(max_ne_2%m)+1<<" ... "<<e_cons<<" "<<flip(f)<<endl;
  316. // typename DerivedV::Scalar max_di = -1;
  317. // for(size_t nei = 0;nei<neighbors.size();nei++)
  318. // {
  319. // const auto & ne = neighbors[nei];
  320. // const int nf = ne%m;
  321. // if(nf == f)
  322. // {
  323. // cout<<" "<<(ne%m)+1<<":\t"<<0<<"\t"<<di[EMAP[e]][nei]<<" "<<diIM(ne)<<endl;
  324. // continue;
  325. // }
  326. // // Corner of neighbor
  327. // const int nc = ne/m;
  328. // // Is neighbor oriented consistently with (flipped) f?
  329. // //const int ns = F(nf,(nc+1)%3);
  330. // const int nd = F(nf,(nc+2)%3);
  331. // const bool cons = (flip(f)?fd:fs) == nd;
  332. // // Normal after possibly flipping to match flip or orientation of f
  333. // const auto & nN = (cons? (flip(f)?-1:1.) : (flip(f)?1.:-1.) )*N.row(nf);
  334. // // Angle between n and f
  335. // const auto & ndi = M_PI - atan2( fN.cross(nN).dot(eV), fN.dot(nN));
  336. // cout<<" "<<(ne%m)+1<<":\t"<<ndi<<"\t"<<di[EMAP[e]][nei]<<" "<<diIM(ne)<<endl;
  337. // if(ndi>=max_di)
  338. // {
  339. // max_ne = ne;
  340. // max_di = ndi;
  341. // }
  342. // }
  343. //}
  344. if(nfei >= 0)
  345. {
  346. max_ne = uE2E[EMAP(e)][nfei];
  347. }
  348. if(max_ne>=0)
  349. {
  350. // face of neighbor
  351. const int nf = max_ne%m;
  352. #ifdef IGL_OUTER_HULL_DEBUG
  353. if(!FH[nf])
  354. {
  355. // first time seeing face
  356. cout<<(f+1)<<" --> "<<(nf+1)<<endl;
  357. }
  358. #endif
  359. FH[nf] = true;
  360. FHcount++;
  361. // corner of neighbor
  362. const int nc = max_ne/m;
  363. const int nd = F(nf,(nc+2)%3);
  364. const bool cons = (flip(f)?fd:fs) == nd;
  365. flip(nf) = (cons ? flip(f) : !flip(f));
  366. //cout<<"flip("<<nf<<") = "<<(flip(nf)?"true":"false")<<endl;
  367. const int ne1 = nf+((nc+1)%3)*m;
  368. const int ne2 = nf+((nc+2)%3)*m;
  369. if(!EH[ne1])
  370. {
  371. Q.push(ne1);
  372. }
  373. if(!EH[ne2])
  374. {
  375. Q.push(ne2);
  376. }
  377. }
  378. }
  379. {
  380. vG[id].resize(FHcount,3);
  381. vJ[id].resize(FHcount,1);
  382. //nG += FHcount;
  383. size_t h = 0;
  384. assert(counts(id) == IM.rows());
  385. for(int i = 0;i<counts(id);i++)
  386. {
  387. const size_t f = IM(i);
  388. //if(f_flip)
  389. //{
  390. // flip(f) = !flip(f);
  391. //}
  392. if(FH[f])
  393. {
  394. vG[id].row(h) = (flip(f)?F.row(f).reverse().eval():F.row(f));
  395. vJ[id](h,0) = f;
  396. h++;
  397. }
  398. }
  399. assert((int)h == FHcount);
  400. }
  401. }
  402. // Is A inside B? Assuming A and B are consistently oriented but closed and
  403. // non-intersecting.
  404. const auto & is_component_inside_other = [](
  405. const Eigen::PlainObjectBase<DerivedV> & V,
  406. const MatrixXV & BC,
  407. const MatrixXG & A,
  408. const MatrixXJ & AJ,
  409. const MatrixXG & B)->bool
  410. {
  411. const auto & bounding_box = [](
  412. const Eigen::PlainObjectBase<DerivedV> & V,
  413. const MatrixXG & F)->
  414. MatrixXV
  415. {
  416. MatrixXV BB(2,3);
  417. BB<<
  418. 1e26,1e26,1e26,
  419. -1e26,-1e26,-1e26;
  420. const size_t m = F.rows();
  421. for(size_t f = 0;f<m;f++)
  422. {
  423. for(size_t c = 0;c<3;c++)
  424. {
  425. const auto & vfc = V.row(F(f,c));
  426. BB.row(0) = BB.row(0).array().min(vfc.array()).eval();
  427. BB.row(1) = BB.row(1).array().max(vfc.array()).eval();
  428. }
  429. }
  430. return BB;
  431. };
  432. // A lot of the time we're dealing with unrelated, distant components: cull
  433. // them.
  434. MatrixXV ABB = bounding_box(V,A);
  435. MatrixXV BBB = bounding_box(V,B);
  436. if( (BBB.row(0)-ABB.row(1)).maxCoeff()>0 ||
  437. (ABB.row(0)-BBB.row(1)).maxCoeff()>0 )
  438. {
  439. // bounding boxes do not overlap
  440. return false;
  441. }
  442. ////////////////////////////////////////////////////////////////////////
  443. // POTENTIAL ROBUSTNESS WEAK AREA
  444. ////////////////////////////////////////////////////////////////////////
  445. //
  446. // q could be so close (<~1e-16) to B that the winding number is not a robust way to
  447. // determine inside/outsideness. We could try to find a _better_ q which is
  448. // farther away, but couldn't they all be bad?
  449. MatrixXV q = BC.row(AJ(0));
  450. // In a perfect world, it's enough to test a single point.
  451. double w;
  452. // winding_number_3 expects colmajor
  453. const typename DerivedV::Scalar * Vdata;
  454. Vdata = V.data();
  455. Matrix<
  456. typename DerivedV::Scalar,
  457. DerivedV::RowsAtCompileTime,
  458. DerivedV::ColsAtCompileTime,
  459. ColMajor> Vcol;
  460. if(DerivedV::IsRowMajor)
  461. {
  462. // copy to convert to colmajor
  463. Vcol = V;
  464. Vdata = Vcol.data();
  465. }
  466. winding_number_3(
  467. Vdata,V.rows(),
  468. B.data(),B.rows(),
  469. q.data(),1,&w);
  470. return fabs(w)>0.5;
  471. };
  472. // Reject components which are completely inside other components
  473. vector<bool> keep(ncc,true);
  474. size_t nG = 0;
  475. // This is O( ncc * ncc * m)
  476. for(size_t id = 0;id<ncc;id++)
  477. {
  478. for(size_t oid = 0;oid<ncc;oid++)
  479. {
  480. if(id == oid)
  481. {
  482. continue;
  483. }
  484. const bool inside = is_component_inside_other(V,BC,vG[id],vJ[id],vG[oid]);
  485. #ifdef IGL_OUTER_HULL_DEBUG
  486. cout<<id<<" is inside "<<oid<<" ? "<<inside<<endl;
  487. #endif
  488. keep[id] = keep[id] && !inside;
  489. }
  490. if(keep[id])
  491. {
  492. nG += vJ[id].rows();
  493. }
  494. }
  495. // collect G and J across components
  496. G.resize(nG,3);
  497. J.resize(nG,1);
  498. {
  499. size_t off = 0;
  500. for(Index id = 0;id<(Index)ncc;id++)
  501. {
  502. if(keep[id])
  503. {
  504. assert(vG[id].rows() == vJ[id].rows());
  505. G.block(off,0,vG[id].rows(),vG[id].cols()) = vG[id];
  506. J.block(off,0,vJ[id].rows(),vJ[id].cols()) = vJ[id];
  507. off += vG[id].rows();
  508. }
  509. }
  510. }
  511. }
  512. template <
  513. typename DerivedV,
  514. typename DerivedF,
  515. typename DerivedG,
  516. typename DerivedJ,
  517. typename Derivedflip>
  518. IGL_INLINE void igl::outer_hull(
  519. const Eigen::PlainObjectBase<DerivedV> & V,
  520. const Eigen::PlainObjectBase<DerivedF> & F,
  521. Eigen::PlainObjectBase<DerivedG> & G,
  522. Eigen::PlainObjectBase<DerivedJ> & J,
  523. Eigen::PlainObjectBase<Derivedflip> & flip)
  524. {
  525. Eigen::Matrix<typename DerivedV::Scalar,DerivedF::RowsAtCompileTime,3> N;
  526. per_face_normals_stable(V,F,N);
  527. return outer_hull(V,F,N,G,J,flip);
  528. }
  529. #ifdef IGL_STATIC_LIBRARY
  530. // Explicit template specialization
  531. template void igl::outer_hull<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<bool, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<bool, -1, 1, 0, -1, 1> >&);
  532. template void igl::outer_hull<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
  533. template void igl::outer_hull<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<bool, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<bool, -1, 1, 0, -1, 1> >&);
  534. #endif