From 11376f3c0dd9a22c556ee6114ca2954c37c7300f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 23 Jul 2013 16:01:46 +0000 Subject: [PATCH] Fixed several conversion warnings git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@850 fdac6126-5c0c-442c-9429-916003d36597 --- src/OpenMesh/Core/Mesh/ArrayKernelT.cc | 7 ++++++- src/OpenMesh/Tools/Decimater/DecimaterT.cc | 4 ++-- src/OpenMesh/Tools/Decimater/McDecimaterT.cc | 4 ++-- src/OpenMesh/Tools/Decimater/MixedDecimaterT.cc | 12 ++++++------ src/OpenMesh/Tools/Decimater/ModNormalFlippingT.hh | 8 ++++---- src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3T.hh | 4 ++-- src/OpenMesh/Tools/Utils/HeapT.hh | 4 ++-- src/OpenMesh/Tools/VDPM/VHierarchy.cc | 6 +++--- src/OpenMesh/Tools/VDPM/VHierarchy.hh | 2 +- 9 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/OpenMesh/Core/Mesh/ArrayKernelT.cc b/src/OpenMesh/Core/Mesh/ArrayKernelT.cc index 58ed4ad4..be57f351 100644 --- a/src/OpenMesh/Core/Mesh/ArrayKernelT.cc +++ b/src/OpenMesh/Core/Mesh/ArrayKernelT.cc @@ -76,7 +76,12 @@ void ArrayKernel::garbage_collection(std_API_Container_VHandlePointer& vh_to_upd const bool track_hhandles = ( !hh_to_update.empty() ); const bool track_fhandles = ( !fh_to_update.empty() ); - int i, i0, i1, nV(int(n_vertices())), nE(int(n_edges())), nH(int(2*n_edges())), nF(int(n_faces())); + int i, i0, i1; + + int nV = int(n_vertices()); + int nE = int(n_edges()); + int nH = int(2*n_edges()); + int nF = (int(n_faces())); std::vector vh_map; std::vector hh_map; diff --git a/src/OpenMesh/Tools/Decimater/DecimaterT.cc b/src/OpenMesh/Tools/Decimater/DecimaterT.cc index 7637968e..7cb090d3 100644 --- a/src/OpenMesh/Tools/Decimater/DecimaterT.cc +++ b/src/OpenMesh/Tools/Decimater/DecimaterT.cc @@ -237,8 +237,8 @@ size_t DecimaterT::decimate_to_faces(size_t _nv, size_t _nf) { typename Mesh::HalfedgeHandle v0v1; typename Mesh::VertexVertexIter vv_it; typename Mesh::VertexFaceIter vf_it; - unsigned int nv = mesh_.n_vertices(); - unsigned int nf = mesh_.n_faces(); + size_t nv = mesh_.n_vertices(); + size_t nf = mesh_.n_faces(); unsigned int n_collapses = 0; typedef std::vector Support; diff --git a/src/OpenMesh/Tools/Decimater/McDecimaterT.cc b/src/OpenMesh/Tools/Decimater/McDecimaterT.cc index b8062805..df6dbac0 100644 --- a/src/OpenMesh/Tools/Decimater/McDecimaterT.cc +++ b/src/OpenMesh/Tools/Decimater/McDecimaterT.cc @@ -224,8 +224,8 @@ size_t McDecimaterT::decimate_to_faces(size_t _nv, size_t _nf) { if ( (_nv == 0) && (_nf == 1) ) return decimate_constraints_only(1.0); - unsigned int nv = mesh_.n_vertices(); - unsigned int nf = mesh_.n_faces(); + size_t nv = mesh_.n_vertices(); + size_t nf = mesh_.n_faces(); unsigned int n_collapses(0); diff --git a/src/OpenMesh/Tools/Decimater/MixedDecimaterT.cc b/src/OpenMesh/Tools/Decimater/MixedDecimaterT.cc index 0eba62ba..17f93b9b 100644 --- a/src/OpenMesh/Tools/Decimater/MixedDecimaterT.cc +++ b/src/OpenMesh/Tools/Decimater/MixedDecimaterT.cc @@ -119,21 +119,21 @@ size_t MixedDecimaterT::decimate_to_faces(const size_t _n_vertices,const r_collapses = McDecimaterT::decimate_to_faces(n_vertices_mc, n_faces_mc); } else { - const int samples = this->samples(); + const size_t samples = this->samples(); // MinimalSample count for the McDecimater - const int min = 2; + const size_t min = 2; // Maximal number of samples for the McDecimater - const int max = samples; + const size_t max = samples; // Number of incremental steps - const int steps = 7; + const size_t steps = 7; - for ( int i = 0; i < steps; ++i ) { + for ( size_t i = 0; i < steps; ++i ) { // Compute number of samples to be used - int samples = double( min) + double(i)/(double(steps)-1.0) * (max-2) ; + size_t samples = int (double( min) + double(i)/(double(steps)-1.0) * (max-2) ) ; // We won't allow 1 here, as this is the last step in the incremental part double decimaterLevel = (double(i + 1)) * _mc_factor / (double(steps) ); diff --git a/src/OpenMesh/Tools/Decimater/ModNormalFlippingT.hh b/src/OpenMesh/Tools/Decimater/ModNormalFlippingT.hh index 14ab9178..0eee2355 100644 --- a/src/OpenMesh/Tools/Decimater/ModNormalFlippingT.hh +++ b/src/OpenMesh/Tools/Decimater/ModNormalFlippingT.hh @@ -147,7 +147,7 @@ public: // the smaller the factor, the smaller max_deviation_ gets // thus creating a stricter constraint // division by error_tolerance_factor_ is for normalization - float max_normal_deviation = (max_deviation_ * 180.0/M_PI) * _factor / this->error_tolerance_factor_; + double max_normal_deviation = (max_deviation_ * 180.0/M_PI) * _factor / this->error_tolerance_factor_; set_max_normal_deviation(max_normal_deviation); this->error_tolerance_factor_ = _factor; } @@ -157,15 +157,15 @@ public: public: /// get normal deviation - float max_normal_deviation() const { return max_deviation_ / M_PI * 180.0; } + double max_normal_deviation() const { return max_deviation_ / M_PI * 180.0; } /** Set normal deviation * * Set the maximum angular deviation of the orignal normal and the new * normal in degrees. */ - void set_max_normal_deviation(float _f) { - max_deviation_ = _f / 180.0 * M_PI; + void set_max_normal_deviation(double _d) { + max_deviation_ = _d / 180.0 * M_PI; min_cos_ = cos(max_deviation_); } diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3T.hh b/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3T.hh index 35052036..62317d48 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3T.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3T.hh @@ -107,10 +107,10 @@ public: public: - Sqrt3T(void) : parent_t(), _1over3( 1.0/3.0 ), _1over27( 1.0/27.0 ) + Sqrt3T(void) : parent_t(), _1over3( real_t(1.0/3.0) ), _1over27( real_t(1.0/27.0) ) { init_weights(); } - Sqrt3T(MeshType &_m) : parent_t(_m), _1over3( 1.0/3.0 ), _1over27( 1.0/27.0 ) + Sqrt3T(MeshType &_m) : parent_t(_m), _1over3( real_t(1.0/3.0) ), _1over27( real_t(1.0/27.0) ) { init_weights(); } virtual ~Sqrt3T() {} diff --git a/src/OpenMesh/Tools/Utils/HeapT.hh b/src/OpenMesh/Tools/Utils/HeapT.hh index 2872b087..0dadf24c 100644 --- a/src/OpenMesh/Tools/Utils/HeapT.hh +++ b/src/OpenMesh/Tools/Utils/HeapT.hh @@ -156,10 +156,10 @@ public: bool empty() const { return HeapVector::empty(); } /// returns the size of heap - unsigned int size() const { return HeapVector::size(); } + size_t size() const { return HeapVector::size(); } /// reserve space for _n entries - void reserve(unsigned int _n) { HeapVector::reserve(_n); } + void reserve(size_t _n) { HeapVector::reserve(_n); } /// reset heap position to -1 (not in heap) void reset_heap_position(HeapEntry _h) diff --git a/src/OpenMesh/Tools/VDPM/VHierarchy.cc b/src/OpenMesh/Tools/VDPM/VHierarchy.cc index 2c55fb7d..d7687fc3 100644 --- a/src/OpenMesh/Tools/VDPM/VHierarchy.cc +++ b/src/OpenMesh/Tools/VDPM/VHierarchy.cc @@ -90,7 +90,7 @@ add_node(const VHierarchyNode &_node) { nodes_.push_back(_node); - return VHierarchyNodeHandle(nodes_.size() - 1); + return VHierarchyNodeHandle(int(nodes_.size() - 1)); } @@ -150,8 +150,8 @@ is_ancestor(VHierarchyNodeIndex _ancestor_index, VHierarchyNodeIndex _descendent if (_ancestor_index.tree_id(tree_id_bits_) != _descendent_index.tree_id(tree_id_bits_)) return false; - unsigned int ancestor_node_id = _ancestor_index.node_id(tree_id_bits_); - unsigned int descendent_node_id = _descendent_index.node_id(tree_id_bits_); + unsigned int ancestor_node_id = _ancestor_index.node_id(tree_id_bits_); + unsigned int descendent_node_id = _descendent_index.node_id(tree_id_bits_); if (ancestor_node_id > descendent_node_id) return false; diff --git a/src/OpenMesh/Tools/VDPM/VHierarchy.hh b/src/OpenMesh/Tools/VDPM/VHierarchy.hh index b0d3a5a2..e5cabd5f 100644 --- a/src/OpenMesh/Tools/VDPM/VHierarchy.hh +++ b/src/OpenMesh/Tools/VDPM/VHierarchy.hh @@ -87,7 +87,7 @@ public: void clear() { nodes_.clear(); n_roots_ = 0; } unsigned char tree_id_bits() const { return tree_id_bits_; } unsigned int num_roots() const { return n_roots_; } - unsigned int num_nodes() const { return nodes_.size(); } + size_t num_nodes() const { return nodes_.size(); } VHierarchyNodeIndex generate_node_index(id_t _tree_id, id_t _node_id) {