Fixed last occurences of non-free-function usage (at least as far as covered by the tests).

This commit is contained in:
Christian Mattes
2018-04-12 15:16:50 +02:00
parent 57e2e07432
commit 377562d11a
7 changed files with 26 additions and 14 deletions

View File

@@ -745,6 +745,19 @@ VectorT<Scalar, DIM>& normalize(VectorT<Scalar, DIM>& _v) {
return _v.normalize(); return _v.normalize();
} }
/// \relates OpenMesh::VectorT
/// non-member maximize
template<typename Scalar, int DIM>
VectorT<Scalar, DIM>& maximize(VectorT<Scalar, DIM>& _v1, VectorT<Scalar, DIM>& _v2) {
return _v1.maximize(_v2);
}
/// \relates OpenMesh::VectorT
/// non-member minimize
template<typename Scalar, int DIM>
VectorT<Scalar, DIM>& minimize(VectorT<Scalar, DIM>& _v1, VectorT<Scalar, DIM>& _v2) {
return _v1.minimize(_v2);
}
//== TYPEDEFS ================================================================= //== TYPEDEFS =================================================================

View File

@@ -139,9 +139,9 @@ PolyMeshT<Kernel>::calc_face_normal_impl(FaceHandle _fh, PointIs3DTag) const
// Due to traits, the value types of normals and points can be different. // Due to traits, the value types of normals and points can be different.
// Therefore we cast them here. // Therefore we cast them here.
n[0] += static_cast<typename Normal::value_type>(a[1] * b[2]); n[0] += static_cast<typename vector_traits<Normal>::value_type>(a[1] * b[2]);
n[1] += static_cast<typename Normal::value_type>(a[2] * b[0]); n[1] += static_cast<typename vector_traits<Normal>::value_type>(a[2] * b[0]);
n[2] += static_cast<typename Normal::value_type>(a[0] * b[1]); n[2] += static_cast<typename vector_traits<Normal>::value_type>(a[0] * b[1]);
} }
const typename vector_traits<Normal>::value_type length = norm(n); const typename vector_traits<Normal>::value_type length = norm(n);
@@ -228,7 +228,7 @@ PolyMeshT<Kernel>::
calc_face_centroid(FaceHandle _fh) const calc_face_centroid(FaceHandle _fh) const
{ {
Point _pt; Point _pt;
_pt.vectorize(0); vectorize(_pt, 0);
Scalar valence = 0.0; Scalar valence = 0.0;
for (ConstFaceVertexIter cfv_it = this->cfv_iter(_fh); cfv_it.is_valid(); ++cfv_it, valence += 1.0) for (ConstFaceVertexIter cfv_it = this->cfv_iter(_fh); cfv_it.is_valid(); ++cfv_it, valence += 1.0)
{ {
@@ -401,7 +401,7 @@ template <class Kernel>
void PolyMeshT<Kernel>:: void PolyMeshT<Kernel>::
calc_vertex_normal_correct(VertexHandle _vh, Normal& _n) const calc_vertex_normal_correct(VertexHandle _vh, Normal& _n) const
{ {
_n.vectorize(0.0); vectorize(_n, 0.0);
ConstVertexIHalfedgeIter cvih_it = this->cvih_iter(_vh); ConstVertexIHalfedgeIter cvih_it = this->cvih_iter(_vh);
if (! cvih_it.is_valid() ) if (! cvih_it.is_valid() )
{//don't crash on isolated vertices {//don't crash on isolated vertices

View File

@@ -359,9 +359,9 @@ public:
VertexHandle p2 = this->to_vertex_handle(he2); VertexHandle p2 = this->to_vertex_handle(he2);
// Calculate midpoint coordinates // Calculate midpoint coordinates
const Point new0 = (this->point(p0) + this->point(p2)) * static_cast< typename Point::value_type >(0.5); const Point new0 = (this->point(p0) + this->point(p2)) * static_cast<typename vector_traits<Point>::value_type >(0.5);
const Point new1 = (this->point(p0) + this->point(p1)) * static_cast< typename Point::value_type >(0.5); const Point new1 = (this->point(p0) + this->point(p1)) * static_cast<typename vector_traits<Point>::value_type >(0.5);
const Point new2 = (this->point(p1) + this->point(p2)) * static_cast< typename Point::value_type >(0.5); const Point new2 = (this->point(p1) + this->point(p2)) * static_cast<typename vector_traits<Point>::value_type >(0.5);
// Add vertices at midpoint coordinates // Add vertices at midpoint coordinates
VertexHandle v0 = this->add_vertex(new0); VertexHandle v0 = this->add_vertex(new0);

View File

@@ -95,7 +95,6 @@ inline void vector_cast( const src_t & /*_src*/, dst_t & /*_dst*/, GenProg::Int2
{ {
} }
template <typename src_t, typename dst_t, int n> template <typename src_t, typename dst_t, int n>
inline void vector_copy( const src_t &_src, dst_t &_dst, GenProg::Int2Type<n> ) inline void vector_copy( const src_t &_src, dst_t &_dst, GenProg::Int2Type<n> )
{ {

View File

@@ -181,7 +181,7 @@ compute_new_positions_C1()
if (diag) uu *= static_cast<typename Mesh::Scalar>(1.0) / diag; if (diag) uu *= static_cast<typename Mesh::Scalar>(1.0) / diag;
// damping // damping
uu *= static_cast<typename Mesh::Normal::value_type>(0.25); uu *= static_cast<typename vector_traits<typename Mesh::Normal>::value_type>(0.25);
// store new position // store new position
p = vector_cast<typename Mesh::Normal>(Base::mesh_.point(*v_it)); p = vector_cast<typename Mesh::Normal>(Base::mesh_.point(*v_it));

View File

@@ -263,13 +263,13 @@ set_relative_local_error(Scalar _err)
bb_min = bb_max = mesh_.point(*v_it); bb_min = bb_max = mesh_.point(*v_it);
for (++v_it; v_it!=v_end; ++v_it) for (++v_it; v_it!=v_end; ++v_it)
{ {
bb_min.minimize(mesh_.point(*v_it)); minimize(bb_min, mesh_.point(*v_it));
bb_max.maximize(mesh_.point(*v_it)); maximize(bb_max, mesh_.point(*v_it));
} }
// abs. error = rel. error * bounding-diagonal // 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)));
} }
} }

View File

@@ -346,7 +346,7 @@ CatmullClarkT<MeshType,RealType>::update_vertex( MeshType& _m, const VertexHandl
for ( ve_itr = _m.ve_iter( _vh); ve_itr.is_valid(); ++ve_itr) for ( ve_itr = _m.ve_iter( _vh); ve_itr.is_valid(); ++ve_itr)
if ( _m.is_boundary( *ve_itr)) if ( _m.is_boundary( *ve_itr))
pos += _m.property( ep_pos_, *ve_itr); pos += _m.property( ep_pos_, *ve_itr);
pos /= static_cast<typename MeshType::Point::value_type>(3.0); pos /= static_cast<typename vector_traits<typename MeshType::Point>::value_type>(3.0);
} }
else // inner vertex else // inner vertex
{ {