diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp index 759f3bb38219c6c10594e8a98a0fa61a23e5cef9..1faf020b00a03571c8574b02213adc81a24d52ca 100644 --- a/Geo/MElement.cpp +++ b/Geo/MElement.cpp @@ -192,10 +192,10 @@ SPoint3 MElement::barycenter_infty () const return SPoint3(0.5*(xmin+xmax),0.5*(ymin+ymax),0.5*(zmin+zmax)); } -SPoint3 MElement::barycenter() const +SPoint3 MElement::barycenter(bool primary) const { SPoint3 p(0., 0., 0.); - int n = getNumVertices(); + int n = primary ? getNumPrimaryVertices() : getNumVertices(); for(int i = 0; i < n; i++) { const MVertex *v = getVertex(i); p[0] += v->x(); diff --git a/Geo/MElement.h b/Geo/MElement.h index 328c3adf612e6d6ad558cfcaff327f680c72f209..9b7bfb9f9df40c81787751320bbb126e2c9d5e53 100644 --- a/Geo/MElement.h +++ b/Geo/MElement.h @@ -201,7 +201,7 @@ class MElement virtual double getOuterRadius(){ return 0.; } // compute the barycenter - virtual SPoint3 barycenter() const; + virtual SPoint3 barycenter(bool primary = false) const; virtual SPoint3 barycenterUVW() const; // compute the barycenter in infinity norm virtual SPoint3 barycenter_infty() const;