Browse Source

Merge remote-tracking branch 'upstream/master'

Boy, this merge is not easy...


Former-commit-id: e63e218bbab0049d1b921f64091549819d465684
Qingnan Zhou 9 years ago
parent
commit
2d7ac4173d

+ 8 - 4
include/igl/AABB.h

@@ -190,7 +190,7 @@ public:
           const RowVectorDIMS & p,
           int & i,
           RowVectorDIMS & c) const;
-private:
+//private:
       inline Scalar squared_distance(
           const Eigen::PlainObjectBase<DerivedV> & V,
           const Eigen::MatrixXi & Ele, 
@@ -369,7 +369,7 @@ inline void igl::AABB<DerivedV,DIM>::init(
   using namespace Eigen;
   using namespace std;
   assert(DIM == V.cols() && "V.cols() should matched declared dimension");
-  const Scalar inf = numeric_limits<Scalar>::infinity();
+  //const Scalar inf = numeric_limits<Scalar>::infinity();
   m_box = AlignedBox<Scalar,DIM>();
   // Compute bounding box
   for(int i = 0;i<I.rows();i++)
@@ -768,7 +768,7 @@ inline typename igl::AABB<DerivedV,DIM>::Scalar igl::AABB<DerivedV,DIM>::squared
   const AABB<Derivedother_V,DIM> * other,
   const Eigen::PlainObjectBase<Derivedother_V> & other_V,
   const Eigen::MatrixXi & other_Ele, 
-  const Scalar min_sqr_d,
+  const Scalar /*min_sqr_d*/,
   Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
   Eigen::PlainObjectBase<DerivedI> & I,
   Eigen::PlainObjectBase<DerivedC> & C) const
@@ -1098,7 +1098,11 @@ inline void igl::AABB<DerivedV,DIM>::leaf_squared_distance(
 
 template <typename DerivedV, int DIM>
 inline void igl::AABB<DerivedV,DIM>::set_min(
-  const RowVectorDIMS & p,
+  const RowVectorDIMS & 
+#ifndef NDEBUG
+  p
+#endif
+  ,
   const Scalar sqr_d_candidate,
   const int i_candidate,
   const RowVectorDIMS & c_candidate,

+ 5 - 2
include/igl/WindingNumberTree.h

@@ -406,13 +406,16 @@ inline void igl::WindingNumberTree<Point>::print(const char * tab)
 }
 
 template <typename Point>
-inline double igl::WindingNumberTree<Point>::max_abs_winding_number(const Point & p) const
+inline double 
+igl::WindingNumberTree<Point>::max_abs_winding_number(const Point & /*p*/) const
 {
   return std::numeric_limits<double>::infinity();
 }
 
 template <typename Point>
-inline double igl::WindingNumberTree<Point>::max_simple_abs_winding_number(const Point & p) const
+inline double 
+igl::WindingNumberTree<Point>::max_simple_abs_winding_number(
+  const Point & /*p*/) const
 {
   using namespace std;
   return numeric_limits<double>::infinity();

+ 4 - 1
include/igl/boolean/string_to_mesh_boolean_type.cpp

@@ -42,7 +42,10 @@ IGL_INLINE igl::boolean::MeshBooleanType igl::boolean::string_to_mesh_boolean_ty
   const std::string & s)
 {
   MeshBooleanType type;
-  const bool ret = string_to_mesh_boolean_type(s,type);
+#ifndef NDEBUG
+  const bool ret = 
+#endif
+    string_to_mesh_boolean_type(s,type);
   assert(ret && "Unknown MeshBooleanType name");
   return type;
 }

+ 90 - 61
include/igl/cgal/order_facets_around_edge.cpp

@@ -1,16 +1,23 @@
 #include "order_facets_around_edge.h"
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 
-namespace igl {
-    namespace cgal {
-        namespace order_facets_around_edges_helper {
+namespace igl
+{
+    namespace cgal
+    {
+        namespace order_facets_around_edges_helper
+        {
             template<typename T>
-            std::vector<size_t> index_sort(const std::vector<T>& data) {
+            std::vector<size_t> index_sort(const std::vector<T>& data)
+            {
                 const size_t len = data.size();
                 std::vector<size_t> order(len);
-                for (size_t i=0; i<len; i++) order[i] = i;
-
-                auto comp = [&](size_t i, size_t j) {
+                for (size_t i=0; i<len; i++) 
+                {
+                    order[i] = i;
+                }
+                auto comp = [&](size_t i, size_t j) 
+                {
                     return data[i] < data[j];
                 };
                 std::sort(order.begin(), order.end(), comp);
@@ -28,10 +35,11 @@ template<
 void igl::cgal::order_facets_around_edge(
     const Eigen::PlainObjectBase<DerivedV>& V,
     const Eigen::PlainObjectBase<DerivedF>& F,
-    size_t s, size_t d, 
+    size_t s,
+    size_t d, 
     const std::vector<int>& adj_faces,
-    Eigen::PlainObjectBase<DerivedI>& order) {
-
+    Eigen::PlainObjectBase<DerivedI>& order)
+{
     using namespace igl::cgal::order_facets_around_edges_helper;
 
     // Although we only need exact predicates in the algorithm,
@@ -41,37 +49,42 @@ void igl::cgal::order_facets_around_edge(
     typedef K::Point_3 Point_3;
     typedef K::Plane_3 Plane_3;
 
-    auto get_face_index = [&](int adj_f)->size_t{
+    auto get_face_index = [&](int adj_f)->size_t
+    {
         return abs(adj_f) - 1;
     };
 
-    auto get_opposite_vertex = [&](size_t fid)->size_t {
-        if (F(fid, 0) != s && F(fid, 0) != d) return F(fid, 0);
-        if (F(fid, 1) != s && F(fid, 1) != d) return F(fid, 1);
-        if (F(fid, 2) != s && F(fid, 2) != d) return F(fid, 2);
+    auto get_opposite_vertex = [&](size_t fid)->size_t
+    {
+        typedef typename DerivedF::Scalar Index;
+        if (F(fid, 0) != (Index)s && F(fid, 0) != (Index)d) return F(fid, 0);
+        if (F(fid, 1) != (Index)s && F(fid, 1) != (Index)d) return F(fid, 1);
+        if (F(fid, 2) != (Index)s && F(fid, 2) != (Index)d) return F(fid, 2);
         assert(false);
         return -1;
     };
 
     // Handle base cases
-    if (adj_faces.size() == 0) {
+    if (adj_faces.size() == 0) 
+    {
         order.resize(0, 1);
         return;
-    } else if (adj_faces.size() == 1) {
+    } else if (adj_faces.size() == 1)
+    {
         order.resize(1, 1);
         order(0, 0) = 0;
         return;
-    } else if (adj_faces.size() == 2) {
-        const size_t o1 =
-            get_opposite_vertex(get_face_index(adj_faces[0]));
-        const size_t o2 =
-            get_opposite_vertex(get_face_index(adj_faces[1]));
+    } else if (adj_faces.size() == 2)
+    {
+        const size_t o1 = get_opposite_vertex(get_face_index(adj_faces[0]));
+        const size_t o2 = get_opposite_vertex(get_face_index(adj_faces[1]));
         const Point_3 ps(V(s, 0), V(s, 1), V(s, 2));
         const Point_3 pd(V(d, 0), V(d, 1), V(d, 2));
         const Point_3 p1(V(o1, 0), V(o1, 1), V(o1, 2));
         const Point_3 p2(V(o2, 0), V(o2, 1), V(o2, 2));
         order.resize(2, 1);
-        switch (CGAL::orientation(ps, pd, p1, p2)) {
+        switch (CGAL::orientation(ps, pd, p1, p2))
+        {
             case CGAL::POSITIVE:
                 order(0, 0) = 1;
                 order(1, 0) = 0;
@@ -113,8 +126,7 @@ void igl::cgal::order_facets_around_edge(
     }
 
     const size_t num_adj_faces = adj_faces.size();
-    const size_t o = get_opposite_vertex(
-            get_face_index(adj_faces[0]));
+    const size_t o = get_opposite_vertex( get_face_index(adj_faces[0]));
     const Point_3 p_s(V(s, 0), V(s, 1), V(s, 2));
     const Point_3 p_d(V(d, 0), V(d, 1), V(d, 2));
     const Point_3 p_o(V(o, 0), V(o, 1), V(o, 2));
@@ -122,9 +134,9 @@ void igl::cgal::order_facets_around_edge(
     assert(!separator.is_degenerate());
 
     std::vector<Point_3> opposite_vertices;
-    for (size_t i=0; i<num_adj_faces; i++) {
-        const size_t o = get_opposite_vertex(
-                get_face_index(adj_faces[i]));
+    for (size_t i=0; i<num_adj_faces; i++)
+    {
+        const size_t o = get_opposite_vertex( get_face_index(adj_faces[i]));
         opposite_vertices.emplace_back(
                 V(o, 0), V(o, 1), V(o, 2));
     }
@@ -139,7 +151,8 @@ void igl::cgal::order_facets_around_edge(
     std::vector<size_t> tie_positive_oriented_index;
     std::vector<size_t> tie_negative_oriented_index;
 
-    for (size_t i=0; i<num_adj_faces; i++) {
+    for (size_t i=0; i<num_adj_faces; i++)
+    {
         const int f = adj_faces[i];
         const Point_3& p_a = opposite_vertices[i];
         auto orientation = separator.oriented_side(p_a);
@@ -181,10 +194,8 @@ void igl::cgal::order_facets_around_edge(
     Eigen::PlainObjectBase<DerivedI> positive_order, negative_order;
     order_facets_around_edge(V, F, s, d, positive_side, positive_order);
     order_facets_around_edge(V, F, s, d, negative_side, negative_order);
-    std::vector<size_t> tie_positive_order =
-        index_sort(tie_positive_oriented);
-    std::vector<size_t> tie_negative_order =
-        index_sort(tie_negative_oriented);
+    std::vector<size_t> tie_positive_order = index_sort(tie_positive_oriented);
+    std::vector<size_t> tie_negative_order = index_sort(tie_negative_oriented);
 
     // Copy results into order vector.
     const size_t tie_positive_size = tie_positive_oriented.size();
@@ -192,28 +203,30 @@ void igl::cgal::order_facets_around_edge(
     const size_t positive_size = positive_order.size();
     const size_t negative_size = negative_order.size();
 
-    order.resize(tie_positive_size + positive_size +
-            tie_negative_size + negative_size, 1);
+    order.resize(
+      tie_positive_size + positive_size + tie_negative_size + negative_size,1);
 
     size_t count=0;
-    for (size_t i=0; i<tie_positive_size; i++) {
-        order(count+i, 0) =
-            tie_positive_oriented_index[tie_positive_order[i]];
+    for (size_t i=0; i<tie_positive_size; i++)
+    {
+        order(count+i, 0) = tie_positive_oriented_index[tie_positive_order[i]];
     }
     count += tie_positive_size;
 
-    for (size_t i=0; i<negative_size; i++) {
+    for (size_t i=0; i<negative_size; i++) 
+    {
         order(count+i, 0) = negative_side_index[negative_order(i, 0)];
     }
     count += negative_size;
 
-    for (size_t i=0; i<tie_negative_size; i++) {
-        order(count+i, 0) =
-            tie_negative_oriented_index[tie_negative_order[i]];
+    for (size_t i=0; i<tie_negative_size; i++)
+    {
+        order(count+i, 0) = tie_negative_oriented_index[tie_negative_order[i]];
     }
     count += tie_negative_size;
 
-    for (size_t i=0; i<positive_size; i++) {
+    for (size_t i=0; i<positive_size; i++)
+    {
         order(count+i, 0) = positive_side_index[positive_order(i, 0)];
     }
     count += positive_size;
@@ -221,19 +234,22 @@ void igl::cgal::order_facets_around_edge(
 
     // Find the correct start point.
     size_t start_idx = 0;
-    for (size_t i=0; i<num_adj_faces; i++) {
+    for (size_t i=0; i<num_adj_faces; i++)
+    {
         const Point_3& p_a = opposite_vertices[order(i, 0)];
         const Point_3& p_b =
             opposite_vertices[order((i+1)%num_adj_faces, 0)];
         auto orientation = CGAL::orientation(p_s, p_d, p_a, p_b);
-        if (orientation == CGAL::POSITIVE) {
+        if (orientation == CGAL::POSITIVE)
+        {
             // Angle between triangle (p_s, p_d, p_a) and (p_s, p_d, p_b) is
             // more than 180 degrees.
             start_idx = (i+1)%num_adj_faces;
             break;
         } else if (orientation == CGAL::COPLANAR &&
                 Plane_3(p_s, p_d, p_a).orthogonal_direction() !=
-                Plane_3(p_s, p_d, p_b).orthogonal_direction()) {
+                Plane_3(p_s, p_d, p_b).orthogonal_direction())
+        {
             // All 4 points are coplanar, but p_a and p_b are on each side of
             // the edge (p_s, p_d).  This means the angle between triangle
             // (p_s, p_d, p_a) and (p_s, p_d, p_b) is exactly 180 degrees.
@@ -242,7 +258,8 @@ void igl::cgal::order_facets_around_edge(
         }
     }
     DerivedI circular_order = order;
-    for (size_t i=0; i<num_adj_faces; i++) {
+    for (size_t i=0; i<num_adj_faces; i++)
+    {
         order(i, 0) = circular_order((start_idx + i)%num_adj_faces, 0);
     }
 }
@@ -255,20 +272,25 @@ IGL_INLINE
 void igl::cgal::order_facets_around_edge(
         const Eigen::PlainObjectBase<DerivedV>& V,
         const Eigen::PlainObjectBase<DerivedF>& F,
-        size_t s, size_t d, 
+        size_t s,
+        size_t d, 
         const std::vector<int>& adj_faces,
         const Eigen::PlainObjectBase<DerivedV>& pivot_point,
-        Eigen::PlainObjectBase<DerivedI>& order) {
+        Eigen::PlainObjectBase<DerivedI>& order)
+{
 
     assert(V.cols() == 3);
     assert(F.cols() == 3);
-    auto signed_index_to_index = [&](int signed_idx) {
+    auto signed_index_to_index = [&](int signed_idx)
+    {
         return abs(signed_idx) -1;
     };
-    auto get_opposite_vertex_index = [&](size_t fid) {
-        if (F(fid, 0) != s && F(fid, 0) != d) return F(fid, 0);
-        if (F(fid, 1) != s && F(fid, 1) != d) return F(fid, 1);
-        if (F(fid, 2) != s && F(fid, 2) != d) return F(fid, 2);
+    auto get_opposite_vertex_index = [&](size_t fid)
+    {
+        typedef typename DerivedF::Scalar Index;
+        if (F(fid, 0) != (Index)s && F(fid, 0) != (Index)d) return F(fid, 0);
+        if (F(fid, 1) != (Index)s && F(fid, 1) != (Index)d) return F(fid, 1);
+        if (F(fid, 2) != (Index)s && F(fid, 2) != (Index)d) return F(fid, 2);
         assert(false);
         // avoid warning
         return -1;
@@ -306,7 +328,8 @@ void igl::cgal::order_facets_around_edge(
     vertices.row(N+2) = V.row(d);
 
     DerivedF faces(num_faces, 3);
-    for (size_t i=0; i<N; i++) {
+    for (size_t i=0; i<N; i++)
+    {
         if (ordered_adj_faces[i] < 0) {
             faces(i,0) = N+1; // s
             faces(i,1) = N+2; // d
@@ -323,10 +346,13 @@ void igl::cgal::order_facets_around_edge(
     faces(N, 2) = N;
 
     std::vector<int> adj_faces_with_pivot(num_faces);
-    for (size_t i=0; i<num_faces; i++) {
-        if (faces(i,0) == N+1 && faces(i,1) == N+2) {
+    for (size_t i=0; i<num_faces; i++)
+    {
+        if (faces(i,0) == N+1 && faces(i,1) == N+2)
+        {
             adj_faces_with_pivot[i] = int(i+1) * -1;
-        } else {
+        } else
+        {
             adj_faces_with_pivot[i] = int(i+1);
         }
     }
@@ -339,15 +365,18 @@ void igl::cgal::order_facets_around_edge(
     assert(order_with_pivot.size() == num_faces);
     order.resize(N);
     size_t pivot_index = num_faces + 1;
-    for (size_t i=0; i<num_faces; i++) {
-        if (order_with_pivot[i] == N) {
+    for (size_t i=0; i<num_faces; i++)
+    {
+        if (order_with_pivot[i] == N)
+        {
             pivot_index = i;
             break;
         }
     }
     assert(pivot_index < num_faces);
 
-    for (size_t i=0; i<N; i++) {
+    for (size_t i=0; i<N; i++)
+    {
         order[i] = order_with_pivot[(pivot_index+i+1)%num_faces];
     }
 }

+ 5 - 17
include/igl/cgal/order_facets_around_edges.cpp

@@ -15,9 +15,7 @@ template<
     typename DerivedV,
     typename DerivedF,
     typename DerivedN,
-    typename DerivedE,
     typename DeriveduE,
-    typename DerivedEMAP,
     typename uE2EType,
     typename uE2oEType,
     typename uE2CType >
@@ -28,9 +26,7 @@ igl::cgal::order_facets_around_edges(
         const Eigen::PlainObjectBase<DerivedV>& V,
         const Eigen::PlainObjectBase<DerivedF>& F,
         const Eigen::PlainObjectBase<DerivedN>& N,
-        const Eigen::PlainObjectBase<DerivedE>& E,
         const Eigen::PlainObjectBase<DeriveduE>& uE,
-        const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
         const std::vector<std::vector<uE2EType> >& uE2E,
         std::vector<std::vector<uE2oEType> >& uE2oE,
         std::vector<std::vector<uE2CType > >& uE2C ) {
@@ -159,9 +155,7 @@ template<
     typename DerivedV,
     typename DerivedF,
     typename DerivedN,
-    typename DerivedE,
     typename DeriveduE,
-    typename DerivedEMAP,
     typename uE2EType,
     typename uE2oEType,
     typename uE2CType >
@@ -172,9 +166,7 @@ igl::cgal::order_facets_around_edges(
         const Eigen::PlainObjectBase<DerivedV>& V,
         const Eigen::PlainObjectBase<DerivedF>& F,
         const Eigen::PlainObjectBase<DerivedN>& N,
-        const Eigen::PlainObjectBase<DerivedE>& E,
         const Eigen::PlainObjectBase<DeriveduE>& uE,
-        const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
         const std::vector<std::vector<uE2EType> >& uE2E,
         std::vector<std::vector<uE2oEType> >& uE2oE,
         std::vector<std::vector<uE2CType > >& uE2C ) {
@@ -257,23 +249,19 @@ igl::cgal::order_facets_around_edges(
 template<
     typename DerivedV,
     typename DerivedF,
-    typename DerivedE,
     typename DeriveduE,
-    typename DerivedEMAP,
     typename uE2EType,
     typename uE2oEType,
     typename uE2CType >
 IGL_INLINE void igl::cgal::order_facets_around_edges(
         const Eigen::PlainObjectBase<DerivedV>& V,
         const Eigen::PlainObjectBase<DerivedF>& F,
-        const Eigen::PlainObjectBase<DerivedE>& E,
         const Eigen::PlainObjectBase<DeriveduE>& uE,
-        const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
         const std::vector<std::vector<uE2EType> >& uE2E,
         std::vector<std::vector<uE2oEType> >& uE2oE,
         std::vector<std::vector<uE2CType > >& uE2C ) {
 
-    typedef Eigen::Matrix<typename DerivedV::Scalar, 3, 1> Vector3E;
+    //typedef Eigen::Matrix<typename DerivedV::Scalar, 3, 1> Vector3E;
     const size_t num_faces = F.rows();
     const size_t num_undirected_edges = uE.rows();
 
@@ -296,7 +284,7 @@ IGL_INLINE void igl::cgal::order_facets_around_edges(
         const auto ref_corner_s = (ref_corner_o+1)%3;
         const auto ref_corner_d = (ref_corner_o+2)%3;
 
-        const typename DerivedF::Scalar o = F(ref_face, ref_corner_o);
+        //const typename DerivedF::Scalar o = F(ref_face, ref_corner_o);
         const typename DerivedF::Scalar s = F(ref_face, ref_corner_s);
         const typename DerivedF::Scalar d = F(ref_face, ref_corner_d);
 
@@ -332,7 +320,7 @@ IGL_INLINE void igl::cgal::order_facets_around_edges(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template void igl::cgal::order_facets_around_edges<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, long, long, bool>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> > const&, std::__1::vector<std::__1::vector<long, std::__1::allocator<long> >, std::__1::allocator<std::__1::vector<long, std::__1::allocator<long> > > > const&, std::__1::vector<std::__1::vector<long, std::__1::allocator<long> >, std::__1::allocator<std::__1::vector<long, std::__1::allocator<long> > > >&, std::__1::vector<std::__1::vector<bool, std::__1::allocator<bool> >, std::__1::allocator<std::__1::vector<bool, std::__1::allocator<bool> > > >&);
-template void igl::cgal::order_facets_around_edges<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, long, long, bool>(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, 2, 0, -1, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> > const&, std::__1::vector<std::__1::vector<long, std::__1::allocator<long> >, std::__1::allocator<std::__1::vector<long, std::__1::allocator<long> > > > const&, std::__1::vector<std::__1::vector<long, std::__1::allocator<long> >, std::__1::allocator<std::__1::vector<long, std::__1::allocator<long> > > >&, std::__1::vector<std::__1::vector<bool, std::__1::allocator<bool> >, std::__1::allocator<std::__1::vector<bool, std::__1::allocator<bool> > > >&);
-template void igl::cgal::order_facets_around_edges<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, long, long, bool>(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, 2, 0, -1, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> > const&, std::__1::vector<std::__1::vector<long, std::__1::allocator<long> >, std::__1::allocator<std::__1::vector<long, std::__1::allocator<long> > > > const&, std::__1::vector<std::__1::vector<long, std::__1::allocator<long> >, std::__1::allocator<std::__1::vector<long, std::__1::allocator<long> > > >&, std::__1::vector<std::__1::vector<bool, std::__1::allocator<bool> >, std::__1::allocator<std::__1::vector<bool, std::__1::allocator<bool> > > >&);
+template void igl::cgal::order_facets_around_edges<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, long, long, bool>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, std::__1::vector<std::__1::vector<long, std::__1::allocator<long> >, std::__1::allocator<std::__1::vector<long, std::__1::allocator<long> > > > const&, std::__1::vector<std::__1::vector<long, std::__1::allocator<long> >, std::__1::allocator<std::__1::vector<long, std::__1::allocator<long> > > >&, std::__1::vector<std::__1::vector<bool, std::__1::allocator<bool> >, std::__1::allocator<std::__1::vector<bool, std::__1::allocator<bool> > > >&);
+template void igl::cgal::order_facets_around_edges<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, long, long, bool>(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, 2, 0, -1, 2> > const&, std::__1::vector<std::__1::vector<long, std::__1::allocator<long> >, std::__1::allocator<std::__1::vector<long, std::__1::allocator<long> > > > const&, std::__1::vector<std::__1::vector<long, std::__1::allocator<long> >, std::__1::allocator<std::__1::vector<long, std::__1::allocator<long> > > >&, std::__1::vector<std::__1::vector<bool, std::__1::allocator<bool> >, std::__1::allocator<std::__1::vector<bool, std::__1::allocator<bool> > > >&);
+template void igl::cgal::order_facets_around_edges<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, long, long, bool>(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, 2, 0, -1, 2> > const&, std::__1::vector<std::__1::vector<long, std::__1::allocator<long> >, std::__1::allocator<std::__1::vector<long, std::__1::allocator<long> > > > const&, std::__1::vector<std::__1::vector<long, std::__1::allocator<long> >, std::__1::allocator<std::__1::vector<long, std::__1::allocator<long> > > >&, std::__1::vector<std::__1::vector<bool, std::__1::allocator<bool> >, std::__1::allocator<std::__1::vector<bool, std::__1::allocator<bool> > > >&);
 #endif

+ 0 - 14
include/igl/cgal/order_facets_around_edges.h

@@ -29,9 +29,7 @@ namespace igl
     //   V    #V by 3 list of vertices.
     //   F    #F by 3 list of faces
     //   N    #F by 3 list of face normals.
-    //   E    #F*3 by 2 list vertex indices, represents directed edges.
     //  uE    #uE by 2 list of vertex_indices, represents undirected edges.
-    //  EMAP  #F*3 list of indices that maps E to uE. (a many-to-one map)
     //  uE2E  #uE list of lists that maps uE to E. (a one-to-many map)
     //
     // Outputs:
@@ -44,9 +42,7 @@ namespace igl
         typename DerivedV,
         typename DerivedF,
         typename DerivedN,
-        typename DerivedE,
         typename DeriveduE,
-        typename DerivedEMAP,
         typename uE2EType,
         typename uE2oEType,
         typename uE2CType >
@@ -57,9 +53,7 @@ namespace igl
             const Eigen::PlainObjectBase<DerivedV>& V,
             const Eigen::PlainObjectBase<DerivedF>& F,
             const Eigen::PlainObjectBase<DerivedN>& N,
-            const Eigen::PlainObjectBase<DerivedE>& E,
             const Eigen::PlainObjectBase<DeriveduE>& uE,
-            const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
             const std::vector<std::vector<uE2EType> >& uE2E,
             std::vector<std::vector<uE2oEType> >& uE2oE,
             std::vector<std::vector<uE2CType > >& uE2C );
@@ -68,9 +62,7 @@ namespace igl
         typename DerivedV,
         typename DerivedF,
         typename DerivedN,
-        typename DerivedE,
         typename DeriveduE,
-        typename DerivedEMAP,
         typename uE2EType,
         typename uE2oEType,
         typename uE2CType >
@@ -81,9 +73,7 @@ namespace igl
             const Eigen::PlainObjectBase<DerivedV>& V,
             const Eigen::PlainObjectBase<DerivedF>& F,
             const Eigen::PlainObjectBase<DerivedN>& N,
-            const Eigen::PlainObjectBase<DerivedE>& E,
             const Eigen::PlainObjectBase<DeriveduE>& uE,
-            const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
             const std::vector<std::vector<uE2EType> >& uE2E,
             std::vector<std::vector<uE2oEType> >& uE2oE,
             std::vector<std::vector<uE2CType > >& uE2C );
@@ -93,18 +83,14 @@ namespace igl
     template<
         typename DerivedV,
         typename DerivedF,
-        typename DerivedE,
         typename DeriveduE,
-        typename DerivedEMAP,
         typename uE2EType,
         typename uE2oEType,
         typename uE2CType >
     IGL_INLINE void order_facets_around_edges(
             const Eigen::PlainObjectBase<DerivedV>& V,
             const Eigen::PlainObjectBase<DerivedF>& F,
-            const Eigen::PlainObjectBase<DerivedE>& E,
             const Eigen::PlainObjectBase<DeriveduE>& uE,
-            const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
             const std::vector<std::vector<uE2EType> >& uE2E,
             std::vector<std::vector<uE2oEType> >& uE2oE,
             std::vector<std::vector<uE2CType > >& uE2C );

+ 1 - 2
include/igl/cgal/outer_facet.cpp

@@ -41,9 +41,8 @@ IGL_INLINE void igl::cgal::outer_facet(
     //    If it has zero normal component, it is facing outside if it contains
     //    directed edge (s, d).  
 
-    typedef typename DerivedV::Scalar Scalar;
+    //typedef typename DerivedV::Scalar Scalar;
     typedef typename DerivedV::Index Index;
-    const size_t INVALID = std::numeric_limits<size_t>::max();
 
     Index s,d;
     Eigen::Matrix<Index,Eigen::Dynamic,1> incident_faces;

+ 3 - 3
include/igl/cgal/outer_hull.cpp

@@ -50,7 +50,7 @@ IGL_INLINE void igl::cgal::outer_hull(
   typedef typename DerivedF::Index Index;
   Matrix<Index,DerivedF::RowsAtCompileTime,1> C;
   typedef Matrix<typename DerivedV::Scalar,Dynamic,DerivedV::ColsAtCompileTime> MatrixXV;
-  typedef Matrix<typename DerivedF::Scalar,Dynamic,DerivedF::ColsAtCompileTime> MatrixXF;
+  //typedef Matrix<typename DerivedF::Scalar,Dynamic,DerivedF::ColsAtCompileTime> MatrixXF;
   typedef Matrix<typename DerivedG::Scalar,Dynamic,DerivedG::ColsAtCompileTime> MatrixXG;
   typedef Matrix<typename DerivedJ::Scalar,Dynamic,DerivedJ::ColsAtCompileTime> MatrixXJ;
   const Index m = F.rows();
@@ -76,7 +76,7 @@ IGL_INLINE void igl::cgal::outer_hull(
 #endif
   typedef Matrix<typename DerivedF::Scalar,Dynamic,2> MatrixX2I;
   typedef Matrix<typename DerivedF::Index,Dynamic,1> VectorXI;
-  typedef Matrix<typename DerivedV::Scalar, 3, 1> Vector3F;
+  //typedef Matrix<typename DerivedV::Scalar, 3, 1> Vector3F;
   MatrixX2I E,uE;
   VectorXI EMAP;
   vector<vector<typename DerivedF::Index> > uE2E;
@@ -93,7 +93,7 @@ IGL_INLINE void igl::cgal::outer_hull(
 
   std::vector<std::vector<typename DerivedF::Index> > uE2oE;
   std::vector<std::vector<bool> > uE2C;
-  order_facets_around_edges(V, F, E, uE, EMAP, uE2E, uE2oE, uE2C);
+  order_facets_around_edges(V, F, uE, uE2E, uE2oE, uE2C);
   uE2E = uE2oE;
   VectorXI diIM(3*m);
   for (auto ue : uE2E) {

+ 3 - 3
include/igl/cgal/projected_delaunay.cpp

@@ -32,10 +32,10 @@ IGL_INLINE void igl::cgal::projected_delaunay(
   typedef CGAL::Segment_3<Kernel>  Segment_3; 
   typedef CGAL::Triangle_3<Kernel> Triangle_3; 
   typedef CGAL::Plane_3<Kernel>    Plane_3;
-  typedef CGAL::Tetrahedron_3<Kernel> Tetrahedron_3; 
+  //typedef CGAL::Tetrahedron_3<Kernel> Tetrahedron_3; 
   typedef CGAL::Point_2<Kernel>    Point_2;
-  typedef CGAL::Segment_2<Kernel>  Segment_2; 
-  typedef CGAL::Triangle_2<Kernel> Triangle_2; 
+  //typedef CGAL::Segment_2<Kernel>  Segment_2; 
+  //typedef CGAL::Triangle_2<Kernel> Triangle_2; 
   typedef CGAL::Triangulation_vertex_base_2<Kernel>  TVB_2;
   typedef CGAL::Constrained_triangulation_face_base_2<Kernel> CTFB_2;
   typedef CGAL::Triangulation_data_structure_2<TVB_2,CTFB_2> TDS_2;

+ 9 - 9
include/igl/cgal/remesh_intersections.cpp

@@ -40,12 +40,12 @@ IGL_INLINE void igl::cgal::remesh_intersections(
   using namespace Eigen;
   typedef typename DerivedF::Index          Index;
   typedef CGAL::Point_3<Kernel>    Point_3;
-  typedef CGAL::Segment_3<Kernel>  Segment_3; 
-  typedef CGAL::Triangle_3<Kernel> Triangle_3; 
+  //typedef CGAL::Segment_3<Kernel>  Segment_3; 
+  //typedef CGAL::Triangle_3<Kernel> Triangle_3; 
   typedef CGAL::Plane_3<Kernel>    Plane_3;
-  typedef CGAL::Point_2<Kernel>    Point_2;
-  typedef CGAL::Segment_2<Kernel>  Segment_2; 
-  typedef CGAL::Triangle_2<Kernel> Triangle_2; 
+  //typedef CGAL::Point_2<Kernel>    Point_2;
+  //typedef CGAL::Segment_2<Kernel>  Segment_2; 
+  //typedef CGAL::Triangle_2<Kernel> Triangle_2; 
   typedef CGAL::Triangulation_vertex_base_2<Kernel>  TVB_2;
   typedef CGAL::Constrained_triangulation_face_base_2<Kernel> CTFB_2;
   typedef CGAL::Triangulation_data_structure_2<TVB_2,CTFB_2> TDS_2;
@@ -55,9 +55,9 @@ IGL_INLINE void igl::cgal::remesh_intersections(
   typedef CGAL::Constrained_triangulation_plus_2<CDT_2> CDT_plus_2;
   typedef std::pair<Index,Index> EMK;
   typedef std::vector<Index> EMV;
-  typedef std::map<EMK,EMV> EdgeMap;
+  //typedef std::map<EMK,EMV> EdgeMap;
   typedef std::pair<Index,Index> EMK;
-  typedef std::vector<CGAL::Object> ObjectList;
+  //typedef std::vector<CGAL::Object> ObjectList;
   typedef std::vector<Index> IndexList;
 
   int NF_count = 0;
@@ -73,13 +73,13 @@ IGL_INLINE void igl::cgal::remesh_intersections(
   vector<Plane_3> P(offending.size());
   // Use map for *all* faces
   map<typename CDT_plus_2::Vertex_handle,Index> v2i;
-  // Loop over offending triangles
-  const size_t noff = offending.size();
 #ifdef IGL_SELFINTERSECTMESH_DEBUG
   double t_proj_del = 0;
 #endif
   // Unfortunately it looks like CGAL has trouble allocating memory when
   // multiple openmp threads are running. Crashes durring CDT...
+  //// Loop over offending triangles
+  //const size_t noff = offending.size();
 //# pragma omp parallel for if (noff>1000)
   for(const auto & okv : offending)
   {

+ 3 - 2
include/igl/doublearea.cpp

@@ -116,10 +116,11 @@ IGL_INLINE void igl::doublearea(
 {
   using namespace Eigen;
   using namespace std;
+  typedef typename Derivedl::Index Index;
   // Only support triangles
   assert(ul.cols() == 3);
   // Number of triangles
-  const size_t m = ul.rows();
+  const Index m = ul.rows();
   Eigen::PlainObjectBase<Derivedl> l;
   MatrixXi _;
   sort(ul,2,false,l,_);
@@ -133,7 +134,7 @@ IGL_INLINE void igl::doublearea(
   #  define IGL_OMP_MIN_VALUE 1000
   #endif
   #pragma omp parallel for if (m>IGL_OMP_MIN_VALUE)
-  for(long long i = 0;i<m;i++)
+  for(Index i = 0;i<m;i++)
   {
     //// Heron's formula for area
     //const typename Derivedl::Scalar arg =

+ 1 - 1
include/igl/exterior_edges.cpp

@@ -86,7 +86,7 @@ IGL_INLINE void igl::exterior_edges(
       }
       // Append edge for every repeated entry
       const int abs_count = abs(count);
-      for(size_t k = 0;k<abs_count;k++)
+      for(int k = 0;k<abs_count;k++)
       {
         E(e,0) = i;
         E(e,1) = j;

+ 3 - 2
include/igl/internal_angles.cpp

@@ -64,8 +64,9 @@ IGL_INLINE void igl::internal_angles(
   const Eigen::PlainObjectBase<DerivedL>& L,
   Eigen::PlainObjectBase<DerivedK> & K)
 {
+  typedef typename DerivedL::Index Index;
   assert(L.cols() == 3 && "Edge-lengths should come from triangles");
-  const size_t m = L.rows();
+  const Index m = L.rows();
   K.resize(m,3);
   //for(int d = 0;d<3;d++)
   //{
@@ -79,7 +80,7 @@ IGL_INLINE void igl::internal_angles(
   #  define IGL_OMP_MIN_VALUE 1000
   #endif
   #pragma omp parallel for if (m>IGL_OMP_MIN_VALUE)
-  for(long long f = 0;f<m;f++)
+  for(Index f = 0;f<m;f++)
   {
     for(size_t d = 0;d<3;d++)
     {

+ 29 - 17
include/igl/outer_element.cpp

@@ -21,7 +21,8 @@ IGL_INLINE void igl::outer_vertex(
         const Eigen::PlainObjectBase<DerivedF> & F,
         const Eigen::PlainObjectBase<DerivedI> & I,
         IndexType & v_index,
-        Eigen::PlainObjectBase<DerivedA> & A) {
+        Eigen::PlainObjectBase<DerivedA> & A)
+{
     // Algorithm: 
     //    Find an outer vertex (i.e. vertex reachable from infinity)
     //    Return the vertex with the largest X value.
@@ -29,23 +30,29 @@ IGL_INLINE void igl::outer_vertex(
     //    If there is still a tie, pick the one with the largest Z value.
     //    If there is still a tie, then there are duplicated vertices within the
     //    mesh, which violates the precondition.
-    const size_t INVALID = std::numeric_limits<size_t>::max();
+    typedef typename DerivedF::Scalar Index;
+    const Index INVALID = std::numeric_limits<Index>::max();
     const size_t num_selected_faces = I.rows();
     std::vector<size_t> candidate_faces;
-    size_t outer_vid = INVALID;
+    Index outer_vid = INVALID;
     typename DerivedV::Scalar outer_val = 0;
-    for (size_t i=0; i<num_selected_faces; i++) {
+    for (size_t i=0; i<num_selected_faces; i++)
+    {
         size_t f = I(i);
-        for (size_t j=0; j<3; j++) {
-            auto v = F(f, j);
+        for (size_t j=0; j<3; j++)
+        {
+            Index v = F(f, j);
             auto vx = V(v, 0);
-            if (outer_vid == INVALID || vx > outer_val) {
+            if (outer_vid == INVALID || vx > outer_val)
+            {
                 outer_val = vx;
                 outer_vid = v;
                 candidate_faces = {f};
-            } else if (v == outer_vid) {
+            } else if (v == outer_vid)
+            {
                 candidate_faces.push_back(f);
-            } else if (vx == outer_val) {
+            } else if (vx == outer_val)
+            {
                 // Break tie.
                 auto vy = V(v,1);
                 auto vz = V(v, 2);
@@ -54,7 +61,8 @@ IGL_INLINE void igl::outer_vertex(
                 assert(!(vy == outer_y && vz == outer_z));
                 bool replace = (vy > outer_y) ||
                     ((vy == outer_y) && (vz > outer_z));
-                if (replace) {
+                if (replace)
+                {
                     outer_val = vx;
                     outer_vid = v;
                     candidate_faces = {f};
@@ -96,7 +104,7 @@ IGL_INLINE void igl::outer_edge(
     typedef typename DerivedV::Index Index;
     typedef typename Eigen::Matrix<Scalar, 3, 1> ScalarArray3;
     typedef typename Eigen::Matrix<typename DerivedF::Scalar, 3, 1> IndexArray3;
-    const size_t INVALID = std::numeric_limits<size_t>::max();
+    const Index INVALID = std::numeric_limits<Index>::max();
 
     Index outer_vid;
     Eigen::Matrix<Index,Eigen::Dynamic,1> candidate_faces;
@@ -120,17 +128,19 @@ IGL_INLINE void igl::outer_edge(
 
     Scalar outer_slope_YX = 0;
     Scalar outer_slope_ZX = 0;
-    size_t outer_opp_vid = INVALID;
+    Index outer_opp_vid = INVALID;
     bool infinite_slope_detected = false;
     std::vector<Index> incident_faces;
     auto check_and_update_outer_edge = [&](Index opp_vid, Index fid) {
-        if (opp_vid == outer_opp_vid) {
+        if (opp_vid == outer_opp_vid)
+        {
             incident_faces.push_back(fid);
             return;
         }
 
         const ScalarArray3 opp_v = V.row(opp_vid);
-        if (!infinite_slope_detected && outer_v[0] != opp_v[0]) {
+        if (!infinite_slope_detected && outer_v[0] != opp_v[0])
+        {
             // Finite slope
             const ScalarArray3 diff = opp_v - outer_v;
             const Scalar slope_YX = diff[1] / diff[0];
@@ -167,7 +177,8 @@ IGL_INLINE void igl::outer_edge(
                 outer_slope_ZX = slope_ZX;
                 incident_faces = {fid};
             }
-        } else if (!infinite_slope_detected) {
+        } else if (!infinite_slope_detected)
+        {
             // Infinite slope
             outer_opp_vid = opp_vid;
             infinite_slope_detected = true;
@@ -175,8 +186,9 @@ IGL_INLINE void igl::outer_edge(
         }
     };
 
-    const auto num_candidate_faces = candidate_faces.size();
-    for (size_t i=0; i<num_candidate_faces; i++) {
+    const size_t num_candidate_faces = candidate_faces.size();
+    for (size_t i=0; i<num_candidate_faces; i++)
+    {
         const Index fid = candidate_faces(i);
         const IndexArray3& f = F.row(fid);
         size_t id = get_vertex_index(f, outer_vid);

+ 0 - 3
include/igl/per_face_normals.cpp

@@ -54,9 +54,6 @@ IGL_INLINE void igl::per_face_normals_stable(
   Eigen::PlainObjectBase<DerivedN> & N)
 {
   using namespace Eigen;
-  typedef Matrix<typename DerivedN::Scalar,DerivedN::RowsAtCompileTime,3> MatrixN3;
-  typedef Matrix<typename DerivedV::Scalar,DerivedF::RowsAtCompileTime,3> MatrixV3;
-  typedef Matrix<typename DerivedV::Scalar,3,3> MatrixV33;
   typedef Matrix<typename DerivedV::Scalar,1,3> RowVectorV3;
   typedef typename DerivedV::Scalar Scalar;