diff --git a/src/OpenMesh/Tools/Decimater/ModAspectRatioT_impl.hh b/src/OpenMesh/Tools/Decimater/ModAspectRatioT_impl.hh index 0546d540..b18761ff 100644 --- a/src/OpenMesh/Tools/Decimater/ModAspectRatioT_impl.hh +++ b/src/OpenMesh/Tools/Decimater/ModAspectRatioT_impl.hh @@ -68,16 +68,16 @@ typename ModAspectRatioT::Scalar ModAspectRatioT::aspectRatio( Point d1 = _v1 - _v2; // finds the max squared edge length - Scalar l2, maxl2 = d0.sqrnorm(); - if ((l2 = d1.sqrnorm()) > maxl2) + Scalar l2, maxl2 = sqrnorm(d0); + if ((l2 = sqrnorm(d1)) > maxl2) maxl2 = l2; // keep searching for the max squared edge length d1 = _v2 - _v0; - if ((l2 = d1.sqrnorm()) > maxl2) + if ((l2 = sqrnorm(d1)) > maxl2) maxl2 = l2; // squared area of the parallelogram spanned by d0 and d1 - Scalar a2 = (d0 % d1).sqrnorm(); + Scalar a2 = sqrnorm(d0 % d1); // the area of the triangle would be // sqrt(a2)/2 or length * height / 2 diff --git a/src/OpenMesh/Tools/Decimater/ModHausdorffT_impl.hh b/src/OpenMesh/Tools/Decimater/ModHausdorffT_impl.hh index 1fd30e01..fc12d1b6 100644 --- a/src/OpenMesh/Tools/Decimater/ModHausdorffT_impl.hh +++ b/src/OpenMesh/Tools/Decimater/ModHausdorffT_impl.hh @@ -76,7 +76,7 @@ distPointTriangleSquared( const Point& _p, const Point v0v1 = _v1 - _v0; const Point v0v2 = _v2 - _v0; const Point n = v0v1 % v0v2; // not normalized ! - const Scalar d = n.sqrnorm(); + const Scalar d = sqrnorm(n); // Check if the triangle is degenerated @@ -88,9 +88,9 @@ 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 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(); + const Scalar inv_v0v2_2 = static_cast(1.0) / sqrnorm(v0v2); + const Scalar inv_v0v1_2 = static_cast(1.0) / sqrnorm(v0v1); + const Scalar inv_v1v2_2 = static_cast(1.0) / sqrnorm(v1v2); Point v0p = _p - _v0; @@ -177,10 +177,10 @@ distPointTriangleSquared( const Point& _p, } } else { // Calculate the distance to an interior point of the triangle - return ( (_p - n*((n|v0p) * invD)) - _p).sqrnorm(); + return sqrnorm( (_p - n*((n|v0p) * invD)) - _p); } - return (v0p - _p).sqrnorm(); + return sqrnorm(v0p - _p); } diff --git a/src/OpenMesh/Tools/Decimater/ModRoundnessT.hh b/src/OpenMesh/Tools/Decimater/ModRoundnessT.hh index fe58d10c..568083a9 100644 --- a/src/OpenMesh/Tools/Decimater/ModRoundnessT.hh +++ b/src/OpenMesh/Tools/Decimater/ModRoundnessT.hh @@ -287,10 +287,10 @@ public: // specific methods Vec3f vecAB = B-A; // compute squared values to avoid sqrt-computations - value_type aa = (B-C).sqrnorm(); - value_type bb = vecAC.sqrnorm(); - value_type cc = vecAB.sqrnorm(); - value_type AA = cross(vecAC,vecAB).sqrnorm(); // without factor 1/4 **) + value_type aa = sqrnorm(B-C); + value_type bb = sqrnorm(vecAC); + value_type cc = sqrnorm(vecAB); + value_type AA = sqrnorm(cross(vecAC,vecAB)); // without factor 1/4 **) if ( AA < epsilon ) return 0.0; diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/LongestEdgeT.hh b/src/OpenMesh/Tools/Subdivider/Uniform/LongestEdgeT.hh index 2da6d333..d6358ee6 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/LongestEdgeT.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/LongestEdgeT.hh @@ -160,7 +160,7 @@ protected: const typename MeshType::Point to = _m.point(_m.to_vertex_handle(_m.halfedge_handle(*eit,0))); const typename MeshType::Point from = _m.point(_m.from_vertex_handle(_m.halfedge_handle(*eit,0))); - real_t length = (to - from).sqrnorm(); + real_t length = sqrnorm(to - from); // Only push the edges that need to be split if ( length > max_edge_length_squared_ ) @@ -187,7 +187,7 @@ protected: typename MeshType::EdgeHandle eh = _m.edge_handle(*voh_it); const typename MeshType::Point to = _m.point(_m.to_vertex_handle(*voh_it)); const typename MeshType::Point from = _m.point(_m.from_vertex_handle(*voh_it)); - real_t length = (to - from).sqrnorm(); + real_t length = sqrnorm(to - from); // Only push the edges that need to be split if ( length > max_edge_length_squared_ )