corrected computation of Barycenter
This commit is contained in:
parent
95b2d87cc3
commit
c704229b67
|
@ -20,6 +20,7 @@ template <class MESH> class BallPivoting: public AdvancingFront<MESH> {
|
||||||
typedef typename MESH::VertexType VertexType;
|
typedef typename MESH::VertexType VertexType;
|
||||||
typedef typename MESH::FaceType FaceType;
|
typedef typename MESH::FaceType FaceType;
|
||||||
typedef typename MESH::ScalarType ScalarType;
|
typedef typename MESH::ScalarType ScalarType;
|
||||||
|
typedef typename MESH::VertexIterator VertexIterator;
|
||||||
typedef typename MESH::VertexType::CoordType Point3x;
|
typedef typename MESH::VertexType::CoordType Point3x;
|
||||||
typedef GridStaticPtr<typename MESH::VertexType, typename MESH::ScalarType > StaticGrid;
|
typedef GridStaticPtr<typename MESH::VertexType, typename MESH::ScalarType > StaticGrid;
|
||||||
|
|
||||||
|
@ -39,16 +40,13 @@ template <class MESH> class BallPivoting: public AdvancingFront<MESH> {
|
||||||
|
|
||||||
//compute bbox
|
//compute bbox
|
||||||
baricenter = Point3x(0, 0, 0);
|
baricenter = Point3x(0, 0, 0);
|
||||||
int count = 0;
|
UpdateBounding<MESH>::Box(_mesh);
|
||||||
this->mesh.bbox = Box3<ScalarType>();
|
for(VertexIterator vi=this->mesh.vert.begin();vi!=this->mesh.vert.end();++vi)
|
||||||
for(int i = 0; i < (int)this->mesh.vert.size(); i++) {
|
if( !(*vi).IsD() ) baricenter += (*vi).P();
|
||||||
VertexType &v = this->mesh.vert[i];
|
|
||||||
if(v.IsD()) continue;
|
|
||||||
this->mesh.bbox.Add(v.P());
|
|
||||||
baricenter += v.P();
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(this->mesh.vn > 3);
|
baricenter /= this->mesh.vn;
|
||||||
|
|
||||||
|
assert(this->mesh.vn > 3);
|
||||||
if(radius == 0)
|
if(radius == 0)
|
||||||
radius = sqrt((this->mesh.bbox.Diag()*this->mesh.bbox.Diag())/this->mesh.vn);
|
radius = sqrt((this->mesh.bbox.Diag()*this->mesh.bbox.Diag())/this->mesh.vn);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue