Browse Source

restored documentation and resolve_func expose on basic mesh_boolean

Former-commit-id: 3b06d25c94c24c5d43b5562713e4418ad86f03a3
Alec Jacobson 9 years ago
parent
commit
68d937f362

+ 53 - 28
include/igl/copyleft/boolean/mesh_boolean.cpp

@@ -286,35 +286,26 @@ IGL_INLINE void igl::copyleft::boolean::per_face_winding_number_binary_operation
 }
 
 template <
-typename DerivedVA,
-typename DerivedFA,
-typename DerivedVB,
-typename DerivedFB,
-typename DerivedVC,
-typename DerivedFC,
-typename DerivedJ>
+  typename DerivedVA,
+  typename DerivedFA,
+  typename DerivedVB,
+  typename DerivedFB,
+  typename ResolveFunc,
+  typename DerivedVC,
+  typename DerivedFC,
+  typename DerivedJ>
 IGL_INLINE void igl::copyleft::boolean::mesh_boolean(
-        const Eigen::PlainObjectBase<DerivedVA > & VA,
-        const Eigen::PlainObjectBase<DerivedFA > & FA,
-        const Eigen::PlainObjectBase<DerivedVB > & VB,
-        const Eigen::PlainObjectBase<DerivedFB > & FB,
-        const MeshBooleanType & type,
-        Eigen::PlainObjectBase<DerivedVC > & VC,
-        Eigen::PlainObjectBase<DerivedFC > & FC,
-        Eigen::PlainObjectBase<DerivedJ > & J) {
-    using namespace igl::copyleft::boolean::mesh_boolean_helper;
-    typedef Eigen::Matrix<
-        ExactScalar,
-        Eigen::Dynamic,
-        Eigen::Dynamic,
-        DerivedVC::IsRowMajor> MatrixXES;
-    std::function<void(
-            const Eigen::PlainObjectBase<DerivedVA>&,
-            const Eigen::PlainObjectBase<DerivedFA>&,
-            Eigen::PlainObjectBase<MatrixXES>&,
-            Eigen::PlainObjectBase<DerivedFC>&,
-            Eigen::PlainObjectBase<DerivedJ>&)> resolve_func =
-        igl_resolve<DerivedVA, DerivedFA, MatrixXES, DerivedFC, DerivedJ>;
+  const Eigen::PlainObjectBase<DerivedVA > & VA,
+  const Eigen::PlainObjectBase<DerivedFA > & FA,
+  const Eigen::PlainObjectBase<DerivedVB > & VB,
+  const Eigen::PlainObjectBase<DerivedFB > & FB,
+  const MeshBooleanType & type,
+  const ResolveFunc& resolve_func,
+  Eigen::PlainObjectBase<DerivedVC > & VC,
+  Eigen::PlainObjectBase<DerivedFC > & FC,
+  Eigen::PlainObjectBase<DerivedJ > & J)
+{
+  using namespace igl::copyleft::boolean::mesh_boolean_helper;
 
     switch (type) {
         case MESH_BOOLEAN_TYPE_UNION:
@@ -348,6 +339,40 @@ IGL_INLINE void igl::copyleft::boolean::mesh_boolean(
     }
 }
 
+template <
+  typename DerivedVA,
+  typename DerivedFA,
+  typename DerivedVB,
+  typename DerivedFB,
+  typename DerivedVC,
+  typename DerivedFC,
+  typename DerivedJ>
+IGL_INLINE void igl::copyleft::boolean::mesh_boolean(
+  const Eigen::PlainObjectBase<DerivedVA > & VA,
+  const Eigen::PlainObjectBase<DerivedFA > & FA,
+  const Eigen::PlainObjectBase<DerivedVB > & VB,
+  const Eigen::PlainObjectBase<DerivedFB > & FB,
+  const MeshBooleanType & type,
+  Eigen::PlainObjectBase<DerivedVC > & VC,
+  Eigen::PlainObjectBase<DerivedFC > & FC,
+  Eigen::PlainObjectBase<DerivedJ > & J)
+{
+  using namespace igl::copyleft::boolean::mesh_boolean_helper;
+  typedef Eigen::Matrix<
+    ExactScalar,
+    Eigen::Dynamic,
+    Eigen::Dynamic,
+    DerivedVC::IsRowMajor> MatrixXES;
+  std::function<void(
+    const Eigen::PlainObjectBase<DerivedVA>&,
+    const Eigen::PlainObjectBase<DerivedFA>&,
+    Eigen::PlainObjectBase<MatrixXES>&,
+    Eigen::PlainObjectBase<DerivedFC>&,
+    Eigen::PlainObjectBase<DerivedJ>&)> resolve_func =
+    igl_resolve<DerivedVA, DerivedFA, MatrixXES, DerivedFC, DerivedJ>;
+  return mesh_boolean(VA,FA,VB,FB,type,resolve_func,VC,FC,J);
+}
+
 template <
 typename DerivedVA,
 typename DerivedFA,

+ 57 - 17
include/igl/copyleft/boolean/mesh_boolean.h

@@ -43,24 +43,64 @@ namespace igl
               Eigen::PlainObjectBase<DerivedVC > & VC,
               Eigen::PlainObjectBase<DerivedFC > & FC,
               Eigen::PlainObjectBase<DerivedJ > & J);
+      //  MESH_BOOLEAN Compute boolean csg operations on "solid",
+      //  consistently
+      //  oriented meshes.
+      // 
+      //  Inputs:
+      //    VA  #VA by 3 list of vertex positions of first mesh
+      //    FA  #FA by 3 list of triangle indices into VA
+      //    VB  #VB by 3 list of vertex positions of second mesh
+      //    FB  #FB by 3 list of triangle indices into VB
+      //    type  type of boolean operation
+      //    resolve_fun  function handle for computing resolve of a
+      //      self-intersections of a mesh and outputting the new mesh.
+      //  Outputs:
+      //    VC  #VC by 3 list of vertex positions of boolean result mesh
+      //    FC  #FC by 3 list of triangle indices into VC
+      //    J  #FC list of indices into [FA;FB] revealing "birth" facet
+      //
+      //  See also: mesh_boolean_cork, intersect_other,
+      //  remesh_self_intersections
+      //     
 
-    template <
-      typename DerivedVA,
-      typename DerivedFA,
-      typename DerivedVB,
-      typename DerivedFB,
-      typename DerivedVC,
-      typename DerivedFC,
-      typename DerivedJ>
-    IGL_INLINE void mesh_boolean(
-      const Eigen::PlainObjectBase<DerivedVA > & VA,
-      const Eigen::PlainObjectBase<DerivedFA > & FA,
-      const Eigen::PlainObjectBase<DerivedVB > & VB,
-      const Eigen::PlainObjectBase<DerivedFB > & FB,
-      const MeshBooleanType & type,
-      Eigen::PlainObjectBase<DerivedVC > & VC,
-      Eigen::PlainObjectBase<DerivedFC > & FC,
-      Eigen::PlainObjectBase<DerivedJ > & J);
+      template <
+        typename DerivedVA,
+        typename DerivedFA,
+        typename DerivedVB,
+        typename DerivedFB,
+        typename ResolveFunc,
+        typename DerivedVC,
+        typename DerivedFC,
+        typename DerivedJ>
+      IGL_INLINE void mesh_boolean(
+        const Eigen::PlainObjectBase<DerivedVA > & VA,
+        const Eigen::PlainObjectBase<DerivedFA > & FA,
+        const Eigen::PlainObjectBase<DerivedVB > & VB,
+        const Eigen::PlainObjectBase<DerivedFB > & FB,
+        const MeshBooleanType & type,
+        const ResolveFunc& resolve_func,
+        Eigen::PlainObjectBase<DerivedVC > & VC,
+        Eigen::PlainObjectBase<DerivedFC > & FC,
+        Eigen::PlainObjectBase<DerivedJ > & J);
+
+      template <
+        typename DerivedVA,
+        typename DerivedFA,
+        typename DerivedVB,
+        typename DerivedFB,
+        typename DerivedVC,
+        typename DerivedFC,
+        typename DerivedJ>
+      IGL_INLINE void mesh_boolean(
+        const Eigen::PlainObjectBase<DerivedVA > & VA,
+        const Eigen::PlainObjectBase<DerivedFA > & FA,
+        const Eigen::PlainObjectBase<DerivedVB > & VB,
+        const Eigen::PlainObjectBase<DerivedFB > & FB,
+        const MeshBooleanType & type,
+        Eigen::PlainObjectBase<DerivedVC > & VC,
+        Eigen::PlainObjectBase<DerivedFC > & FC,
+        Eigen::PlainObjectBase<DerivedJ > & J);
 
     template <
       typename DerivedVA,