EgtGeomKernel 1.9c1 :

- migliorie varie a Zmap.
This commit is contained in:
Dario Sassi
2018-02-28 09:34:49 +00:00
parent 10c7c08c86
commit 446cd79029
5 changed files with 164 additions and 331 deletions
+2 -327
View File
@@ -161,318 +161,6 @@ DotTest( const VectorField CompoVert[], int nCompoElem, Vector3d& vtAvg, double
return true ;
}
//----------------------------------------------------------------------------
bool
VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
int nIndArrey[][4], int nVertComp[], int nCompCount, bool& bGridControl) const
{
// Ordino i 4 indici in senso crescente
for ( int nSrtInd1 = 0 ; nSrtInd1 < nVertComp[nCompCount - 1] - 1 ; ++ nSrtInd1) {
for ( int nSrtInd2 = nSrtInd1 + 1 ; nSrtInd2 < nVertComp[nCompCount - 1] ; ++ nSrtInd2) {
if ( nIndArrey[nCompCount - 1][nSrtInd1] > nIndArrey[nCompCount - 1][nSrtInd2])
swap( nIndArrey[nCompCount - 1][nSrtInd1], nIndArrey[nCompCount - 1][nSrtInd2]) ;
}
}
if ( ( nIndArrey[nCompCount - 1][0] == 0 && nIndArrey[nCompCount - 1][1] == 2 &&
nIndArrey[nCompCount - 1][2] == 9 && nIndArrey[nCompCount - 1][3] == 10) ||
( nIndArrey[nCompCount - 1][0] == 4 && nIndArrey[nCompCount - 1][1] == 6 &&
nIndArrey[nCompCount - 1][2] == 9 && nIndArrey[nCompCount - 1][3] == 10) ||
( nIndArrey[nCompCount - 1][0] == 4 && nIndArrey[nCompCount - 1][1] == 6 &&
nIndArrey[nCompCount - 1][2] == 8 && nIndArrey[nCompCount - 1][3] == 11) ||
( nIndArrey[nCompCount - 1][0] == 0 && nIndArrey[nCompCount - 1][1] == 2 &&
nIndArrey[nCompCount - 1][2] == 8 && nIndArrey[nCompCount - 1][3] == 11) ||
( nIndArrey[nCompCount - 1][0] == 1 && nIndArrey[nCompCount - 1][1] == 3 &&
nIndArrey[nCompCount - 1][2] == 8 && nIndArrey[nCompCount - 1][3] == 9 ) ||
( nIndArrey[nCompCount - 1][0] == 1 && nIndArrey[nCompCount - 1][1] == 3 &&
nIndArrey[nCompCount - 1][2] == 10 && nIndArrey[nCompCount - 1][3] == 11) ||
( nIndArrey[nCompCount - 1][0] == 5 && nIndArrey[nCompCount - 1][1] == 7 &&
nIndArrey[nCompCount - 1][2] == 10 && nIndArrey[nCompCount - 1][3] == 11) ||
( nIndArrey[nCompCount - 1][0] == 5 && nIndArrey[nCompCount - 1][1] == 7 &&
nIndArrey[nCompCount - 1][2] == 8 && nIndArrey[nCompCount - 1][3] == 9 )) {
if ( AreSameVectorApprox( VecField[nIndArrey[nCompCount - 1][0]].vtNorm, VecField[nIndArrey[nCompCount - 1][1]].vtNorm) &&
abs( VecField[nIndArrey[nCompCount - 1][0]].vtNorm * VecField[nIndArrey[nCompCount - 1][2]].vtNorm) < EPS_SMALL &&
abs( VecField[nIndArrey[nCompCount - 1][0]].vtNorm * VecField[nIndArrey[nCompCount - 1][3]].vtNorm) < EPS_SMALL) {
Point3d ptBarycenter = ( CompoVert[nCompCount - 1][0].ptInt + CompoVert[nCompCount - 1][1].ptInt +
CompoVert[nCompCount - 1][2].ptInt + CompoVert[nCompCount - 1][3].ptInt) / 4 ;
Vector3d vtVecField = VecField[nIndArrey[nCompCount - 1][0]].vtNorm ;
if ( vtVecField.x * vtVecField.x > 1 - EPS_SMALL * EPS_SMALL) {
if ( abs( CompoVert[nCompCount - 1][0].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][1].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][2].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][3].ptInt.x - ptBarycenter.x) < EPS_SMALL) {
double dXBar = ptBarycenter.x / m_dStep - 0.5 ;
int nBarLimSup = int( m_nNx[0]) ;
int nBarInd = 0 ;
while ( nBarInd < nBarLimSup) {
double dXInd = double( nBarInd) ;
if ( abs( dXInd - dXBar) < EPS_SMALL) {
bGridControl = false ;
break ;
}
++ nBarInd ;
}
}
}
else if ( vtVecField.y * vtVecField.y > 1 - EPS_SMALL * EPS_SMALL) {
if ( abs( CompoVert[nCompCount - 1][0].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][1].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][2].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][3].ptInt.y - ptBarycenter.y) < EPS_SMALL) {
double dYBar = ptBarycenter.y / m_dStep - 0.5 ;
int nBarLimSup = int( m_nNy[0]) ;
int nBarInd = 0 ;
while ( nBarInd < nBarLimSup) {
double dYInd = double( nBarInd) ;
if ( abs( dYInd - dYBar) < EPS_SMALL) {
bGridControl = false ;
break ;
}
++ nBarInd ;
}
}
}
else if ( vtVecField.z * vtVecField.z > 1 - EPS_SMALL * EPS_SMALL) {
if ( abs( CompoVert[nCompCount - 1][0].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][1].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][2].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][3].ptInt.z - ptBarycenter.z) < EPS_SMALL) {
double dZBar = ptBarycenter.z / m_dStep - 0.5 ;
int nBarLimSup = int( m_nNy[1]) ;
int nBarInd = 0 ;
while ( nBarInd < nBarLimSup) {
double dZInd = double( nBarInd) ;
if ( abs( dZInd - dZBar) < EPS_SMALL) {
bGridControl = false ;
break ;
}
++ nBarInd ;
}
}
}
}
else if ( AreSameVectorApprox( VecField[nIndArrey[nCompCount - 1][2]].vtNorm, VecField[nIndArrey[nCompCount - 1][3]].vtNorm) &&
abs( VecField[nIndArrey[nCompCount - 1][2]].vtNorm * VecField[nIndArrey[nCompCount - 1][0]].vtNorm) < EPS_SMALL &&
abs( VecField[nIndArrey[nCompCount - 1][2]].vtNorm * VecField[nIndArrey[nCompCount - 1][1]].vtNorm) < EPS_SMALL) {
Point3d ptBarycenter = ( CompoVert[nCompCount - 1][0].ptInt + CompoVert[nCompCount - 1][1].ptInt +
CompoVert[nCompCount - 1][2].ptInt + CompoVert[nCompCount - 1][3].ptInt) / 4 ;
Vector3d vtVecField = VecField[nIndArrey[nCompCount - 1][2]].vtNorm ;
if ( vtVecField.x * vtVecField.x > 1 - EPS_SMALL * EPS_SMALL) {
if ( abs( CompoVert[nCompCount - 1][0].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][1].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][2].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][3].ptInt.x - ptBarycenter.x) < EPS_SMALL) {
double dXBar = ptBarycenter.x / m_dStep - 0.5 ;
int nBarLimSup = int( m_nNx[0]) ;
int nBarInd = 0 ;
while ( nBarInd < nBarLimSup) {
double dXInd = double( nBarInd) ;
if ( abs( dXInd - dXBar) < EPS_SMALL) {
bGridControl = false ;
break ;
}
++ nBarInd ;
}
}
}
else if ( vtVecField.y * vtVecField.y > 1 - EPS_SMALL * EPS_SMALL) {
if ( abs( CompoVert[nCompCount - 1][0].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][1].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][2].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][3].ptInt.y - ptBarycenter.y) < EPS_SMALL) {
double dYBar = ptBarycenter.y / m_dStep - 0.5 ;
int nBarLimSup = int( m_nNy[0]) ;
int nBarInd = 0 ;
while ( nBarInd < nBarLimSup) {
double dYInd = double( nBarInd) ;
if ( abs( dYInd - dYBar) < EPS_SMALL) {
bGridControl = false ;
break ;
}
++ nBarInd ;
}
}
}
else if ( vtVecField.z * vtVecField.z > 1 - EPS_SMALL * EPS_SMALL) {
if ( abs( CompoVert[nCompCount - 1][0].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][1].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][2].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][3].ptInt.z - ptBarycenter.z) < EPS_SMALL) {
double dZBar = ptBarycenter.z / m_dStep - 0.5 ;
int nBarLimSup = int( m_nNy[1]) ;
int nBarInd = 0 ;
while ( nBarInd < nBarLimSup) {
double dZInd = double( nBarInd) ;
if ( abs( dZInd - dZBar) < EPS_SMALL) {
bGridControl = false ;
break ;
}
++ nBarInd ;
}
}
}
}
}
else if ( ( nIndArrey[nCompCount - 1][0] == 0 && nIndArrey[nCompCount - 1][1] == 1 &&
nIndArrey[nCompCount - 1][2] == 4 && nIndArrey[nCompCount - 1][3] == 5) ||
( nIndArrey[nCompCount - 1][0] == 1 && nIndArrey[nCompCount - 1][1] == 2 &&
nIndArrey[nCompCount - 1][2] == 5 && nIndArrey[nCompCount - 1][3] == 6) ||
( nIndArrey[nCompCount - 1][0] == 2 && nIndArrey[nCompCount - 1][1] == 3 &&
nIndArrey[nCompCount - 1][2] == 6 && nIndArrey[nCompCount - 1][3] == 7) ||
( nIndArrey[nCompCount - 1][0] == 0 && nIndArrey[nCompCount - 1][1] == 3 &&
nIndArrey[nCompCount - 1][2] == 4 && nIndArrey[nCompCount - 1][3] == 7)) {
if ( AreSameVectorApprox( VecField[nIndArrey[nCompCount - 1][0]].vtNorm, VecField[nIndArrey[nCompCount - 1][2]].vtNorm) &&
abs( VecField[nIndArrey[nCompCount - 1][0]].vtNorm * VecField[nIndArrey[nCompCount - 1][1]].vtNorm) < EPS_SMALL &&
abs( VecField[nIndArrey[nCompCount - 1][0]].vtNorm * VecField[nIndArrey[nCompCount - 1][3]].vtNorm) < EPS_SMALL) {
Point3d ptBarycenter = ( CompoVert[nCompCount - 1][0].ptInt + CompoVert[nCompCount - 1][1].ptInt +
CompoVert[nCompCount - 1][2].ptInt + CompoVert[nCompCount - 1][3].ptInt) / 4 ;
Vector3d vtVecField = VecField[nIndArrey[nCompCount - 1][0]].vtNorm ;
if ( vtVecField.x * vtVecField.x > 1 - EPS_SMALL * EPS_SMALL) {
if ( abs( CompoVert[nCompCount - 1][0].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][1].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][2].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][3].ptInt.x - ptBarycenter.x) < EPS_SMALL) {
double dXBar = ptBarycenter.x / m_dStep - 0.5 ;
int nBarLimSup = int( m_nNx[0]) ;
int nBarInd = 0 ;
while ( nBarInd < nBarLimSup) {
double dXInd = double( nBarInd) ;
if ( abs( dXInd - dXBar) < EPS_SMALL) {
bGridControl = false ;
break ;
}
++ nBarInd ;
}
}
}
else if ( vtVecField.y * vtVecField.y > 1 - EPS_SMALL * EPS_SMALL) {
if ( abs( CompoVert[nCompCount - 1][0].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][1].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][2].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][3].ptInt.y - ptBarycenter.y) < EPS_SMALL) {
double dYBar = ptBarycenter.y / m_dStep - 0.5 ;
int nBarLimSup = int( m_nNy[0]) ;
int nBarInd = 0 ;
while ( nBarInd < nBarLimSup) {
double dYInd = double( nBarInd) ;
if ( abs( dYInd - dYBar) < EPS_SMALL) {
bGridControl = false ;
break ;
}
++ nBarInd ;
}
}
}
else if ( vtVecField.z * vtVecField.z > 1 - EPS_SMALL * EPS_SMALL) {
if ( abs( CompoVert[nCompCount - 1][0].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][1].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][2].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][3].ptInt.z - ptBarycenter.z) < EPS_SMALL) {
double dZBar = ptBarycenter.z / m_dStep - 0.5 ;
int nBarLimSup = int( m_nNy[1]) ;
int nBarInd = 0 ;
while ( nBarInd < nBarLimSup) {
double dZInd = double( nBarInd) ;
if ( abs( dZInd - dZBar) < EPS_SMALL) {
bGridControl = false ;
break ;
}
++ nBarInd ;
}
}
}
}
else if ( AreSameVectorApprox( VecField[nIndArrey[nCompCount - 1][1]].vtNorm, VecField[nIndArrey[nCompCount - 1][3]].vtNorm) &&
abs( VecField[nIndArrey[nCompCount - 1][1]].vtNorm * VecField[nIndArrey[nCompCount - 1][0]].vtNorm) < EPS_SMALL &&
abs( VecField[nIndArrey[nCompCount - 1][1]].vtNorm * VecField[nIndArrey[nCompCount - 1][2]].vtNorm) < EPS_SMALL) {
Point3d ptBarycenter = ( CompoVert[nCompCount - 1][0].ptInt + CompoVert[nCompCount - 1][1].ptInt +
CompoVert[nCompCount - 1][2].ptInt + CompoVert[nCompCount - 1][3].ptInt) / 4 ;
Vector3d vtVecField = VecField[nIndArrey[nCompCount - 1][0]].vtNorm ;
if ( vtVecField.x * vtVecField.x > 1 - EPS_SMALL * EPS_SMALL) {
if ( abs( CompoVert[nCompCount - 1][0].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][1].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][2].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][3].ptInt.x - ptBarycenter.x) < EPS_SMALL) {
double dXBar = ptBarycenter.x / m_dStep - 0.5 ;
int nBarLimSup = int( m_nNx[0]) ;
int nBarInd = 0 ;
while ( nBarInd < nBarLimSup) {
double dXInd = double( nBarInd) ;
if ( abs( dXInd - dXBar) < EPS_SMALL) {
bGridControl = false ;
break ;
}
++ nBarInd ;
}
}
}
else if ( vtVecField.y * vtVecField.y > 1 - EPS_SMALL * EPS_SMALL) {
if ( abs( CompoVert[nCompCount - 1][0].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][1].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][2].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][3].ptInt.y - ptBarycenter.y) < EPS_SMALL) {
double dYBar = ptBarycenter.y / m_dStep - 0.5 ;
int nBarLimSup = int( m_nNy[0]) ;
int nBarInd = 0 ;
while ( nBarInd < nBarLimSup) {
double dYInd = double( nBarInd) ;
if ( abs( dYInd - dYBar) < EPS_SMALL) {
bGridControl = false ;
break ;
}
++ nBarInd ;
}
}
}
else if ( vtVecField.z * vtVecField.z > 1 - EPS_SMALL * EPS_SMALL) {
if ( abs( CompoVert[nCompCount - 1][0].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][1].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][2].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
abs( CompoVert[nCompCount - 1][3].ptInt.z - ptBarycenter.z) < EPS_SMALL) {
double dZBar = ptBarycenter.z / m_dStep - 0.5 ;
int nBarLimSup = int( m_nNy[1]) ;
int nBarInd = 0 ;
while ( nBarInd < nBarLimSup) {
double dZInd = double( nBarInd) ;
if ( abs( dZInd - dZBar) < EPS_SMALL) {
bGridControl = false ;
break ;
}
++ nBarInd ;
}
}
}
}
}
return true ;
}
// ------------------------- VISUALIZZAZIONE --------------------------------------------------------------------------------------
//----------------------------------------------------------------------------
bool
@@ -1245,17 +933,9 @@ VolZmap::ProcessCube( int nVoxI, int nVoxJ, int nVoxK, TRIA3DEXLIST& lstTria, Tr
// Se i componenti sono regolari valuto le normali per stabilire se eseguire ExtMC o MC
if ( bReg)
nFeatureType = TestOnNormal( CompoVert[nCompCount - 1], nVertComp[nCompCount - 1]) ;
// Controllo per il caso piano su una griglia
// con versori normali a due a due paralleli.
bool bGridControl = true ;
if ( nFeatureType != NO_FEATURE) {
if ( nVertComp[nCompCount - 1] == 4)
GridControl( VecField, CompoVert, nIndArrey, nVertComp, nCompCount, bGridControl) ;
}
// Flag ExtMC
bool bExtMC = ( nFeatureType != NO_FEATURE && bGridControl) && ( ! bSecondConfig6) && bEnh ;
bool bExtMC = ( nFeatureType != NO_FEATURE) && ( ! bSecondConfig6) && bEnh ;
// Extended MC
if ( bExtMC) {
@@ -1993,13 +1673,8 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DEXLIST& lstTria, TriHolder& triHold
if ( bReg)
nFeatureType = TestOnNormal( CompoVert[nCompCount - 1], nVertComp[nCompCount - 1]) ;
// Controllo per il caso piano su una griglia con versori normali a due a due paralleli
bool bGridControl = true ;
if ( nFeatureType != NO_FEATURE && nVertComp[nCompCount - 1] == 4)
GridControl( VecField, CompoVert, nIndArrey, nVertComp, nCompCount, bGridControl) ;
// Flag ExtMC
bool bExtMC = ( nFeatureType != NO_FEATURE /*&& bGridControl*/) ;
bool bExtMC = ( nFeatureType != NO_FEATURE) ;
// Extended MC
if ( bExtMC) {