Corrected a wrong behavior in case of a polychord having singularities on one side and a regular (ring) border on the other, which must not be collapsed.
This commit is contained in:
parent
6f7e2872af
commit
4cc8a7c919
|
@ -903,16 +903,15 @@ private:
|
||||||
assert(!pos.IsNull());
|
assert(!pos.IsNull());
|
||||||
int valence = 0;
|
int valence = 0;
|
||||||
bool singSideA = false, singSideB = false;
|
bool singSideA = false, singSideB = false;
|
||||||
bool borderA = false, borderB = false;
|
bool borderSideA = false, borderSideB = false;
|
||||||
bool polyBorderFound = false;
|
bool polyBorderFound = false;
|
||||||
vcg::face::JumpingPos<FaceType> jmpPos;
|
vcg::face::JumpingPos<FaceType> jmpPos;
|
||||||
|
|
||||||
startPos = pos;
|
startPos = pos;
|
||||||
// check if it is a quad
|
|
||||||
if (startPos.F()->VN() != 4)
|
|
||||||
return PC_NOTQUAD;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
// check if it is a quad
|
||||||
|
if (startPos.F()->VN() != 4)
|
||||||
|
return PC_NOTQUAD;
|
||||||
// check manifoldness
|
// check manifoldness
|
||||||
if (IsVertexAdjacentToAnyNonManifoldEdge(startPos))
|
if (IsVertexAdjacentToAnyNonManifoldEdge(startPos))
|
||||||
return PC_NOTMANIF;
|
return PC_NOTMANIF;
|
||||||
|
@ -921,6 +920,19 @@ private:
|
||||||
return PC_NOTMANIF;
|
return PC_NOTMANIF;
|
||||||
startPos.FlipV();
|
startPos.FlipV();
|
||||||
|
|
||||||
|
// check if side A is on border
|
||||||
|
startPos.FlipE();
|
||||||
|
if (startPos.IsBorder())
|
||||||
|
borderSideA = true;
|
||||||
|
startPos.FlipE();
|
||||||
|
// check if side B is on border
|
||||||
|
startPos.FlipV();
|
||||||
|
startPos.FlipE();
|
||||||
|
if (startPos.IsBorder())
|
||||||
|
borderSideB = true;
|
||||||
|
startPos.FlipE();
|
||||||
|
startPos.FlipV();
|
||||||
|
|
||||||
// check if singularities are not in both sides
|
// check if singularities are not in both sides
|
||||||
if (checkSing) {
|
if (checkSing) {
|
||||||
// compute the valence of the vertex on side B
|
// compute the valence of the vertex on side B
|
||||||
|
@ -928,30 +940,26 @@ private:
|
||||||
valence = startPos.NumberOfIncidentVertices();
|
valence = startPos.NumberOfIncidentVertices();
|
||||||
// if the vertex is on border increment its valence by 1 (virtually connect it to a dummy vertex)
|
// if the vertex is on border increment its valence by 1 (virtually connect it to a dummy vertex)
|
||||||
jmpPos.Set(startPos.F(), startPos.E(), startPos.V());
|
jmpPos.Set(startPos.F(), startPos.E(), startPos.V());
|
||||||
if (jmpPos.FindBorder()) {
|
if (jmpPos.FindBorder())
|
||||||
borderB = true;
|
|
||||||
valence++;
|
valence++;
|
||||||
}
|
|
||||||
if (valence != 4)
|
if (valence != 4)
|
||||||
singSideB = true;
|
singSideB = true;
|
||||||
// a 2-valence internl vertex cause a polychord to touch itself, producing non-2manifoldness
|
// a 2-valence internl vertex cause a polychord to touch itself, producing non-2manifoldness
|
||||||
// in that case, a 2-valence vertex is dealt as 2 singularities in both sides
|
// in that case, a 2-valence vertex is dealt as 2 singularities in both sides
|
||||||
if (valence == 2 && !borderB)
|
if (valence == 2 && !borderSideB)
|
||||||
singSideA = true;
|
singSideA = true;
|
||||||
// compute the valence of the vertex on side A
|
// compute the valence of the vertex on side A
|
||||||
startPos.FlipV();
|
startPos.FlipV();
|
||||||
valence = startPos.NumberOfIncidentVertices();
|
valence = startPos.NumberOfIncidentVertices();
|
||||||
// if the vertex is on border increment its valence by 1 (virtually connect it to a dummy vertex)
|
// if the vertex is on border increment its valence by 1 (virtually connect it to a dummy vertex)
|
||||||
jmpPos.Set(startPos.F(), startPos.E(), startPos.V());
|
jmpPos.Set(startPos.F(), startPos.E(), startPos.V());
|
||||||
if (jmpPos.FindBorder()) {
|
if (jmpPos.FindBorder())
|
||||||
borderA = true;
|
|
||||||
valence++;
|
valence++;
|
||||||
}
|
|
||||||
if (valence != 4)
|
if (valence != 4)
|
||||||
singSideA = true;
|
singSideA = true;
|
||||||
// a 2-valence internal vertex cause a polychord to touch itself, producing non-2manifoldness
|
// a 2-valence internal vertex cause a polychord to touch itself, producing non-2manifoldness
|
||||||
// in that case, a 2-valence vertex is dealt as 2 singularities in both sides
|
// in that case, a 2-valence vertex is dealt as 2 singularities in both sides
|
||||||
if (valence == 2 && !borderA)
|
if (valence == 2 && !borderSideA)
|
||||||
singSideB = true;
|
singSideB = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -982,11 +990,13 @@ private:
|
||||||
} while (startPos != pos);
|
} while (startPos != pos);
|
||||||
|
|
||||||
// polychord with singularities on both sides can not collapse
|
// polychord with singularities on both sides can not collapse
|
||||||
if (singSideA && singSideB)
|
if ((singSideA && singSideB) ||
|
||||||
|
(singSideA && borderSideB) ||
|
||||||
|
(singSideB && borderSideA))
|
||||||
return PC_SINGBOTH;
|
return PC_SINGBOTH;
|
||||||
|
|
||||||
// polychords that are rings and have borders on both sides can not collapse
|
// polychords that are rings and have borders on both sides can not collapse
|
||||||
if (!polyBorderFound && borderA && borderB)
|
if (!polyBorderFound && borderSideA && borderSideB)
|
||||||
return PC_SINGBOTH;
|
return PC_SINGBOTH;
|
||||||
|
|
||||||
return PC_SUCCESS;
|
return PC_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue