Rimossa (temporaneamente) la parte che cerca le altre componenti connesse.
This commit is contained in:
parent
4a9d5af123
commit
568dbaf75f
|
@ -63,10 +63,11 @@ class Pivot {
|
||||||
std::vector<int> nb; //number of fronts a vertex is into,
|
std::vector<int> nb; //number of fronts a vertex is into,
|
||||||
//this is used for the Visited and Border flags
|
//this is used for the Visited and Border flags
|
||||||
//but adding topology may not be needed anymode
|
//but adding topology may not be needed anymode
|
||||||
|
int last_seed;
|
||||||
|
|
||||||
|
|
||||||
Pivot(MESH &_mesh, ScalarType _radius, ScalarType _mindist = 0.05, ScalarType _crease = -0.5):
|
Pivot(MESH &_mesh, ScalarType _radius, ScalarType _mindist = 0.05, ScalarType _crease = -0.5):
|
||||||
mesh(_mesh), radius(_radius), mindist(_mindist), crease(_crease) {
|
mesh(_mesh), radius(_radius), mindist(_mindist), crease(_crease), last_seed(0) {
|
||||||
|
|
||||||
//Compute bounding box. (this may be passed as a parameter?
|
//Compute bounding box. (this may be passed as a parameter?
|
||||||
for(int i = 0; i < mesh.vert.size(); i++)
|
for(int i = 0; i < mesh.vert.size(); i++)
|
||||||
|
@ -147,6 +148,18 @@ bool seed(bool outside = true, int start = -1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//check on the other side there are not a surface
|
||||||
|
Point3x recenter;
|
||||||
|
if(!findSphere(p0, p2, p1, recenter)) continue;
|
||||||
|
for(int t = 0; t < n; t++) {
|
||||||
|
CVertex &v = mesh.vert[targets[t]];
|
||||||
|
Point3x &p = v.P();
|
||||||
|
if((center - p).Norm() <= radius && (v.IsV() || v.IsB())) {
|
||||||
|
failed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(failed) continue;
|
if(failed) continue;
|
||||||
found = true;
|
found = true;
|
||||||
i = k = j = n;
|
i = k = j = n;
|
||||||
|
@ -203,18 +216,21 @@ int addFace() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!front.size()) {
|
if(!front.size()) {
|
||||||
|
return -1;
|
||||||
//maybe there are unconnected parts of the mesh:
|
//maybe there are unconnected parts of the mesh:
|
||||||
//find a non D, V, B point and try to seed if failed D it.
|
//find a non D, V, B point and try to seed if failed D it.
|
||||||
for(int i = 0; i < mesh.vert.size();i ++) {
|
for(; last_seed < mesh.vert.size(); ++last_seed) {
|
||||||
CVertex &v = mesh.vert[i];
|
CVertex &v = mesh.vert[last_seed];
|
||||||
if(v.IsD() || v.IsV() || v.IsB()) continue;
|
if(v.IsD() || v.IsV() || v.IsB()) continue;
|
||||||
if(seed(true, i)) return 1;
|
printf("seeding new: %i\n", last_seed);
|
||||||
|
if(seed(true, last_seed)) return 1;
|
||||||
v.SetD();
|
v.SetD();
|
||||||
--mesh.vn;
|
--mesh.vn;
|
||||||
}
|
}
|
||||||
|
printf("done\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if(last_seed > 1) printf("frontsixe: %d\n", front.size());
|
||||||
typename std::list<Edgex>::iterator ei = front.begin();
|
typename std::list<Edgex>::iterator ei = front.begin();
|
||||||
Edgex &e = *ei;
|
Edgex &e = *ei;
|
||||||
Edgex &previous = *e.previous;
|
Edgex &previous = *e.previous;
|
||||||
|
@ -346,7 +362,7 @@ int addFace() {
|
||||||
(*up).v1 = v2;
|
(*up).v1 = v2;
|
||||||
(*up).face = fn;
|
(*up).face = fn;
|
||||||
(*up).center = center;
|
(*up).center = center;
|
||||||
moveBack(ei);
|
moveBack(ei);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -500,7 +516,8 @@ int addFace() {
|
||||||
int tot = 0;
|
int tot = 0;
|
||||||
//HACK to speed up things until i can use a seach structure
|
//HACK to speed up things until i can use a seach structure
|
||||||
int i = mesh.face.size() - 2*(front.size());
|
int i = mesh.face.size() - 2*(front.size());
|
||||||
// i = 0;
|
if(front.size() < 100) i = mesh.face.size() - 100;
|
||||||
|
// i = 0;
|
||||||
if(i < 0) i = 0;
|
if(i < 0) i = 0;
|
||||||
for(; i < mesh.face.size(); i++) {
|
for(; i < mesh.face.size(); i++) {
|
||||||
CFace &f = mesh.face[i];
|
CFace &f = mesh.face[i];
|
||||||
|
|
Loading…
Reference in New Issue