From 08160c1584e5721034a207c54e00eb1fe76efad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 28 Oct 2016 08:59:36 +0200 Subject: [PATCH] More warning fixes --- src/OpenMesh/Tools/Decimater/ModHausdorffT.cc | 12 ++++++------ .../Tools/Subdivider/Adaptive/Composite/RulesT.cc | 2 +- .../Tools/Subdivider/Uniform/Composite/CompositeT.cc | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/OpenMesh/Tools/Decimater/ModHausdorffT.cc b/src/OpenMesh/Tools/Decimater/ModHausdorffT.cc index e4dff018..44dd1709 100644 --- a/src/OpenMesh/Tools/Decimater/ModHausdorffT.cc +++ b/src/OpenMesh/Tools/Decimater/ModHausdorffT.cc @@ -82,7 +82,7 @@ distPointTriangleSquared( const Point& _p, const Point v0v1 = _v1 - _v0; const Point v0v2 = _v2 - _v0; const Point n = v0v1 % v0v2; // not normalized ! - const double d = n.sqrnorm(); + const Scalar d = n.sqrnorm(); // Check if the triangle is degenerated @@ -94,16 +94,16 @@ distPointTriangleSquared( const Point& _p, // these are not needed for every point, should still perform // better with many points against one triangle const Point v1v2 = _v2 - _v1; - const double inv_v0v2_2 = 1.0 / v0v2.sqrnorm(); - const double inv_v0v1_2 = 1.0 / v0v1.sqrnorm(); - const double inv_v1v2_2 = 1.0 / v1v2.sqrnorm(); + const Scalar inv_v0v2_2 = static_cast(1.0) / v0v2.sqrnorm(); + const Scalar inv_v0v1_2 = static_cast(1.0) / v0v1.sqrnorm(); + const Scalar inv_v1v2_2 = static_cast(1.0) / v1v2.sqrnorm(); Point v0p = _p - _v0; Point t = v0p % n; typename Point::value_type s01, s02, s12; - const double a = (t | v0v2) * -invD; - const double b = (t | v0v1) * invD; + const Scalar a = (t | v0v2) * -invD; + const Scalar b = (t | v0v1) * invD; if (a < 0) { diff --git a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc index ba335f6f..fdfa0765 100644 --- a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc +++ b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc @@ -992,7 +992,7 @@ void FFc::raise(typename M::FaceHandle& _fh, state_t _target_state) // choose coefficient c typename M::Scalar c = Base::coeff(); - position *= (1.0 - c); + position *= (static_cast(1.0) - c); position += MOBJ(_fh).position(_target_state - 1) * c; MOBJ(_fh).set_position(_target_state, position); diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc b/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc index 3a0e4e60..2258cf6e 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc +++ b/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc @@ -882,7 +882,8 @@ void CompositeT::EVc(Coeff& _coeff) ++valence; } - c = _coeff(valence); + // Coefficients always work on double so we cast them to the correct scalar here + c = static_cast(_coeff(valence)); for (voh_it = mesh_.voh_iter(*v_it); voh_it.is_valid(); ++voh_it) { cog += mesh_.data(mesh_.edge_handle(*voh_it)).position() * c;