From a7e9657759dcc6f5d942ef0ae6e83bc3a94420eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 17 Jan 2019 08:08:09 +0100 Subject: [PATCH] Use vectorize for initializing vector in dummy implementations closes #59 --- src/OpenMesh/Core/Geometry/EigenVectorT.hh | 3 +-- src/OpenMesh/Core/Mesh/PolyMeshT.cc | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/OpenMesh/Core/Geometry/EigenVectorT.hh b/src/OpenMesh/Core/Geometry/EigenVectorT.hh index 237ef906..65fd4d08 100644 --- a/src/OpenMesh/Core/Geometry/EigenVectorT.hh +++ b/src/OpenMesh/Core/Geometry/EigenVectorT.hh @@ -89,9 +89,7 @@ namespace Eigen { template MatrixBase normalize(MatrixBase &x) { - std::cerr << "Norm : " << x.norm() << std::endl; x /= x.norm(); - std::cerr << "Norm : " << x << std::endl; return x; } @@ -99,6 +97,7 @@ namespace Eigen { MatrixBase &vectorize(MatrixBase &x, typename Derived::Scalar const &val) { x.fill(val); + std::cerr << "Vec" << std::endl; return x; } diff --git a/src/OpenMesh/Core/Mesh/PolyMeshT.cc b/src/OpenMesh/Core/Mesh/PolyMeshT.cc index 689a2c20..78e6b004 100644 --- a/src/OpenMesh/Core/Mesh/PolyMeshT.cc +++ b/src/OpenMesh/Core/Mesh/PolyMeshT.cc @@ -154,7 +154,15 @@ typename PolyMeshT::Normal PolyMeshT::calc_face_normal_impl(FaceHandle, PointIsNot3DTag) const { // Dummy fallback implementation - return Normal(typename Normal::value_type(0)); + // Returns just an initialized all 0 normal + // This function is only used if we don't hate a matching implementation + // for normal computation with the current vector type defined in the mesh traits + + assert(false); + + Normal normal; + vectorize(normal,0); + return normal; } //----------------------------------------------------------------------------- @@ -212,7 +220,17 @@ template typename PolyMeshT::Normal PolyMeshT::calc_face_normal_impl(const Point&, const Point&, const Point&, PointIsNot3DTag) const { - return Normal(typename Normal::value_type(0)); + + // Dummy fallback implementation + // Returns just an initialized all 0 normal + // This function is only used if we don't hate a matching implementation + // for normal computation with the current vector type defined in the mesh traits + + assert(false); + + Normal normal; + vectorize(normal,0); + return normal; } //-----------------------------------------------------------------------------