sort_triangles.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. #include "sort_triangles.h"
  2. #include "barycenter.h"
  3. #include "sort.h"
  4. #include "sortrows.h"
  5. #include "slice.h"
  6. #include "round.h"
  7. #include "colon.h"
  8. #include "matlab_format.h"
  9. #include <iostream>
  10. template <
  11. typename DerivedV,
  12. typename DerivedF,
  13. typename DerivedMV,
  14. typename DerivedP,
  15. typename DerivedFF,
  16. typename DerivedI>
  17. IGL_INLINE void igl::sort_triangles(
  18. const Eigen::PlainObjectBase<DerivedV> & V,
  19. const Eigen::PlainObjectBase<DerivedF> & F,
  20. const Eigen::PlainObjectBase<DerivedMV> & MV,
  21. const Eigen::PlainObjectBase<DerivedP> & P,
  22. Eigen::PlainObjectBase<DerivedFF> & FF,
  23. Eigen::PlainObjectBase<DerivedI> & I)
  24. {
  25. using namespace Eigen;
  26. using namespace igl;
  27. using namespace std;
  28. // Barycenter, centroid
  29. Eigen::Matrix<typename DerivedV::Scalar, DerivedF::RowsAtCompileTime,1> D,sD;
  30. Eigen::Matrix<typename DerivedV::Scalar, DerivedF::RowsAtCompileTime,4> BC,PBC;
  31. barycenter(V,F,BC);
  32. D = BC*(MV.transpose()*P.transpose().eval().col(2));
  33. sort(D,1,false,sD,I);
  34. //// Closest corner
  35. //Eigen::Matrix<typename DerivedV::Scalar, DerivedF::RowsAtCompileTime,1> D,sD;
  36. //D.setConstant(F.rows(),1,-1e26);
  37. //for(int c = 0;c<3;c++)
  38. //{
  39. // Eigen::Matrix<typename DerivedV::Scalar, DerivedF::RowsAtCompileTime,4> C;
  40. // Eigen::Matrix<typename DerivedV::Scalar, DerivedF::RowsAtCompileTime,1> DC;
  41. // C.resize(F.rows(),4);
  42. // for(int f = 0;f<F.rows();f++)
  43. // {
  44. // C(f,0) = V(F(f,c),0);
  45. // C(f,1) = V(F(f,c),1);
  46. // C(f,2) = V(F(f,c),2);
  47. // C(f,3) = 1;
  48. // }
  49. // DC = C*(MV.transpose()*P.transpose().eval().col(2));
  50. // D = (DC.array()>D.array()).select(DC,D).eval();
  51. //}
  52. //sort(D,1,false,sD,I);
  53. //// Closest corner with tie breaks
  54. //Eigen::Matrix<typename DerivedV::Scalar, DerivedF::RowsAtCompileTime,3> D,sD,ssD;
  55. //D.resize(F.rows(),3);
  56. //for(int c = 0;c<3;c++)
  57. //{
  58. // Eigen::Matrix<typename DerivedV::Scalar, DerivedF::RowsAtCompileTime,4> C;
  59. // C.resize(F.rows(),4);
  60. // for(int f = 0;f<F.rows();f++)
  61. // {
  62. // C(f,0) = V(F(f,c),0);
  63. // C(f,1) = V(F(f,c),1);
  64. // C(f,2) = V(F(f,c),2);
  65. // C(f,3) = 1;
  66. // }
  67. // D.col(c) = C*(MV.transpose()*P.transpose().eval().col(2));
  68. //}
  69. //VectorXi _;
  70. //sort(D,2,false,sD,_);
  71. //sortrows(sD,false,ssD,I);
  72. slice(F,I,1,FF);
  73. }
  74. #ifndef IGL_NO_OPENGL
  75. #include "OpenGL_convenience.h"
  76. template <
  77. typename DerivedV,
  78. typename DerivedF,
  79. typename DerivedFF,
  80. typename DerivedI>
  81. void igl::sort_triangles(
  82. const Eigen::PlainObjectBase<DerivedV> & V,
  83. const Eigen::PlainObjectBase<DerivedF> & F,
  84. Eigen::PlainObjectBase<DerivedFF> & FF,
  85. Eigen::PlainObjectBase<DerivedI> & I)
  86. {
  87. using namespace Eigen;
  88. using namespace igl;
  89. using namespace std;
  90. // Put model, projection, and viewport matrices into double arrays
  91. Matrix4d MV;
  92. Matrix4d P;
  93. glGetDoublev(GL_MODELVIEW_MATRIX, MV.data());
  94. glGetDoublev(GL_PROJECTION_MATRIX, P.data());
  95. if(V.cols() == 3)
  96. {
  97. Matrix<typename DerivedV::Scalar, DerivedV::RowsAtCompileTime,4> hV;
  98. hV.resize(V.rows(),4);
  99. hV.block(0,0,V.rows(),V.cols()) = V;
  100. hV.col(3).setConstant(1);
  101. return sort_triangles(hV,F,MV,P,FF,I);
  102. }else
  103. {
  104. return sort_triangles(V,F,MV,P,FF,I);
  105. }
  106. }
  107. #include "project.h"
  108. #include <iostream>
  109. template <
  110. typename DerivedV,
  111. typename DerivedF,
  112. typename DerivedFF,
  113. typename DerivedI>
  114. void igl::sort_triangles_slow(
  115. const Eigen::PlainObjectBase<DerivedV> & V,
  116. const Eigen::PlainObjectBase<DerivedF> & F,
  117. Eigen::PlainObjectBase<DerivedFF> & FF,
  118. Eigen::PlainObjectBase<DerivedI> & I)
  119. {
  120. using namespace Eigen;
  121. using namespace igl;
  122. using namespace std;
  123. // Barycenter, centroid
  124. Eigen::Matrix<typename DerivedV::Scalar, DerivedF::RowsAtCompileTime,1> D,sD;
  125. Eigen::Matrix<typename DerivedV::Scalar, DerivedF::RowsAtCompileTime,3> BC;
  126. D.resize(F.rows(),3);
  127. barycenter(V,F,BC);
  128. for(int f = 0;f<F.rows();f++)
  129. {
  130. Eigen::Matrix<typename DerivedV::Scalar, 3,1> bc,pbc;
  131. bc = BC.row(f);
  132. project(bc,pbc);
  133. D(f) = pbc(2);
  134. }
  135. sort(D,1,false,sD,I);
  136. slice(F,I,1,FF);
  137. }
  138. #include "EPS.h"
  139. #include <functional>
  140. #include <algorithm>
  141. static int tough_count = 0;
  142. template <typename Vec3>
  143. class Triangle
  144. {
  145. public:
  146. static inline bool z_comp(const Vec3 & A, const Vec3 & B)
  147. {
  148. return A(2) > B(2);
  149. }
  150. static typename Vec3::Scalar ZERO()
  151. {
  152. return igl::EPS<typename Vec3::Scalar>();
  153. return 0;
  154. }
  155. public:
  156. int id;
  157. // Sorted projected coners: c[0] has smallest z value
  158. Vec3 c[3];
  159. Vec3 n;
  160. public:
  161. Triangle():id(-1) { };
  162. Triangle(int id, const Vec3 c0, const Vec3 c1, const Vec3 c2):
  163. id(id)
  164. {
  165. using namespace std;
  166. c[0] = c0;
  167. c[1] = c1;
  168. c[2] = c2;
  169. sort(c,c+3,Triangle<Vec3>::z_comp);
  170. // normal pointed toward viewpoint
  171. n = (c0-c1).cross(c2-c0);
  172. if(n(2) < 0)
  173. {
  174. n *= -1.0;
  175. }
  176. // Avoid NaNs
  177. typename Vec3::Scalar len = n.norm();
  178. if(len == 0)
  179. {
  180. cout<<"avoid NaN"<<endl;
  181. assert(false);
  182. len = 1;
  183. }
  184. n /= len;
  185. };
  186. typename Vec3::Scalar project(const Vec3 & r) const
  187. {
  188. //return n.dot(r-c[2]);
  189. int closest = -1;
  190. typename Vec3::Scalar min_dist = 1e26;
  191. for(int ci = 0;ci<3;ci++)
  192. {
  193. typename Vec3::Scalar dist = (c[ci]-r).norm();
  194. if(dist < min_dist)
  195. {
  196. min_dist = dist;
  197. closest = ci;
  198. }
  199. }
  200. assert(closest>=0);
  201. return n.dot(r-c[closest]);
  202. }
  203. // Z-values of this are < z-values of that
  204. bool is_completely_behind(const Triangle & that) const
  205. {
  206. const typename Vec3::Scalar ac0 = that.c[0](2);
  207. const typename Vec3::Scalar ac1 = that.c[1](2);
  208. const typename Vec3::Scalar ac2 = that.c[2](2);
  209. const typename Vec3::Scalar ic0 = this->c[0](2);
  210. const typename Vec3::Scalar ic1 = this->c[1](2);
  211. const typename Vec3::Scalar ic2 = this->c[2](2);
  212. return
  213. (ic0 < ac2 && ic1 <= ac2 && ic2 <= ac2) ||
  214. (ic0 <= ac2 && ic1 < ac2 && ic2 <= ac2) ||
  215. (ic0 <= ac2 && ic1 <= ac2 && ic2 < ac2);
  216. }
  217. bool is_behind_plane(const Triangle &that) const
  218. {
  219. using namespace std;
  220. const typename Vec3::Scalar apc0 = that.project(this->c[0]);
  221. const typename Vec3::Scalar apc1 = that.project(this->c[1]);
  222. const typename Vec3::Scalar apc2 = that.project(this->c[2]);
  223. cout<<" "<<
  224. apc0<<", "<<
  225. apc1<<", "<<
  226. apc2<<", "<<endl;
  227. return (apc0 < ZERO() && apc1 < ZERO() && apc2 < ZERO());
  228. }
  229. bool is_in_front_of_plane(const Triangle &that) const
  230. {
  231. using namespace std;
  232. const typename Vec3::Scalar apc0 = that.project(this->c[0]);
  233. const typename Vec3::Scalar apc1 = that.project(this->c[1]);
  234. const typename Vec3::Scalar apc2 = that.project(this->c[2]);
  235. cout<<" "<<
  236. apc0<<", "<<
  237. apc1<<", "<<
  238. apc2<<", "<<endl;
  239. return (apc0 > ZERO() && apc1 > ZERO() && apc2 > ZERO());
  240. }
  241. bool is_coplanar(const Triangle &that) const
  242. {
  243. using namespace std;
  244. const typename Vec3::Scalar apc0 = that.project(this->c[0]);
  245. const typename Vec3::Scalar apc1 = that.project(this->c[1]);
  246. const typename Vec3::Scalar apc2 = that.project(this->c[2]);
  247. return (fabs(apc0)<=ZERO() && fabs(apc1)<=ZERO() && fabs(apc2)<=ZERO());
  248. }
  249. // http://stackoverflow.com/a/14561664/148668
  250. // a1 is line1 start, a2 is line1 end, b1 is line2 start, b2 is line2 end
  251. static bool seg_seg_intersect(const Vec3 & a1, const Vec3 & a2, const Vec3 & b1, const Vec3 & b2)
  252. {
  253. Vec3 b = a2-a1;
  254. Vec3 d = b2-b1;
  255. typename Vec3::Scalar bDotDPerp = b(0) * d(1) - b(1) * d(0);
  256. // if b dot d == 0, it means the lines are parallel so have infinite intersection points
  257. if (bDotDPerp == 0)
  258. return false;
  259. Vec3 c = b1-a1;
  260. typename Vec3::Scalar t = (c(0) * d(1) - c(1) * d(0)) / bDotDPerp;
  261. if (t < 0 || t > 1)
  262. return false;
  263. typename Vec3::Scalar u = (c(0) * b(1) - c(1) * b(0)) / bDotDPerp;
  264. if (u < 0 || u > 1)
  265. return false;
  266. return true;
  267. }
  268. bool has_corner_inside(const Triangle & that) const
  269. {
  270. // http://www.blackpawn.com/texts/pointinpoly/
  271. // Compute vectors
  272. Vec3 A = that.c[0];
  273. Vec3 B = that.c[1];
  274. Vec3 C = that.c[2];
  275. A(2) = B(2) = C(2) = 0;
  276. for(int ci = 0;ci<3;ci++)
  277. {
  278. Vec3 P = this->c[ci];
  279. P(2) = 0;
  280. Vec3 v0 = C - A;
  281. Vec3 v1 = B - A;
  282. Vec3 v2 = P - A;
  283. // Compute dot products
  284. typename Vec3::Scalar dot00 = v0.dot(v0);
  285. typename Vec3::Scalar dot01 = v0.dot(v1);
  286. typename Vec3::Scalar dot02 = v0.dot(v2);
  287. typename Vec3::Scalar dot11 = v1.dot(v1);
  288. typename Vec3::Scalar dot12 = v1.dot(v2);
  289. // Compute barycentric coordinates
  290. typename Vec3::Scalar invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
  291. typename Vec3::Scalar u = (dot11 * dot02 - dot01 * dot12) * invDenom;
  292. typename Vec3::Scalar v = (dot00 * dot12 - dot01 * dot02) * invDenom;
  293. // Check if point is in triangle
  294. if((u >= 0) && (v >= 0) && (u + v < 1))
  295. {
  296. return true;
  297. }
  298. }
  299. return false;
  300. }
  301. bool overlaps(const Triangle &that) const
  302. {
  303. // Edges cross
  304. for(int e = 0;e<3;e++)
  305. {
  306. for(int f = 0;f<3;f++)
  307. {
  308. if(seg_seg_intersect(
  309. this->c[e],this->c[(e+1)%3],
  310. that.c[e],that.c[(e+1)%3]))
  311. {
  312. return true;
  313. }
  314. }
  315. }
  316. // This could be entirely inside that
  317. if(this->has_corner_inside(that))
  318. {
  319. return true;
  320. }
  321. // vice versa
  322. if(that.has_corner_inside(*this))
  323. {
  324. return true;
  325. }
  326. return false;
  327. }
  328. bool operator< (const Triangle &that) const
  329. {
  330. // THIS < THAT if "depth" of THIS < "depth" of THAT
  331. // " if THIS should be draw before THAT
  332. using namespace std;
  333. bool ret = false;
  334. // Self compare
  335. if(that.id == this->id)
  336. {
  337. ret = false;
  338. }
  339. if(this->is_completely_behind(that))
  340. {
  341. cout<<" "<<this->id<<" completely behind "<<that.id<<endl;
  342. ret = false;
  343. }else if(that.is_completely_behind(*this))
  344. {
  345. cout<<" "<<that.id<<" completely behind "<<this->id<<endl;
  346. ret = true;
  347. }else
  348. {
  349. if(!this->overlaps(that))
  350. {
  351. assert(!that.overlaps(*this));
  352. cout<<" THIS does not overlap THAT"<<endl;
  353. // No overlap use barycenter
  354. return
  355. 1./3.*(this->c[0](2) + this->c[1](2) + this->c[2](2)) >
  356. 1./3.*(that.c[0](2) + that.c[1](2) + that.c[2](2));
  357. }else
  358. {
  359. if(this->is_coplanar(that) || that.is_coplanar(*this))
  360. {
  361. cout<<" coplanar"<<endl;
  362. // co-planar: decide based on barycenter depth
  363. ret =
  364. 1./3.*(this->c[0](2) + this->c[1](2) + this->c[2](2)) >
  365. 1./3.*(that.c[0](2) + that.c[1](2) + that.c[2](2));
  366. }else if(this->is_behind_plane(that))
  367. {
  368. cout<<" THIS behind plane of THAT"<<endl;
  369. ret = true;
  370. }else if(that.is_behind_plane(*this))
  371. {
  372. cout<<" THAT behind of plane of THIS"<<endl;
  373. ret = false;
  374. // THAT is in front of plane of THIS
  375. }else if(that.is_in_front_of_plane(*this))
  376. {
  377. cout<<" THAT in front of plane of THIS"<<endl;
  378. ret = true;
  379. // THIS is in front of plane of THAT
  380. }else if(this->is_in_front_of_plane(that))
  381. {
  382. cout<<" THIS in front plane of THAT"<<endl;
  383. ret = false;
  384. }else
  385. {
  386. cout<<" compare bary"<<endl;
  387. ret =
  388. 1./3.*(this->c[0](2) + this->c[1](2) + this->c[2](2)) >
  389. 1./3.*(that.c[0](2) + that.c[1](2) + that.c[2](2));
  390. }
  391. }
  392. }
  393. if(ret)
  394. {
  395. // THIS < THAT so better not be THAT < THIS
  396. cout<<this->id<<" < "<<that.id<<endl;
  397. assert(!(that < *this));
  398. }else
  399. {
  400. // THIS >= THAT so could be THAT < THIS or THAT == THIS
  401. }
  402. return ret;
  403. }
  404. };
  405. //#include <igl/matlab/MatlabWorkspace.h>
  406. //
  407. //template <
  408. // typename DerivedV,
  409. // typename DerivedF,
  410. // typename DerivedMV,
  411. // typename DerivedP,
  412. // typename DerivedFF,
  413. // typename DerivedI>
  414. //IGL_INLINE void igl::sort_triangles_robust(
  415. // const Eigen::PlainObjectBase<DerivedV> & V,
  416. // const Eigen::PlainObjectBase<DerivedF> & F,
  417. // const Eigen::PlainObjectBase<DerivedMV> & MV,
  418. // const Eigen::PlainObjectBase<DerivedP> & P,
  419. // Eigen::PlainObjectBase<DerivedFF> & FF,
  420. // Eigen::PlainObjectBase<DerivedI> & I)
  421. //{
  422. // assert(false &&
  423. // "THIS WILL NEVER WORK because depth sorting is not a numerical sort where"
  424. // "pairwise comparisons of triangles are transitive. Rather it is a"
  425. // "topological sort on a dependecy graph. Dependency encodes 'This triangle"
  426. // "must be drawn before that one'");
  427. // using namespace std;
  428. // using namespace Eigen;
  429. // using namespace igl;
  430. // typedef Matrix<typename DerivedV::Scalar,3,1> Vec3;
  431. // assert(V.cols() == 4);
  432. // Matrix<typename DerivedV::Scalar, DerivedV::RowsAtCompileTime,3> VMVP =
  433. // V*(MV.transpose()*P.transpose().eval().block(0,0,4,3));
  434. //
  435. // MatrixXd projV(V.rows(),3);
  436. // for(int v = 0;v<V.rows();v++)
  437. // {
  438. // Vector3d vv;
  439. // vv(0) = V(v,0);
  440. // vv(1) = V(v,1);
  441. // vv(2) = V(v,2);
  442. // Vector3d p;
  443. // project(vv,p);
  444. // projV.row(v) = p;
  445. // }
  446. //
  447. // vector<Triangle<Vec3> > vF(F.rows());
  448. // MatrixXd N(F.rows(),3);
  449. // MatrixXd C(F.rows()*3,3);
  450. // for(int f = 0;f<F.rows();f++)
  451. // {
  452. // vF[f] =
  453. // //Triangle<Vec3>(f,VMVP.row(F(f,0)),VMVP.row(F(f,1)),VMVP.row(F(f,2)));
  454. // Triangle<Vec3>(f,projV.row(F(f,0)),projV.row(F(f,1)),projV.row(F(f,2)));
  455. // N.row(f) = vF[f].n;
  456. // for(int c = 0;c<3;c++)
  457. // for(int d = 0;d<3;d++)
  458. // C(f*3+c,d) = vF[f].c[c](d);
  459. // }
  460. // MatlabWorkspace mw;
  461. // mw.save_index(F,"F");
  462. // mw.save(V,"V");
  463. // mw.save(MV,"MV");
  464. // mw.save(P,"P");
  465. // Vector4i VP;
  466. // glGetIntegerv(GL_VIEWPORT, VP.data());
  467. // mw.save(projV,"projV");
  468. // mw.save(VP,"VP");
  469. // mw.save(VMVP,"VMVP");
  470. // mw.save(N,"N");
  471. // mw.save(C,"C");
  472. // mw.write("ao.mat");
  473. // sort(vF.begin(),vF.end());
  474. //
  475. // // check
  476. // for(int f = 0;f<F.rows();f++)
  477. // {
  478. // for(int g = f+1;g<F.rows();g++)
  479. // {
  480. // assert(!(vF[g] < vF[f])); // should never happen
  481. // }
  482. // }
  483. // FF.resize(F.rows(),3);
  484. // I.resize(F.rows(),1);
  485. // for(int f = 0;f<F.rows();f++)
  486. // {
  487. // FF.row(f) = F.row(vF[f].id);
  488. // I(f) = vF[f].id;
  489. // }
  490. //
  491. // mw.save_index(FF,"FF");
  492. // mw.save_index(I,"I");
  493. // mw.write("ao.mat");
  494. //}
  495. //template <
  496. // typename DerivedV,
  497. // typename DerivedF,
  498. // typename DerivedFF,
  499. // typename DerivedI>
  500. //IGL_INLINE void igl::sort_triangles_robust(
  501. // const Eigen::PlainObjectBase<DerivedV> & V,
  502. // const Eigen::PlainObjectBase<DerivedF> & F,
  503. // Eigen::PlainObjectBase<DerivedFF> & FF,
  504. // Eigen::PlainObjectBase<DerivedI> & I)
  505. //{
  506. // using namespace Eigen;
  507. // using namespace igl;
  508. // using namespace std;
  509. // // Put model, projection, and viewport matrices into double arrays
  510. // Matrix4d MV;
  511. // Matrix4d P;
  512. // glGetDoublev(GL_MODELVIEW_MATRIX, MV.data());
  513. // glGetDoublev(GL_PROJECTION_MATRIX, P.data());
  514. // if(V.cols() == 3)
  515. // {
  516. // Matrix<typename DerivedV::Scalar, DerivedV::RowsAtCompileTime,4> hV;
  517. // hV.resize(V.rows(),4);
  518. // hV.block(0,0,V.rows(),V.cols()) = V;
  519. // hV.col(3).setConstant(1);
  520. // return sort_triangles_robust(hV,F,MV,P,FF,I);
  521. // }else
  522. // {
  523. // return sort_triangles_robust(V,F,MV,P,FF,I);
  524. // }
  525. //}
  526. #endif
  527. #ifndef IGL_HEADER_ONLY
  528. // Explicit template instanciation
  529. //template void igl::sort_triangles_robust<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::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> >&);
  530. #ifndef IGL_NO_OPENGL
  531. template void igl::sort_triangles<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::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> >&);
  532. template void igl::sort_triangles_slow<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::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> >&);
  533. #endif
  534. #endif