From 9158d9b20cff20a3bf5728fa6ba950abecf7aac9 Mon Sep 17 00:00:00 2001 From: David Rose Date: Sun, 4 Aug 2013 12:31:32 +0000 Subject: [PATCH] minor change to decimate --- pandatool/src/bam/ptsToBam.cxx | 8 +++++--- pandatool/src/bam/ptsToBam.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pandatool/src/bam/ptsToBam.cxx b/pandatool/src/bam/ptsToBam.cxx index a1f2b22644..e914faa178 100755 --- a/pandatool/src/bam/ptsToBam.cxx +++ b/pandatool/src/bam/ptsToBam.cxx @@ -75,7 +75,8 @@ run() { _num_points_expected = 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; _point_number = 0; _decimated_point_number = 0.0; @@ -87,7 +88,7 @@ run() { close_vertex_data(); 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 // constructor, above. @@ -192,6 +193,7 @@ add_point(const vector_string &words) { y = string_to_double(words[1], tail); z = string_to_double(words[2], tail); _vertex.add_data3d(x, y, z); + _num_points_added++; } //////////////////////////////////////////////////////////////////// @@ -222,7 +224,7 @@ close_vertex_data() { } _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); diff --git a/pandatool/src/bam/ptsToBam.h b/pandatool/src/bam/ptsToBam.h index 3785911fd1..c6f0184837 100755 --- a/pandatool/src/bam/ptsToBam.h +++ b/pandatool/src/bam/ptsToBam.h @@ -54,6 +54,7 @@ private: int _point_number; int _num_points_expected; int _num_points_found; + int _num_points_added; int _num_vdatas; double _decimated_point_number;