Improved float/double consistency removing some wrong Point3f and substitued with MeshType::CoordType

and removed a small bug (in the initialization the first ball sphere could fail for approx errors)
This commit is contained in:
Paolo Cignoni 2014-06-19 10:25:50 +00:00
parent 59779347ab
commit 3bc58b7018
1 changed files with 132 additions and 131 deletions

View File

@ -58,7 +58,7 @@ template <class MESH> class BallPivoting: public AdvancingFront<MESH> {
max_edge *= radius;
VertexConstDataWrapper<MESH> ww(this->mesh);
tree = new KdTree<float>(ww);
tree = new KdTree<ScalarType>(ww);
tree->setMaxNofNeighbors(16);
usedBit = VertexType::NewBitFlag();
@ -81,8 +81,8 @@ template <class MESH> class BallPivoting: public AdvancingFront<MESH> {
bool Seed(int &v0, int &v1, int &v2) {
//get a sphere of neighbours
std::vector<VertexType *> targets;
while(++last_seed < (int)(this->mesh.vert.size())) {
std::vector<VertexType *> targets;
VertexType &seed = this->mesh.vert[last_seed];
if(seed.IsD() || seed.IsUserBit(usedBit)) continue;
@ -151,7 +151,8 @@ template <class MESH> class BallPivoting: public AdvancingFront<MESH> {
//check no other point inside
int t;
for(t = 0; t < n; t++) {
if((center - targets[t]->P()).Norm() <= radius)
ScalarType rr= Distance(center, targets[t]->P());
if( rr < radius - min_edge)
break;
}
if(t < n) {
@ -322,7 +323,7 @@ template <class MESH> class BallPivoting: public AdvancingFront<MESH> {
int last_seed; //used for new seeds when front is empty
int usedBit; //use to detect if a vertex has been already processed.
Point3x baricenter;//used for the first seed.
KdTree<float> *tree;
KdTree<ScalarType> *tree;
/* returns the sphere touching p0, p1, p2 of radius r such that