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; } 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..1213cab7 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(); @@ -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(); } @@ -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 ec7a9682..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 /= 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..621d3b9c 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; } @@ -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) { @@ -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(); } @@ -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..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 *= 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..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 = 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; } } @@ -390,7 +390,7 @@ private: // geometry helper { pos = _m.point(a_0); pos += _m.point(a_1); - pos *= 9.0/16; + 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 *= -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)) { 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)); } } 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..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) ) * 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) );