diff --git a/src/OpenMesh/Core/Mesh/PolyMeshT.cc b/src/OpenMesh/Core/Mesh/PolyMeshT.cc index d6092139f6f4bc92f220be53193db3225e9f4d6b..72cb7d78767978cd59710f1c27f051c3bb9c727a 100644 --- a/src/OpenMesh/Core/Mesh/PolyMeshT.cc +++ b/src/OpenMesh/Core/Mesh/PolyMeshT.cc @@ -164,10 +164,11 @@ calc_face_normal(const Point& _p0, //----------------------------------------------------------------------------- template -void +typename PolyMeshT::Point PolyMeshT:: -calc_face_centroid(FaceHandle _fh, Point& _pt) const +calc_face_centroid(FaceHandle _fh) const { + Point _pt; _pt.vectorize(0); Scalar valence = 0.0; for (ConstFaceVertexIter cfv_it = this->cfv_iter(_fh); cfv_it.is_valid(); ++cfv_it, valence += 1.0) @@ -175,6 +176,7 @@ calc_face_centroid(FaceHandle _fh, Point& _pt) const _pt += this->point(*cfv_it); } _pt /= valence; + return _pt; } //----------------------------------------------------------------------------- diff --git a/src/OpenMesh/Core/Mesh/PolyMeshT.hh b/src/OpenMesh/Core/Mesh/PolyMeshT.hh index 0f6d1f02db41f28f42703007fa51b9c4ea19a063..d053d91d96b4eb75c42f875d40748eae029ce490 100644 --- a/src/OpenMesh/Core/Mesh/PolyMeshT.hh +++ b/src/OpenMesh/Core/Mesh/PolyMeshT.hh @@ -232,7 +232,12 @@ public: Normal calc_face_normal(const Point& _p0, const Point& _p1, const Point& _p2) const; /// calculates the average of the vertices defining _fh - void calc_face_centroid(FaceHandle _fh, Point& _pt) const; + void calc_face_centroid(FaceHandle _fh, Point& _pt) const { + _pt = calc_face_centroid(_fh); + } + + /// Computes and returns the average of the vertices defining _gh + Point calc_face_centroid(FaceHandle _fh) const; /// Update normal for halfedge _heh void update_normal(HalfedgeHandle _heh, const double _feature_angle = 0.8)