From 85e183ae05f7d13689bdba8aaf5d2a4ac34595a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 7 Nov 2016 14:12:29 +0100 Subject: [PATCH 01/10] Fixed VS2015 warnings --- src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc | 2 +- .../Tools/Subdivider/Uniform/Composite/CompositeT.cc | 6 +++--- src/OpenMesh/Tools/Subdivider/Uniform/LoopT.hh | 4 ++-- .../Tools/Subdivider/Uniform/ModifiedButterFlyT.hh | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc b/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc index ec7a9682..ad2f4ab8 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc +++ b/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc @@ -346,7 +346,7 @@ CatmullClarkT::update_vertex( MeshType& _m, const VertexHandl for ( ve_itr = _m.ve_iter( _vh); ve_itr.is_valid(); ++ve_itr) if ( _m.is_boundary( *ve_itr)) pos += _m.property( ep_pos_, *ve_itr); - pos /= 3.0; + pos /= static_cast(3.0); } else // inner vertex { diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc b/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc index 2258cf6e..947cda81 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc +++ b/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc @@ -116,7 +116,7 @@ void CompositeT::Tvv3() // set new positions for vertices v_it = mesh_.vertices_begin(); for (j = 0; j < n_vertices; ++j) { - mesh_.data(*v_it).set_position(mesh_.data(*v_it).position() * 3.0); + mesh_.data(*v_it).set_position(mesh_.data(*v_it).position() * static_cast(3.0) ); ++v_it; } @@ -180,7 +180,7 @@ void CompositeT::Tvv4() // set new positions for vertices v_it = mesh_.vertices_begin(); for (j = 0; j < n_vertices; ++j) { - mesh_.data(*v_it).set_position(mesh_.data(*v_it).position() * 4.0); + mesh_.data(*v_it).set_position(mesh_.data(*v_it).position() * static_cast(4.0) ); ++v_it; } @@ -1250,7 +1250,7 @@ CompositeT::split_edge(HalfedgeHandle _heh) vh2(mesh_.from_vertex_handle(_heh)); // Calculate and Insert Midpoint of Edge - vh = mesh_.add_vertex((mesh_.point(vh2) + mesh_.point(vh1)) / 2.0); + vh = mesh_.add_vertex((mesh_.point(vh2) + mesh_.point(vh1)) / static_cast(2.0) ); // Re-Set Handles heh2 = mesh_.opposite_halfedge_handle(_heh); diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/LoopT.hh b/src/OpenMesh/Tools/Subdivider/Uniform/LoopT.hh index 7dddf622..36535e94 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/LoopT.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/LoopT.hh @@ -326,7 +326,7 @@ private: // topological modifiers typename mesh_t::VertexHandle vh1(_m.to_vertex_handle(heh)); typename mesh_t::Point midP(_m.point(_m.to_vertex_handle(heh))); midP += _m.point(_m.to_vertex_handle(opp_heh)); - midP *= 0.5; + midP *= static_cast(0.5); // new vertex vh = _m.new_vertex( midP ); @@ -394,7 +394,7 @@ private: // geometry helper // boundary edge: just average vertex positions if (_m.is_boundary(_eh) ) { - pos *= 0.5; + pos *= static_cast(0.5); } else // inner edge: add neighbouring Vertices to sum { diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh b/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh index 734b8e0f..bc80453c 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh @@ -150,7 +150,7 @@ public: { weights[K].resize(K+1); // s(j) = ( 1/4 + cos(2*pi*j/K) + 1/2 * cos(4*pi*j/K) )/K - real_t invK = 1.0/real_t(K); + real_t invK = static_cast(1.0)/real_t(K); real_t sum = 0; for(unsigned int j=0; j(9.0/16.0); typename mesh_t::Point tpos; if(_m.is_boundary(heh)) { @@ -403,7 +403,7 @@ private: // geometry helper tpos = _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(opp_heh))); tpos += _m.point(_m.to_vertex_handle(_m.opposite_halfedge_handle(_m.prev_halfedge_handle(opp_heh)))); } - tpos *= -1.0/16; + tpos *= static_cast(-1.0/16.0); pos += tpos; } else @@ -506,7 +506,7 @@ private: // geometry helper } else //at least one endpoint is [irregular and not in boundary] { - double normFactor = 0.0; + typename mesh_t::Point::value_type normFactor = static_cast(0.0); if(valence_a_0!=6 && !_m.is_boundary(a_0)) { From e75a70774d2c2fea4a1e2ad9fd3d9ae1130d6f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 7 Nov 2016 14:30:14 +0100 Subject: [PATCH 02/10] Next bunch of warning fixes --- src/OpenMesh/Tools/Decimater/ModHausdorffT.cc | 2 +- .../Tools/Subdivider/Adaptive/Composite/RulesT.cc | 10 +++++----- src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc | 2 +- .../Tools/Subdivider/Uniform/Composite/CompositeT.cc | 6 +++--- src/OpenMesh/Tools/Subdivider/Uniform/LoopT.hh | 4 ++-- .../Tools/Subdivider/Uniform/ModifiedButterFlyT.hh | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/OpenMesh/Tools/Decimater/ModHausdorffT.cc b/src/OpenMesh/Tools/Decimater/ModHausdorffT.cc index 44dd1709..3701a461 100644 --- a/src/OpenMesh/Tools/Decimater/ModHausdorffT.cc +++ b/src/OpenMesh/Tools/Decimater/ModHausdorffT.cc @@ -89,7 +89,7 @@ distPointTriangleSquared( const Point& _p, if (d < FLT_MIN && d > -FLT_MIN) { return -1.0; } - const double invD = 1.0 / d; + const Scalar invD = static_cast(1.0) / d; // these are not needed for every point, should still perform // better with many points against one triangle diff --git a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc index 2ff22979..23364fc8 100644 --- a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc +++ b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc @@ -229,17 +229,17 @@ Tvv3::raise(typename M::FaceHandle& _fh, state_t _target_state) MOBJ(vh1).set_state(_target_state); MOBJ(vh1).set_not_final(); - MOBJ(vh0).set_position(_target_state, MOBJ(vh0).position(_target_state - 1) * 3.0); + MOBJ(vh0).set_position(_target_state, MOBJ(vh0).position(_target_state - 1) * static_cast(3.0)); MOBJ(vh0).set_state(_target_state); MOBJ(vh0).set_not_final(); // set display position and attributes for old vertices - Base::mesh_.set_point(vh2, (Base::mesh_.point(vh3) * 2.0 + Base::mesh_.point(vh0)) / 3.0); + Base::mesh_.set_point(vh2, (Base::mesh_.point(vh3) * static_cast(2.0) + Base::mesh_.point(vh0)) / static_cast(3.0) ); MOBJ(vh2).set_position(_target_state, zero_point); MOBJ(vh2).set_state(_target_state); MOBJ(vh2).set_not_final(); - MOBJ(vh3).set_position(_target_state, MOBJ(vh3).position(_target_state - 1) * 3.0); + MOBJ(vh3).set_position(_target_state, MOBJ(vh3).position(_target_state - 1) * static_cast(3.0) ); MOBJ(vh3).set_state(_target_state); MOBJ(vh3).set_not_final(); @@ -326,7 +326,7 @@ void Tvv3::raise(typename M::VertexHandle& _vh, state_t _target_state) { this->update(_vh, _target_state); // multiply old position by 3 - MOBJ(_vh).set_position(_target_state, MOBJ(_vh).position(_target_state - 1) * 3.0); + MOBJ(_vh).set_position(_target_state, MOBJ(_vh).position(_target_state - 1) * static_cast(3.0) ); MOBJ(_vh).inc_state(); @@ -2004,7 +2004,7 @@ EdEc::raise(typename M::EdgeHandle& _eh, state_t _target_state) // choose coefficient c c = Base::coeff(); - position *= (1.0 - c); + position *= (static_cast(1.0) - c); position += MOBJ(_eh).position(_target_state - 1) * c; diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc b/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc index ad2f4ab8..712ddb51 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc +++ b/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc @@ -346,7 +346,7 @@ CatmullClarkT::update_vertex( MeshType& _m, const VertexHandl for ( ve_itr = _m.ve_iter( _vh); ve_itr.is_valid(); ++ve_itr) if ( _m.is_boundary( *ve_itr)) pos += _m.property( ep_pos_, *ve_itr); - pos /= static_cast(3.0); + pos /= static_cast(3.0); } else // inner vertex { diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc b/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc index 947cda81..167c9895 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc +++ b/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc @@ -116,7 +116,7 @@ void CompositeT::Tvv3() // set new positions for vertices v_it = mesh_.vertices_begin(); for (j = 0; j < n_vertices; ++j) { - mesh_.data(*v_it).set_position(mesh_.data(*v_it).position() * static_cast(3.0) ); + mesh_.data(*v_it).set_position(mesh_.data(*v_it).position() * static_cast(3.0) ); ++v_it; } @@ -180,7 +180,7 @@ void CompositeT::Tvv4() // set new positions for vertices v_it = mesh_.vertices_begin(); for (j = 0; j < n_vertices; ++j) { - mesh_.data(*v_it).set_position(mesh_.data(*v_it).position() * static_cast(4.0) ); + mesh_.data(*v_it).set_position(mesh_.data(*v_it).position() * static_cast(4.0) ); ++v_it; } @@ -1250,7 +1250,7 @@ CompositeT::split_edge(HalfedgeHandle _heh) vh2(mesh_.from_vertex_handle(_heh)); // Calculate and Insert Midpoint of Edge - vh = mesh_.add_vertex((mesh_.point(vh2) + mesh_.point(vh1)) / static_cast(2.0) ); + vh = mesh_.add_vertex((mesh_.point(vh2) + mesh_.point(vh1)) / static_cast(2.0) ); // Re-Set Handles heh2 = mesh_.opposite_halfedge_handle(_heh); diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/LoopT.hh b/src/OpenMesh/Tools/Subdivider/Uniform/LoopT.hh index 36535e94..ea767d5a 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/LoopT.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/LoopT.hh @@ -326,7 +326,7 @@ private: // topological modifiers typename mesh_t::VertexHandle vh1(_m.to_vertex_handle(heh)); typename mesh_t::Point midP(_m.point(_m.to_vertex_handle(heh))); midP += _m.point(_m.to_vertex_handle(opp_heh)); - midP *= static_cast(0.5); + midP *= static_cast(0.5); // new vertex vh = _m.new_vertex( midP ); @@ -394,7 +394,7 @@ private: // geometry helper // boundary edge: just average vertex positions if (_m.is_boundary(_eh) ) { - pos *= static_cast(0.5); + pos *= static_cast(0.5); } else // inner edge: add neighbouring Vertices to sum { diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh b/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh index bc80453c..19f7812f 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh @@ -390,7 +390,7 @@ private: // geometry helper { pos = _m.point(a_0); pos += _m.point(a_1); - pos *= static_cast(9.0/16.0); + pos *= static_cast(9.0/16.0); typename mesh_t::Point tpos; if(_m.is_boundary(heh)) { @@ -403,7 +403,7 @@ private: // geometry helper tpos = _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(opp_heh))); tpos += _m.point(_m.to_vertex_handle(_m.opposite_halfedge_handle(_m.prev_halfedge_handle(opp_heh)))); } - tpos *= static_cast(-1.0/16.0); + tpos *= static_cast(-1.0/16.0); pos += tpos; } else From 7bcc3ec1a916c49e7472eccd5cc9e29812ef3379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 7 Nov 2016 14:31:54 +0100 Subject: [PATCH 03/10] Fixed typo --- src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc index 23364fc8..d9838b99 100644 --- a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc +++ b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc @@ -2004,7 +2004,7 @@ EdEc::raise(typename M::EdgeHandle& _eh, state_t _target_state) // choose coefficient c c = Base::coeff(); - position *= (static_cast(1.0) - c); + position *= ( static_cast(1.0) - c); position += MOBJ(_eh).position(_target_state - 1) * c; From d966d44a3f75276019168efbd669f420ebba3aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 7 Nov 2016 14:52:07 +0100 Subject: [PATCH 04/10] More fixes including Unit tests --- src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc | 2 +- ...rimesh_circulator_current_halfedge_handle_replacement.cc | 2 +- src/Unittests/unittests_trimesh_others.cc | 2 +- src/Unittests/unittests_tutorials.cc | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc index d9838b99..1213cab7 100644 --- a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc +++ b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc @@ -650,7 +650,7 @@ Tvv4::raise(typename M::VertexHandle& _vh, state_t _target_state) this->update(_vh, _target_state); // multiply old position by 4 - MOBJ(_vh).set_position(_target_state, MOBJ(_vh).position(_target_state - 1) * 4.0); + MOBJ(_vh).set_position(_target_state, MOBJ(_vh).position(_target_state - 1) * static_cast(4.0)); MOBJ(_vh).inc_state(); } diff --git a/src/Unittests/unittests_trimesh_circulator_current_halfedge_handle_replacement.cc b/src/Unittests/unittests_trimesh_circulator_current_halfedge_handle_replacement.cc index 53111e14..e3efb09c 100644 --- a/src/Unittests/unittests_trimesh_circulator_current_halfedge_handle_replacement.cc +++ b/src/Unittests/unittests_trimesh_circulator_current_halfedge_handle_replacement.cc @@ -328,7 +328,7 @@ TEST_F(OpenMeshTrimeshCirculatorCurrentHalfedgeHandleReplacement, vf_iter_bounda * \ / * 5 */ - size_t current_halfedge_handles[9] = { + int current_halfedge_handles[9] = { 0,2,12,4,6,8,16,10,14 }; std::vector fh0; diff --git a/src/Unittests/unittests_trimesh_others.cc b/src/Unittests/unittests_trimesh_others.cc index 14d96e37..4d125335 100644 --- a/src/Unittests/unittests_trimesh_others.cc +++ b/src/Unittests/unittests_trimesh_others.cc @@ -164,7 +164,7 @@ TEST_F(OpenMeshOthers, CalcDihedralAngre ) { EXPECT_EQ( 0.0 , mesh_.calc_dihedral_angle(eh) ) << "Wrong Dihedral angle!" << std::endl; // Modify point - Mesh::Point tmp = ( Mesh::Point(0.0, 0.0, -1.0) + Mesh::Point(1.0, 1.0, -1.0) ) * 0.5; + Mesh::Point tmp = ( Mesh::Point(0.0, 0.0, -1.0) + Mesh::Point(1.0, 1.0, -1.0) ) * static_cast(0.5); mesh_.point(vhandle[2]) = tmp; double difference = fabs( 1.36944 - mesh_.calc_dihedral_angle(eh) ); diff --git a/src/Unittests/unittests_tutorials.cc b/src/Unittests/unittests_tutorials.cc index 552fa614..b2daf890 100644 --- a/src/Unittests/unittests_tutorials.cc +++ b/src/Unittests/unittests_tutorials.cc @@ -57,7 +57,7 @@ struct MyData bool operator != (const MyData& _rhs) const { return !(*this == _rhs); } }; -typedef std::map< std::string, unsigned int > MyMap; +typedef std::map< std::string, size_t > MyMap; namespace OpenMesh { namespace IO { @@ -114,7 +114,7 @@ namespace OpenMesh { return sizeof(unsigned int); value_type::const_iterator it = _v.begin(); - unsigned int N = _v.size(); + size_t N = _v.size(); size_t bytes = IO::size_of(N); for(;it!=_v.end(); ++it) { @@ -128,7 +128,7 @@ namespace OpenMesh { size_t store(std::ostream& _os, const value_type& _v, bool _swap=false) { size_t bytes = 0; - unsigned int N = _v.size(); + size_t N = _v.size(); value_type::const_iterator it = _v.begin(); bytes += IO::store( _os, N, _swap ); for (; it != _v.end() && _os.good(); ++it) From 74ada2eac019a615829eb0f7a135786bd12b70c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 7 Nov 2016 15:02:07 +0100 Subject: [PATCH 05/10] Warning --- src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh b/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh index 19f7812f..425d56f6 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh @@ -150,14 +150,14 @@ public: { weights[K].resize(K+1); // s(j) = ( 1/4 + cos(2*pi*j/K) + 1/2 * cos(4*pi*j/K) )/K - real_t invK = static_cast(1.0)/real_t(K); + double invK = 1.0/static_cast(K); real_t sum = 0; for(unsigned int j=0; j((0.25 + cos(2.0*M_PI*static_cast(j)*invK) + 0.5*cos(4.0*M_PI*static_cast(j)*invK))*invK); sum += weights[K][j]; } - weights[K][K] = (real_t)1.0 - sum; + weights[K][K] = static_cast(1.0) - sum; } } From 79ce71f2d311f588ee51b6afa33d28ec9f404352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 7 Nov 2016 15:07:19 +0100 Subject: [PATCH 06/10] Another fix --- .../Uniform/Sqrt3InterpolatingSubdividerLabsikGreinerT.hh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3InterpolatingSubdividerLabsikGreinerT.hh b/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3InterpolatingSubdividerLabsikGreinerT.hh index 9ab84428..4266aa81 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3InterpolatingSubdividerLabsikGreinerT.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3InterpolatingSubdividerLabsikGreinerT.hh @@ -158,11 +158,13 @@ public: for(unsigned int K=5; K<_max_valence; ++K) { weights_[K].resize(K+1); - real_t aH = 2.0*cos(M_PI/K)/3.0; - weights_[K][K] = 1.0 - aH*aH; + double aH = 2.0*cos(M_PI/static_cast(K))/3.0; + weights_[K][K] = static_cast(1.0 - aH*aH); for(unsigned int i=0; i((aH*aH + 2.0*aH*cos(2.0*static_cast(i)*M_PI/static_cast(K) + M_PI/static_cast(K)) + + 2.0*aH*aH*cos(4.0*static_cast(i)*M_PI/static_cast(K) + 2.0*M_PI/static_cast(K)))/static_cast(K)); } } From 7175cd8c6d8faae99735971e6c1eb9e3d9f82959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 7 Nov 2016 15:10:23 +0100 Subject: [PATCH 07/10] Several warnings --- .../Tools/Subdivider/Uniform/Composite/CompositeT.cc | 2 +- src/Unittests/unittests_tutorials.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc b/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc index 167c9895..72d7bcbe 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc +++ b/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc @@ -589,7 +589,7 @@ void CompositeT::FVc(Coeff& _coeff) if (mesh_.face_handle(mesh_.opposite_halfedge_handle(mesh_.next_halfedge_handle(*voh_it))).is_valid()) { cog += mesh_.data(mesh_.face_handle(*voh_it)).position() * c; - cog += mesh_.data(mesh_.face_handle(mesh_.opposite_halfedge_handle(mesh_.next_halfedge_handle(*voh_it)))).position() * (1.0 - c); + cog += mesh_.data(mesh_.face_handle(mesh_.opposite_halfedge_handle(mesh_.next_halfedge_handle(*voh_it)))).position() * (static_cast(1.0) - c); } else { cog += mesh_.data(mesh_.face_handle(*voh_it)).position(); } diff --git a/src/Unittests/unittests_tutorials.cc b/src/Unittests/unittests_tutorials.cc index b2daf890..552fa614 100644 --- a/src/Unittests/unittests_tutorials.cc +++ b/src/Unittests/unittests_tutorials.cc @@ -57,7 +57,7 @@ struct MyData bool operator != (const MyData& _rhs) const { return !(*this == _rhs); } }; -typedef std::map< std::string, size_t > MyMap; +typedef std::map< std::string, unsigned int > MyMap; namespace OpenMesh { namespace IO { @@ -114,7 +114,7 @@ namespace OpenMesh { return sizeof(unsigned int); value_type::const_iterator it = _v.begin(); - size_t N = _v.size(); + unsigned int N = _v.size(); size_t bytes = IO::size_of(N); for(;it!=_v.end(); ++it) { @@ -128,7 +128,7 @@ namespace OpenMesh { size_t store(std::ostream& _os, const value_type& _v, bool _swap=false) { size_t bytes = 0; - size_t N = _v.size(); + unsigned int N = _v.size(); value_type::const_iterator it = _v.begin(); bytes += IO::store( _os, N, _swap ); for (; it != _v.end() && _os.good(); ++it) From c1ad9f418c88aa4811f59c58a4dc34bb343f01db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 7 Nov 2016 15:23:49 +0100 Subject: [PATCH 08/10] Some casts --- src/OpenMesh/Tools/Decimater/ModEdgeLengthT.cc | 2 +- src/OpenMesh/Tools/Decimater/ModEdgeLengthT.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenMesh/Tools/Decimater/ModEdgeLengthT.cc b/src/OpenMesh/Tools/Decimater/ModEdgeLengthT.cc index 0e6bf61a..bfd45e52 100644 --- a/src/OpenMesh/Tools/Decimater/ModEdgeLengthT.cc +++ b/src/OpenMesh/Tools/Decimater/ModEdgeLengthT.cc @@ -91,7 +91,7 @@ void ModEdgeLengthT::set_error_tolerance_factor(double _factor) { // the smaller the factor, the smaller edge_length_ gets // thus creating a stricter constraint // division by error_tolerance_factor_ is for normalization - float edge_length = edge_length_ * _factor / this->error_tolerance_factor_; + typename Mesh::Scalar edge_length = edge_length_ * static_cast(_factor / this->error_tolerance_factor_); set_edge_length(edge_length); this->error_tolerance_factor_ = _factor; } diff --git a/src/OpenMesh/Tools/Decimater/ModEdgeLengthT.hh b/src/OpenMesh/Tools/Decimater/ModEdgeLengthT.hh index 6be2315d..f50878d3 100644 --- a/src/OpenMesh/Tools/Decimater/ModEdgeLengthT.hh +++ b/src/OpenMesh/Tools/Decimater/ModEdgeLengthT.hh @@ -94,7 +94,7 @@ class ModEdgeLengthT: public ModBaseT { } /// set edge_length - void set_edge_length(float _f) { + void set_edge_length(typename Mesh::Scalar _f) { edge_length_ = _f; sqr_edge_length_ = _f * _f; } From dd91155f2c260b7d40b2797d2596bb531e339d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 7 Nov 2016 15:33:20 +0100 Subject: [PATCH 09/10] Another cast --- src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc b/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc index 72d7bcbe..621d3b9c 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc +++ b/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc @@ -581,7 +581,7 @@ void CompositeT::FVc(Coeff& _coeff) ++valence; } - c = _coeff(valence); + c = static_cast(_coeff(valence)); for (voh_it = mesh_.voh_iter(*v_it); voh_it.is_valid(); ++voh_it) { From 8e81de4045682c642b7e9e582390952dd68ff827 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 7 Nov 2016 20:31:30 +0100 Subject: [PATCH 10/10] Fixed error with VS2013 --- src/Unittests/unittests_trimesh_others.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Unittests/unittests_trimesh_others.cc b/src/Unittests/unittests_trimesh_others.cc index 4d125335..a9aaebd1 100644 --- a/src/Unittests/unittests_trimesh_others.cc +++ b/src/Unittests/unittests_trimesh_others.cc @@ -164,7 +164,7 @@ TEST_F(OpenMeshOthers, CalcDihedralAngre ) { EXPECT_EQ( 0.0 , mesh_.calc_dihedral_angle(eh) ) << "Wrong Dihedral angle!" << std::endl; // Modify point - Mesh::Point tmp = ( Mesh::Point(0.0, 0.0, -1.0) + Mesh::Point(1.0, 1.0, -1.0) ) * static_cast(0.5); + Mesh::Point tmp = ( Mesh::Point(0.0, 0.0, -1.0) + Mesh::Point(1.0, 1.0, -1.0) ) * static_cast(0.5); mesh_.point(vhandle[2]) = tmp; double difference = fabs( 1.36944 - mesh_.calc_dihedral_angle(eh) );