Bladeren bron

interface change in reorient_facets_raycast

Former-commit-id: 4b219d3257443ad8130c50c6f7896d10aa3cebb3
Kenshi Takayama (kenshi 11 jaren geleden
bovenliggende
commit
9ab4a9fba5
2 gewijzigde bestanden met toevoegingen van 14 en 10 verwijderingen
  1. 8 8
      include/igl/embree/reorient_facets_raycast.cpp
  2. 6 2
      include/igl/embree/reorient_facets_raycast.h

+ 8 - 8
include/igl/embree/reorient_facets_raycast.cpp

@@ -24,7 +24,8 @@
   IGL_INLINE void igl::reorient_facets_raycast(
     const Eigen::PlainObjectBase<DerivedV> & V,
     const Eigen::PlainObjectBase<DerivedF> & F,
-    int num_rays,
+    int rays_total,
+    int rays_minimum,
     bool use_parity,
     bool is_verbose,
     Eigen::PlainObjectBase<DerivedI> & I)
@@ -72,12 +73,11 @@
     area_per_component(C(f)) += A(f);
   }
   VectorXi num_rays_per_component(num_cc);
-  num_rays_per_component.fill(100);     // Minimum number of rays per component (predefined)
   for (int c = 0; c < num_cc; ++c)
   {
-    num_rays_per_component(c) += static_cast<int>(num_rays * area_per_component(c) / area_total);
+    num_rays_per_component(c) = max<int>(static_cast<int>(rays_total * area_per_component(c) / area_total), rays_minimum);
   }
-  num_rays = num_rays_per_component.sum();
+  rays_total = num_rays_per_component.sum();
   
   // generate all the rays
   if (is_verbose) cout << "generating rays... ";
@@ -87,9 +87,9 @@
   vector<int     > ray_face;
   vector<Vector3f> ray_ori;
   vector<Vector3f> ray_dir;
-  ray_face.reserve(num_rays);
-  ray_ori .reserve(num_rays);
-  ray_dir .reserve(num_rays);
+  ray_face.reserve(rays_total);
+  ray_ori .reserve(rays_total);
+  ray_dir .reserve(rays_total);
   for (int c = 0; c < num_cc; ++c)
   {
     if (area_per_component[c] == 0)
@@ -142,7 +142,7 @@
       ray_ori .push_back(p);
       ray_dir .push_back(d);
 
-      if (is_verbose && ray_face.size() % (num_rays / 10) == 0) cout << ".";
+      if (is_verbose && ray_face.size() % (rays_total / 10) == 0) cout << ".";
     }
   }
   if (is_verbose) cout << ray_face.size()  << " rays. ";

+ 6 - 2
include/igl/embree/reorient_facets_raycast.h

@@ -17,7 +17,10 @@ namespace igl
   // Inputs:
   //   V                            #V by 3 list of vertex positions
   //   F                            #F by 3 list of triangle indices
-  //   num_rays                     Total number of rays that will be shot
+  //   rays_total                   Total number of rays that will be shot
+  //   rays_minimum                 Minimum number of rays that each patch should receive
+  //   use_parity                   Flag for using parity mode
+  //   is_verbose                   Flag for verbose output to cout
   // Outputs:
   //   I                            #F list of whether face has been flipped
   template <
@@ -27,7 +30,8 @@ namespace igl
   IGL_INLINE void reorient_facets_raycast(
     const Eigen::PlainObjectBase<DerivedV> & V,
     const Eigen::PlainObjectBase<DerivedF> & F,
-    int num_rays,
+    int rays_total,
+    int rays_minimum,
     bool use_parity,
     bool is_verbose,
     Eigen::PlainObjectBase<DerivedI> & I);