diff --git a/src/OpenMesh/Core/Geometry/Vector11T.hh b/src/OpenMesh/Core/Geometry/Vector11T.hh index c820008d..b9113a6a 100644 --- a/src/OpenMesh/Core/Geometry/Vector11T.hh +++ b/src/OpenMesh/Core/Geometry/Vector11T.hh @@ -745,6 +745,19 @@ VectorT& normalize(VectorT& _v) { return _v.normalize(); } +/// \relates OpenMesh::VectorT +/// non-member maximize +template +VectorT& maximize(VectorT& _v1, VectorT& _v2) { + return _v1.maximize(_v2); +} + +/// \relates OpenMesh::VectorT +/// non-member minimize +template +VectorT& minimize(VectorT& _v1, VectorT& _v2) { + return _v1.minimize(_v2); +} //== TYPEDEFS ================================================================= diff --git a/src/OpenMesh/Core/Mesh/PolyMeshT.cc b/src/OpenMesh/Core/Mesh/PolyMeshT.cc index bb88a68b..64fc9914 100644 --- a/src/OpenMesh/Core/Mesh/PolyMeshT.cc +++ b/src/OpenMesh/Core/Mesh/PolyMeshT.cc @@ -139,9 +139,9 @@ PolyMeshT::calc_face_normal_impl(FaceHandle _fh, PointIs3DTag) const // Due to traits, the value types of normals and points can be different. // Therefore we cast them here. - n[0] += static_cast(a[1] * b[2]); - n[1] += static_cast(a[2] * b[0]); - n[2] += static_cast(a[0] * b[1]); + n[0] += static_cast::value_type>(a[1] * b[2]); + n[1] += static_cast::value_type>(a[2] * b[0]); + n[2] += static_cast::value_type>(a[0] * b[1]); } const typename vector_traits::value_type length = norm(n); @@ -228,7 +228,7 @@ PolyMeshT:: calc_face_centroid(FaceHandle _fh) const { Point _pt; - _pt.vectorize(0); + vectorize(_pt, 0); Scalar valence = 0.0; for (ConstFaceVertexIter cfv_it = this->cfv_iter(_fh); cfv_it.is_valid(); ++cfv_it, valence += 1.0) { @@ -401,7 +401,7 @@ template void PolyMeshT:: calc_vertex_normal_correct(VertexHandle _vh, Normal& _n) const { - _n.vectorize(0.0); + vectorize(_n, 0.0); ConstVertexIHalfedgeIter cvih_it = this->cvih_iter(_vh); if (! cvih_it.is_valid() ) {//don't crash on isolated vertices diff --git a/src/OpenMesh/Core/Mesh/TriMeshT.hh b/src/OpenMesh/Core/Mesh/TriMeshT.hh index 6ff32f3c..1865f30c 100644 --- a/src/OpenMesh/Core/Mesh/TriMeshT.hh +++ b/src/OpenMesh/Core/Mesh/TriMeshT.hh @@ -359,9 +359,9 @@ public: VertexHandle p2 = this->to_vertex_handle(he2); // Calculate midpoint coordinates - const Point new0 = (this->point(p0) + this->point(p2)) * static_cast< typename Point::value_type >(0.5); - const Point new1 = (this->point(p0) + this->point(p1)) * static_cast< typename Point::value_type >(0.5); - const Point new2 = (this->point(p1) + this->point(p2)) * static_cast< typename Point::value_type >(0.5); + const Point new0 = (this->point(p0) + this->point(p2)) * static_cast::value_type >(0.5); + const Point new1 = (this->point(p0) + this->point(p1)) * static_cast::value_type >(0.5); + const Point new2 = (this->point(p1) + this->point(p2)) * static_cast::value_type >(0.5); // Add vertices at midpoint coordinates VertexHandle v0 = this->add_vertex(new0); diff --git a/src/OpenMesh/Core/Utils/vector_cast.hh b/src/OpenMesh/Core/Utils/vector_cast.hh index 94f991a5..39fca197 100644 --- a/src/OpenMesh/Core/Utils/vector_cast.hh +++ b/src/OpenMesh/Core/Utils/vector_cast.hh @@ -95,7 +95,6 @@ inline void vector_cast( const src_t & /*_src*/, dst_t & /*_dst*/, GenProg::Int2 { } - template inline void vector_copy( const src_t &_src, dst_t &_dst, GenProg::Int2Type ) { diff --git a/src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.cc b/src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.cc index 62fa98c1..f038006f 100644 --- a/src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.cc +++ b/src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.cc @@ -181,7 +181,7 @@ compute_new_positions_C1() if (diag) uu *= static_cast(1.0) / diag; // damping - uu *= static_cast(0.25); + uu *= static_cast::value_type>(0.25); // store new position p = vector_cast(Base::mesh_.point(*v_it)); diff --git a/src/OpenMesh/Tools/Smoother/SmootherT.cc b/src/OpenMesh/Tools/Smoother/SmootherT.cc index 2bb44bd0..c727aeba 100644 --- a/src/OpenMesh/Tools/Smoother/SmootherT.cc +++ b/src/OpenMesh/Tools/Smoother/SmootherT.cc @@ -263,13 +263,13 @@ set_relative_local_error(Scalar _err) bb_min = bb_max = mesh_.point(*v_it); for (++v_it; v_it!=v_end; ++v_it) { - bb_min.minimize(mesh_.point(*v_it)); - bb_max.maximize(mesh_.point(*v_it)); + minimize(bb_min, mesh_.point(*v_it)); + maximize(bb_max, mesh_.point(*v_it)); } // abs. error = rel. error * bounding-diagonal - set_absolute_local_error(_err * (bb_max-bb_min).norm()); + set_absolute_local_error(norm(_err * (bb_max-bb_min))); } } diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc b/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc index 712ddb51..1813c2fe 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::value_type>(3.0); } else // inner vertex {