EgtGeomkernel :

- modifiche a Zmap per migliore gestione topologia MCube caso 6.
This commit is contained in:
Dario Sassi
2019-02-13 09:13:44 +00:00
parent 86cd1346ec
commit 449a5b5df9
+29 -15
View File
@@ -58,6 +58,18 @@ Config2VertOrder( int nInd)
return false ;
}
//----------------------------------------------------------------------------
bool
Config6Duality( int nInd)
{
if ( nInd == 21 || nInd == 22 || nInd == 28 || nInd == 41 || nInd == 42 || nInd == 44 ||
nInd == 52 || nInd == 56 || nInd == 67 || nInd == 69 || nInd == 73 || nInd == 81 ||
nInd == 84 || nInd == 97 || nInd == 104 || nInd == 131 || nInd == 134 || nInd == 138 ||
nInd == 146 || nInd == 148 || nInd == 162 || nInd == 168 || nInd == 193 || nInd == 194)
return true ;
return false ;
}
//----------------------------------------------------------------------------
int
TestOnNormal( const AppliedVector CompoField[], int nCompoElem)
@@ -1283,7 +1295,7 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
else if ( nAllConfig[nIndex] == 6) {
// Test sulla topologia
bool bDefTopology = false ;
bool bNewTopology = false ;
bool bMatOnSlice = false ;
int nCount = 0 ;
while ( nIndexConfig6[nCount] != nIndex)
++ nCount ;
@@ -1300,13 +1312,13 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
if ( abs( nAdjVox6[nCount]) == 1) {
auto it = SliceYZ.find( nSliceN) ;
if ( it != SliceYZ.end()) {
bNewTopology = it->second ;
bMatOnSlice = it->second ;
bDefTopology = true ;
}
if ( GetBlockNFromIJK( nSlBlockIJK, nSlBlockN)) {
auto it = m_SliceYZ[nSlBlockN].find( nSliceN) ;
if ( it != m_SliceYZ[nSlBlockN].end()) {
bNewTopology = it->second ;
bMatOnSlice = it->second ;
bDefTopology = true ;
}
}
@@ -1314,13 +1326,13 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
else if ( abs( nAdjVox6[nCount]) == 2) {
auto it = SliceXZ.find( nSliceN) ;
if ( it != SliceXZ.end()) {
bNewTopology = it->second ;
bMatOnSlice = it->second ;
bDefTopology = true ;
}
if ( GetBlockNFromIJK( nSlBlockIJK, nSlBlockN)) {
auto it = m_SliceXZ[nSlBlockN].find( nSliceN) ;
if ( it != m_SliceXZ[nSlBlockN].end()) {
bNewTopology = it->second ;
bMatOnSlice = it->second ;
bDefTopology = true ;
}
}
@@ -1328,13 +1340,13 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
else if ( abs( nAdjVox6[nCount]) == 3) {
auto it = SliceXY.find( nSliceN) ;
if ( it != SliceXY.end()) {
bNewTopology = it->second ;
bMatOnSlice = it->second ;
bDefTopology = true ;
}
if ( GetBlockNFromIJK( nSlBlockIJK, nSlBlockN)) {
auto it = m_SliceXY[nSlBlockN].find( nSliceN) ;
if ( it != m_SliceXY[nSlBlockN].end()) {
bNewTopology = it->second ;
bMatOnSlice = it->second ;
bDefTopology = true ;
}
}
@@ -1359,30 +1371,32 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
dDotSum -= CompoVert[1][nTVI].vtVec * CompoVert[1][nTVJ].vtVec ;
}
}
bNewTopology = dDotSum > - 4 ;
bMatOnSlice = dDotSum > - 4 ;
if ( Config6Duality( nIndex))
bMatOnSlice = ! bMatOnSlice ;
}
// Conservo l'informazione
if ( GetVoxNFromIJK( nIJKSl[0], nIJKSl[1], nIJKSl[2], nSliceN)) {
if ( abs(nAdjVox6[nCount]) == 1) {
if ( nSlBlockN == nBlock)
SliceYZ.emplace( nSliceN, ! bNewTopology) ;
SliceYZ.emplace( nSliceN, bMatOnSlice) ;
else
m_SliceYZ[nSlBlockN].emplace( nSliceN, ! bNewTopology) ;
m_SliceYZ[nSlBlockN].emplace( nSliceN, bMatOnSlice) ;
}
else if ( abs(nAdjVox6[nCount]) == 2) {
if ( nSlBlockN == nBlock)
SliceXZ.emplace( nSliceN, ! bNewTopology) ;
SliceXZ.emplace( nSliceN, bMatOnSlice) ;
else
m_SliceXZ[nSlBlockN].emplace( nSliceN, ! bNewTopology) ;
m_SliceXZ[nSlBlockN].emplace( nSliceN, bMatOnSlice) ;
}
else if (abs(nAdjVox6[nCount]) == 3) {
if ( nSlBlockN == nBlock)
SliceXY.emplace( nSliceN, ! bNewTopology) ;
SliceXY.emplace( nSliceN, bMatOnSlice) ;
else
m_SliceXY[nSlBlockN].emplace( nSliceN, ! bNewTopology) ;
m_SliceXY[nSlBlockN].emplace( nSliceN, bMatOnSlice) ;
}
}
bool bNewTopology = ( Config6Duality( nIndex) ? bMatOnSlice : ! bMatOnSlice) ;
// Si deve passare alla seconda topologia
if ( bNewTopology) {
// Ricerca del caso corrispondente della nuova topologia