Bladeren bron

func -> callback, always_... -> trivial

Alec Jacobson 5 jaren geleden
bovenliggende
commit
d22414e388

+ 11 - 11
include/igl/collapse_edge.cpp

@@ -8,7 +8,7 @@
 #include "collapse_edge.h"
 #include "circulation.h"
 #include "edge_collapse_is_valid.h"
-#include "decimate_always_try_never_care.h"
+#include "decimate_trivial_callbacks.h"
 #include <vector>
 
 IGL_INLINE bool igl::collapse_edge(
@@ -193,7 +193,7 @@ IGL_INLINE bool igl::collapse_edge(
 }
 
 IGL_INLINE bool igl::collapse_edge(
-  const decimate_cost_and_placement_func & cost_and_placement,
+  const decimate_cost_and_placement_callback & cost_and_placement,
   Eigen::MatrixXd & V,
   Eigen::MatrixXi & F,
   Eigen::MatrixXi & E,
@@ -205,9 +205,9 @@ IGL_INLINE bool igl::collapse_edge(
   Eigen::MatrixXd & C)
 {
   int e,e1,e2,f1,f2;
-  decimate_pre_collapse_func always_try;
-  decimate_post_collapse_func never_care;
-  decimate_always_try_never_care(always_try,never_care);
+  decimate_pre_collapse_callback always_try;
+  decimate_post_collapse_callback never_care;
+  decimate_trivial_callbacks(always_try,never_care);
   return 
     collapse_edge(
       cost_and_placement,always_try,never_care,
@@ -215,9 +215,9 @@ IGL_INLINE bool igl::collapse_edge(
 }
 
 IGL_INLINE bool igl::collapse_edge(
-  const decimate_cost_and_placement_func & cost_and_placement,
-  const decimate_pre_collapse_func       & pre_collapse,
-  const decimate_post_collapse_func      & post_collapse,
+  const decimate_cost_and_placement_callback & cost_and_placement,
+  const decimate_pre_collapse_callback       & pre_collapse,
+  const decimate_post_collapse_callback      & post_collapse,
   Eigen::MatrixXd & V,
   Eigen::MatrixXi & F,
   Eigen::MatrixXi & E,
@@ -237,9 +237,9 @@ IGL_INLINE bool igl::collapse_edge(
 
 
 IGL_INLINE bool igl::collapse_edge(
-  const decimate_cost_and_placement_func & cost_and_placement,
-  const decimate_pre_collapse_func       & pre_collapse,
-  const decimate_post_collapse_func      & post_collapse,
+  const decimate_cost_and_placement_callback & cost_and_placement,
+  const decimate_pre_collapse_callback       & pre_collapse,
+  const decimate_post_collapse_callback      & post_collapse,
   Eigen::MatrixXd & V,
   Eigen::MatrixXi & F,
   Eigen::MatrixXi & E,

+ 8 - 8
include/igl/collapse_edge.h

@@ -9,7 +9,7 @@
 #define IGL_COLLAPSE_EDGE_H
 #include "igl_inline.h"
 #include "min_heap.h"
-#include "decimate_func_types.h"
+#include "decimate_callback_types.h"
 #include <Eigen/Core>
 #include <vector>
 #include <set>
@@ -97,7 +97,7 @@ namespace igl
   //   EQ  #E list of "time" of last time pushed into Q
   //   C  #E by dim list of stored placements
   IGL_INLINE bool collapse_edge(
-    const decimate_cost_and_placement_func & cost_and_placement,
+    const decimate_cost_and_placement_callback & cost_and_placement,
     Eigen::MatrixXd & V,
     Eigen::MatrixXi & F,
     Eigen::MatrixXi & E,
@@ -116,9 +116,9 @@ namespace igl
   //   post_collapse  callback called with index of edge whose collapse was
   //     just attempted and a flag revealing whether this was successful.
   IGL_INLINE bool collapse_edge(
-    const decimate_cost_and_placement_func & cost_and_placement,
-    const decimate_pre_collapse_func       & pre_collapse,
-    const decimate_post_collapse_func      & post_collapse,
+    const decimate_cost_and_placement_callback & cost_and_placement,
+    const decimate_pre_collapse_callback       & pre_collapse,
+    const decimate_post_collapse_callback      & post_collapse,
     Eigen::MatrixXd & V,
     Eigen::MatrixXi & F,
     Eigen::MatrixXi & E,
@@ -130,9 +130,9 @@ namespace igl
     Eigen::MatrixXd & C);
 
   IGL_INLINE bool collapse_edge(
-    const decimate_cost_and_placement_func & cost_and_placement,
-    const decimate_pre_collapse_func       & pre_collapse,
-    const decimate_post_collapse_func      & post_collapse,
+    const decimate_cost_and_placement_callback & cost_and_placement,
+    const decimate_pre_collapse_callback       & pre_collapse,
+    const decimate_post_collapse_callback      & post_collapse,
     Eigen::MatrixXd & V,
     Eigen::MatrixXi & F,
     Eigen::MatrixXi & E,

+ 17 - 17
include/igl/decimate.cpp

@@ -8,7 +8,7 @@
 #include "decimate.h"
 #include "collapse_edge.h"
 #include "edge_flaps.h"
-#include "decimate_always_try_never_care.h"
+#include "decimate_trivial_callbacks.h"
 #include "is_edge_manifold.h"
 #include "remove_unreferenced.h"
 #include "slice_mask.h"
@@ -50,9 +50,9 @@ IGL_INLINE bool igl::decimate(
       return false;
     }
   }
-  decimate_pre_collapse_func always_try;
-  decimate_post_collapse_func never_care;
-  decimate_always_try_never_care(always_try,never_care);
+  decimate_pre_collapse_callback always_try;
+  decimate_post_collapse_callback never_care;
+  decimate_trivial_callbacks(always_try,never_care);
   bool ret = decimate(
     VO,
     FO,
@@ -92,17 +92,17 @@ IGL_INLINE bool igl::decimate(
 IGL_INLINE bool igl::decimate(
   const Eigen::MatrixXd & OV,
   const Eigen::MatrixXi & OF,
-  const decimate_cost_and_placement_func & cost_and_placement,
-  const decimate_stopping_condition_func & stopping_condition,
+  const decimate_cost_and_placement_callback & cost_and_placement,
+  const decimate_stopping_condition_callback & stopping_condition,
   Eigen::MatrixXd & U,
   Eigen::MatrixXi & G,
   Eigen::VectorXi & J,
   Eigen::VectorXi & I
   )
 {
-  decimate_pre_collapse_func always_try;
-  decimate_post_collapse_func never_care;
-  decimate_always_try_never_care(always_try,never_care);
+  decimate_pre_collapse_callback always_try;
+  decimate_post_collapse_callback never_care;
+  decimate_trivial_callbacks(always_try,never_care);
   return igl::decimate(
     OV,OF,cost_and_placement,stopping_condition,always_try,never_care,U,G,J,I);
 }
@@ -110,10 +110,10 @@ IGL_INLINE bool igl::decimate(
 IGL_INLINE bool igl::decimate(
   const Eigen::MatrixXd & OV,
   const Eigen::MatrixXi & OF,
-  const decimate_cost_and_placement_func & cost_and_placement,
-  const decimate_stopping_condition_func & stopping_condition,
-  const decimate_pre_collapse_func       & pre_collapse,
-  const decimate_post_collapse_func      & post_collapse,
+  const decimate_cost_and_placement_callback & cost_and_placement,
+  const decimate_stopping_condition_callback & stopping_condition,
+  const decimate_pre_collapse_callback       & pre_collapse,
+  const decimate_post_collapse_callback      & post_collapse,
   Eigen::MatrixXd & U,
   Eigen::MatrixXi & G,
   Eigen::VectorXi & J,
@@ -133,10 +133,10 @@ IGL_INLINE bool igl::decimate(
 IGL_INLINE bool igl::decimate(
   const Eigen::MatrixXd & OV,
   const Eigen::MatrixXi & OF,
-  const decimate_cost_and_placement_func & cost_and_placement,
-  const decimate_stopping_condition_func & stopping_condition,
-  const decimate_pre_collapse_func       & pre_collapse,
-  const decimate_post_collapse_func      & post_collapse,
+  const decimate_cost_and_placement_callback & cost_and_placement,
+  const decimate_stopping_condition_callback & stopping_condition,
+  const decimate_pre_collapse_callback       & pre_collapse,
+  const decimate_post_collapse_callback      & post_collapse,
   const Eigen::MatrixXi & OE,
   const Eigen::VectorXi & OEMAP,
   const Eigen::MatrixXi & OEF,

+ 11 - 11
include/igl/decimate.h

@@ -8,7 +8,7 @@
 #ifndef IGL_DECIMATE_H
 #define IGL_DECIMATE_H
 #include "igl_inline.h"
-#include "decimate_func_types.h"
+#include "decimate_callback_types.h"
 #include <Eigen/Core>
 namespace igl
 {
@@ -67,8 +67,8 @@ namespace igl
   IGL_INLINE bool decimate(
     const Eigen::MatrixXd & V,
     const Eigen::MatrixXi & F,
-    const decimate_cost_and_placement_func & cost_and_placement,
-    const decimate_stopping_condition_func & stopping_condition,
+    const decimate_cost_and_placement_callback & cost_and_placement,
+    const decimate_stopping_condition_callback & stopping_condition,
     Eigen::MatrixXd & U,
     Eigen::MatrixXi & G,
     Eigen::VectorXi & J,
@@ -82,10 +82,10 @@ namespace igl
   IGL_INLINE bool decimate(
     const Eigen::MatrixXd & V,
     const Eigen::MatrixXi & F,
-    const decimate_cost_and_placement_func & cost_and_placement,
-    const decimate_stopping_condition_func & stopping_condition,
-    const decimate_pre_collapse_func       & pre_collapse,
-    const decimate_post_collapse_func      & post_collapse,
+    const decimate_cost_and_placement_callback & cost_and_placement,
+    const decimate_stopping_condition_callback & stopping_condition,
+    const decimate_pre_collapse_callback       & pre_collapse,
+    const decimate_post_collapse_callback      & post_collapse,
     Eigen::MatrixXd & U,
     Eigen::MatrixXi & G,
     Eigen::VectorXi & J,
@@ -100,10 +100,10 @@ namespace igl
   IGL_INLINE bool decimate(
     const Eigen::MatrixXd & V,
     const Eigen::MatrixXi & F,
-    const decimate_cost_and_placement_func & cost_and_placement,
-    const decimate_stopping_condition_func & stopping_condition,
-    const decimate_pre_collapse_func       & pre_collapse,
-    const decimate_post_collapse_func      & post_collapse,
+    const decimate_cost_and_placement_callback & cost_and_placement,
+    const decimate_stopping_condition_callback & stopping_condition,
+    const decimate_pre_collapse_callback       & pre_collapse,
+    const decimate_post_collapse_callback      & post_collapse,
     const Eigen::MatrixXi & E,
     const Eigen::VectorXi & EMAP,
     const Eigen::MatrixXi & EF,

+ 6 - 6
include/igl/decimate_func_types.h → include/igl/decimate_callback_types.h

@@ -5,14 +5,14 @@
 // This Source Code Form is subject to the terms of the Mozilla Public License 
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can 
 // obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_DECIMATE_FUNC_TYPES_H
-#define IGL_DECIMATE_FUNC_TYPES_H
+#ifndef IGL_DECIMATE_CALLBACK_TYPES_H
+#define IGL_DECIMATE_CALLBACK_TYPES_H
 #include <Eigen/Core>
 #include "min_heap.h"
 namespace igl
 {
   // Function handles used to customize the `igl::decimate` command.
-  using decimate_cost_and_placement_func = 
+  using decimate_cost_and_placement_callback = 
     std::function<void(
       const int                                           ,/*e*/
       const Eigen::MatrixXd &                             ,/*V*/
@@ -24,7 +24,7 @@ namespace igl
       double &                                            ,/*cost*/
       Eigen::RowVectorXd &                                 /*p*/
       )>;
-  using decimate_stopping_condition_func = 
+  using decimate_stopping_condition_callback = 
     std::function<bool(
       const Eigen::MatrixXd &                             ,/*V*/
       const Eigen::MatrixXi &                             ,/*F*/
@@ -41,7 +41,7 @@ namespace igl
       const int                                           ,/*f1*/
       const int                                            /*f2*/
       )>;
-  using decimate_pre_collapse_func = 
+  using decimate_pre_collapse_callback = 
     std::function<bool(
       const Eigen::MatrixXd &                             ,/*V*/
       const Eigen::MatrixXi &                             ,/*F*/
@@ -54,7 +54,7 @@ namespace igl
       const Eigen::MatrixXd &                             ,/*C*/
       const int                                            /*e*/
       )>;
-  using decimate_post_collapse_func = 
+  using decimate_post_collapse_callback = 
     std::function<void(
       const Eigen::MatrixXd &                             ,/*V*/
       const Eigen::MatrixXi &                             ,/*F*/

+ 4 - 4
include/igl/decimate_always_try_never_care.cpp → include/igl/decimate_trivial_callbacks.cpp

@@ -5,11 +5,11 @@
 // This Source Code Form is subject to the terms of the Mozilla Public License 
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can 
 // obtain one at http://mozilla.org/MPL/2.0/.
-#include "decimate_always_try_never_care.h"
+#include "decimate_trivial_callbacks.h"
 
-IGL_INLINE void igl::decimate_always_try_never_care(
-    decimate_pre_collapse_func  & always_try,
-    decimate_post_collapse_func & never_care)
+IGL_INLINE void igl::decimate_trivial_callbacks(
+    decimate_pre_collapse_callback  & always_try,
+    decimate_post_collapse_callback & never_care)
 {
   always_try = [](
     const Eigen::MatrixXd &                             ,/*V*/

+ 7 - 7
include/igl/decimate_always_try_never_care.h → include/igl/decimate_trivial_callbacks.h

@@ -5,10 +5,10 @@
 // This Source Code Form is subject to the terms of the Mozilla Public License 
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can 
 // obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_DECIMATE_ALWAYS_TRY_NEVER_CARE_H
-#define IGL_DECIMATE_ALWAYS_TRY_NEVER_CARE_H
+#ifndef IGL_DECIMATE_TRIVIAL_CALLBACKS_H
+#define IGL_DECIMATE_TRIVIAL_CALLBACKS_H
 #include "igl_inline.h"
-#include "decimate_func_types.h"
+#include "decimate_callback_types.h"
 namespace igl
 {
   // Function to build trivial pre and post collapse actions. 
@@ -18,13 +18,13 @@ namespace igl
   //     edge collapse)
   //   never_care  fuction that is always a no-op (never have a post collapse
   //     response)
-  IGL_INLINE void decimate_always_try_never_care(
-    decimate_pre_collapse_func  & always_try,
-    decimate_post_collapse_func & never_care);
+  IGL_INLINE void decimate_trivial_callbacks(
+    decimate_pre_collapse_callback  & always_try,
+    decimate_post_collapse_callback & never_care);
 };
 
 #ifndef IGL_STATIC_LIBRARY
-#  include "decimate_always_try_never_care.cpp"
+#  include "decimate_trivial_callbacks.cpp"
 #endif
 
 #endif 

+ 5 - 5
include/igl/infinite_cost_stopping_condition.cpp

@@ -8,8 +8,8 @@
 #include "infinite_cost_stopping_condition.h"
 
 IGL_INLINE void igl::infinite_cost_stopping_condition(
-  const decimate_cost_and_placement_func & cost_and_placement,
-  decimate_stopping_condition_func & stopping_condition)
+  const decimate_cost_and_placement_callback & cost_and_placement,
+  decimate_stopping_condition_callback & stopping_condition)
 {
   stopping_condition = 
     [&cost_and_placement]
@@ -36,11 +36,11 @@ IGL_INLINE void igl::infinite_cost_stopping_condition(
     };
 }
 
-IGL_INLINE igl::decimate_stopping_condition_func
+IGL_INLINE igl::decimate_stopping_condition_callback
   igl::infinite_cost_stopping_condition(
-  const decimate_cost_and_placement_func & cost_and_placement)
+  const decimate_cost_and_placement_callback & cost_and_placement)
 {
-  decimate_stopping_condition_func stopping_condition;
+  decimate_stopping_condition_callback stopping_condition;
   infinite_cost_stopping_condition(cost_and_placement,stopping_condition);
   return stopping_condition;
 }

+ 5 - 5
include/igl/infinite_cost_stopping_condition.h

@@ -8,7 +8,7 @@
 #ifndef IGL_INFINITE_COST_STOPPING_CONDITION_H
 #define IGL_INFINITE_COST_STOPPING_CONDITION_H
 #include "igl_inline.h"
-#include "decimate_func_types.h"
+#include "decimate_callback_types.h"
 #include <Eigen/Core>
 #include <vector>
 #include <set>
@@ -24,11 +24,11 @@ namespace igl
   //   stopping_condition
   //
   IGL_INLINE void infinite_cost_stopping_condition(
-    const decimate_cost_and_placement_func & cost_and_placement,
-    decimate_stopping_condition_func & stopping_condition);
-  IGL_INLINE decimate_stopping_condition_func
+    const decimate_cost_and_placement_callback & cost_and_placement,
+    decimate_stopping_condition_callback & stopping_condition);
+  IGL_INLINE decimate_stopping_condition_callback
     infinite_cost_stopping_condition(
-    const decimate_cost_and_placement_func & cost_and_placement);
+    const decimate_cost_and_placement_callback & cost_and_placement);
 }
 
 #ifndef IGL_STATIC_LIBRARY

+ 3 - 3
include/igl/max_faces_stopping_condition.cpp

@@ -11,7 +11,7 @@ IGL_INLINE void igl::max_faces_stopping_condition(
   int & m,
   const int orig_m,
   const int max_m,
-  decimate_stopping_condition_func & stopping_condition)
+  decimate_stopping_condition_callback & stopping_condition)
 {
   stopping_condition = 
     [orig_m,max_m,&m](
@@ -37,13 +37,13 @@ IGL_INLINE void igl::max_faces_stopping_condition(
     };
 }
 
-IGL_INLINE igl::decimate_stopping_condition_func
+IGL_INLINE igl::decimate_stopping_condition_callback
 igl::max_faces_stopping_condition(
   int & m,
   const int orig_m,
   const int max_m)
 {
-  decimate_stopping_condition_func stopping_condition;
+  decimate_stopping_condition_callback stopping_condition;
   max_faces_stopping_condition(m,orig_m,max_m,stopping_condition);
   return stopping_condition;
 }

+ 3 - 3
include/igl/max_faces_stopping_condition.h

@@ -8,7 +8,7 @@
 #ifndef IGL_MAX_FACES_STOPPING_CONDITION_H
 #define IGL_MAX_FACES_STOPPING_CONDITION_H
 #include "igl_inline.h"
-#include "decimate_func_types.h"
+#include "decimate_callback_types.h"
 #include <Eigen/Core>
 #include <vector>
 #include <set>
@@ -32,8 +32,8 @@ namespace igl
     int & m,
     const int orig_m,
     const int max_m,
-    decimate_stopping_condition_func & stopping_condition);
-  IGL_INLINE decimate_stopping_condition_func
+    decimate_stopping_condition_callback & stopping_condition);
+  IGL_INLINE decimate_stopping_condition_callback
     max_faces_stopping_condition(
       int & m,
       const int orign_m,

+ 3 - 3
include/igl/qslim.cpp

@@ -58,9 +58,9 @@ IGL_INLINE bool igl::qslim(
   int v1 = -1;
   int v2 = -1;
   // Callbacks for computing and updating metric
-  decimate_cost_and_placement_func cost_and_placement;
-  decimate_pre_collapse_func       pre_collapse;
-  decimate_post_collapse_func      post_collapse;
+  decimate_cost_and_placement_callback cost_and_placement;
+  decimate_pre_collapse_callback       pre_collapse;
+  decimate_post_collapse_callback      post_collapse;
   qslim_optimal_collapse_edge_callbacks(
     E,quadrics,v1,v2, cost_and_placement, pre_collapse,post_collapse);
   // Call to greedy decimator

+ 3 - 3
include/igl/qslim_optimal_collapse_edge_callbacks.cpp

@@ -15,9 +15,9 @@ IGL_INLINE void igl::qslim_optimal_collapse_edge_callbacks(
     quadrics,
   int & v1,
   int & v2,
-  decimate_cost_and_placement_func & cost_and_placement,
-  decimate_pre_collapse_func       & pre_collapse,
-  decimate_post_collapse_func      & post_collapse)
+  decimate_cost_and_placement_callback & cost_and_placement,
+  decimate_pre_collapse_callback       & pre_collapse,
+  decimate_post_collapse_callback      & post_collapse)
 {
   typedef std::tuple<Eigen::MatrixXd,Eigen::RowVectorXd,double> Quadric;
   cost_and_placement = [&quadrics,&v1,&v2](

+ 4 - 4
include/igl/qslim_optimal_collapse_edge_callbacks.h

@@ -8,7 +8,7 @@
 #ifndef IGL_QSLIM_OPTIMAL_COLLAPSE_EDGE_CALLBACKS_H
 #define IGL_QSLIM_OPTIMAL_COLLAPSE_EDGE_CALLBACKS_H
 #include "igl_inline.h"
-#include "decimate_func_types.h"
+#include "decimate_callback_types.h"
 #include <Eigen/Core>
 #include <functional>
 #include <vector>
@@ -35,9 +35,9 @@ namespace igl
       quadrics,
     int & v1,
     int & v2,
-    decimate_cost_and_placement_func & cost_and_placement,
-    decimate_pre_collapse_func & pre_collapse,
-    decimate_post_collapse_func & post_collapse);
+    decimate_cost_and_placement_callback & cost_and_placement,
+    decimate_pre_collapse_callback & pre_collapse,
+    decimate_post_collapse_callback & post_collapse);
 }
 #ifndef IGL_STATIC_LIBRARY
 #  include "qslim_optimal_collapse_edge_callbacks.cpp"