Browse Source

minor change to decimate

David Rose 12 years ago
parent
commit
9158d9b20c
2 changed files with 6 additions and 3 deletions
  1. 5 3
      pandatool/src/bam/ptsToBam.cxx
  2. 1 0
      pandatool/src/bam/ptsToBam.h

+ 5 - 3
pandatool/src/bam/ptsToBam.cxx

@@ -75,7 +75,8 @@ run() {
 
 
   _num_points_expected = 0;
   _num_points_expected = 0;
   _num_points_found = 0;
   _num_points_found = 0;
-  _decimate_factor = 1.0 / _decimate_divisor;
+  _num_points_added = 0;
+  _decimate_factor = 1.0 / max(1.0, _decimate_divisor);
   _line_number = 0;
   _line_number = 0;
   _point_number = 0;
   _point_number = 0;
   _decimated_point_number = 0.0;
   _decimated_point_number = 0.0;
@@ -87,7 +88,7 @@ run() {
   close_vertex_data();
   close_vertex_data();
   
   
   nout << "\nFound " << _num_points_found << " points of " << _num_points_expected << " expected.\n";
   nout << "\nFound " << _num_points_found << " points of " << _num_points_expected << " expected.\n";
-  nout << "Generated " << _point_number << " points to bam file.\n";
+  nout << "Generated " << _num_points_added << " points to bam file.\n";
 
 
   // This should be guaranteed because we pass false to the
   // This should be guaranteed because we pass false to the
   // constructor, above.
   // constructor, above.
@@ -192,6 +193,7 @@ add_point(const vector_string &words) {
   y = string_to_double(words[1], tail);
   y = string_to_double(words[1], tail);
   z = string_to_double(words[2], tail);
   z = string_to_double(words[2], tail);
   _vertex.add_data3d(x, y, z);
   _vertex.add_data3d(x, y, z);
+  _num_points_added++;
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -222,7 +224,7 @@ close_vertex_data() {
   }
   }
 
 
   _num_vdatas++;
   _num_vdatas++;
-  nout << "\nGenerating " << _point_number << " points in " << _num_vdatas << " GeomVertexDatas\n";
+  nout << "\nGenerating " << _num_points_added << " points in " << _num_vdatas << " GeomVertexDatas\n";
 
 
   PT(Geom) geom = new Geom(_data);
   PT(Geom) geom = new Geom(_data);
 
 

+ 1 - 0
pandatool/src/bam/ptsToBam.h

@@ -54,6 +54,7 @@ private:
   int _point_number;
   int _point_number;
   int _num_points_expected;
   int _num_points_expected;
   int _num_points_found;
   int _num_points_found;
+  int _num_points_added;
   int _num_vdatas;
   int _num_vdatas;
 
 
   double _decimated_point_number;
   double _decimated_point_number;