EgtGeomKernel 1.9d1 :

- correzione a Zmap per memoria non liberata nella parte di grafica.
This commit is contained in:
Dario Sassi
2018-04-04 17:57:35 +00:00
parent 5cf6cc649d
commit f4c0c2ee0f
3 changed files with 30 additions and 55 deletions
+30 -53
View File
@@ -1794,25 +1794,6 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DEXLIST& lstTria, VoxelContainer& vV
for ( int nV = 0 ; nV < nVertComp[nComp] ; ++ nV) {
VoxConf.Compo[tOldCompo].CompVecField[nV] = CompoVert[nComp][nV] ;
}
// Esperimento
//for ( int nVtI = 0 ; nVtI < VoxConf[tOldSize].Compo[tOldCompo].nVertNum ; ++ nVtI) {
// int nVtJ = ( nVtI + 1) % nVertComp[nComp] ;
// Point3d ptPI = VoxConf[tOldSize].Compo[tOldCompo].CompVecField[nVtI].ptPApp ;
// Point3d ptPJ = VoxConf[tOldSize].Compo[tOldCompo].CompVecField[nVtJ].ptPApp ;
// Vector3d vtNI = VoxConf[tOldSize].Compo[tOldCompo].CompVecField[nVtI].vtVec ;
// Vector3d vtNJ = VoxConf[tOldSize].Compo[tOldCompo].CompVecField[nVtJ].vtVec ;
// Vector3d vtN = ( ptPJ - ptSol) ^ ( ptPI - ptPJ) ;
// double dFactor = 50 * EPS_SMALL * N_DEXVOXRATIO * m_dStep * vtN.Len() ;
// vtN.Normalize() ;
// if ( AreOppositeVectorApprox( vtN, vtNI) && AreOppositeVectorApprox( vtN, vtNJ)) {
// // Vers 1
// //ptSol += dFactor * vtN ;
// // Vers 2
// ptSol -= dFactor * 0.5 * ( vtNI + vtNJ) ;
// break ;
// }
//}
// Fine esperimento
VoxConf.Compo[tOldCompo].ptVert = ptSol ;
VoxConf.Compo[tOldCompo].bInside = IsPointInsideVoxelApprox( i, j, k, ptSol, 0) ;
VoxConf.Compo[tOldCompo].bCorner = ( nFeatureType == CORNER) ;
@@ -2000,41 +1981,39 @@ VolZmap::RegulateFeaturesChain( std::vector<VoxelContainer>& vVecVox) const
}
// Caso feature
else {
std::vector<int> vNearInn, vNearBord ;
INTVECTOR vNearInn, vNearBord ;
FindAdjComp( vVecVox, nBlock, nVox, nComp, vNearInn, vNearBord) ;
int nSizeInn = int( vNearInn.size()) ;
int nSizeBord = int( vNearBord.size() );
if ( nSizeInn + nSizeBord == 6) {
Voxel* pVoxSt = new Voxel ;
Voxel* pVoxEn = new Voxel ;
const Voxel* pVoxSt = nullptr ;
const Voxel* pVoxEn = nullptr ;
if ( nSizeInn == 6) {
*pVoxSt = vVecVox[vNearInn[0]].find( vNearInn[1])->second ;
*pVoxEn = vVecVox[vNearInn[3]].find( vNearInn[4])->second ;
pVoxSt = &( vVecVox[vNearInn[0]].find( vNearInn[1])->second) ;
pVoxEn = &( vVecVox[vNearInn[3]].find( vNearInn[4])->second) ;
}
else if ( nSizeBord == 6) {
*pVoxSt = m_InterBlockVox[vNearBord[0]].find( vNearBord[1])->second ;
*pVoxEn = m_InterBlockVox[vNearBord[3]].find( vNearBord[4])->second ;
pVoxSt = &( m_InterBlockVox[vNearBord[0]].find( vNearBord[1])->second) ;
pVoxEn = &( m_InterBlockVox[vNearBord[3]].find( vNearBord[4])->second) ;
}
else {
*pVoxSt = vVecVox[vNearInn[0]].find( vNearInn[1])->second ;
*pVoxEn = m_InterBlockVox[vNearBord[0]].find( vNearBord[1])->second ;
pVoxSt = &( vVecVox[vNearInn[0]].find( vNearInn[1])->second) ;
pVoxEn = &( m_InterBlockVox[vNearBord[0]].find( vNearBord[1])->second) ;
}
Voxel& AdjVoxSt = * pVoxSt ;
Voxel& AdjVoxEn = * pVoxEn ;
Point3d ptPCur = CurVox.Compo[nComp].ptVert ;
Point3d ptPSt ;
Point3d ptPEn ;
if ( nSizeInn == 6) {
ptPSt = AdjVoxSt.Compo[vNearInn[2]].ptVert ;
ptPEn = AdjVoxEn.Compo[vNearInn[5]].ptVert ;
ptPSt = pVoxSt->Compo[vNearInn[2]].ptVert ;
ptPEn = pVoxEn->Compo[vNearInn[5]].ptVert ;
}
else if ( nSizeBord == 6) {
ptPSt = AdjVoxSt.Compo[vNearBord[2]].ptVert ;
ptPEn = AdjVoxEn.Compo[vNearBord[5]].ptVert ;
ptPSt = pVoxSt->Compo[vNearBord[2]].ptVert ;
ptPEn = pVoxEn->Compo[vNearBord[5]].ptVert ;
}
else {
ptPSt = AdjVoxSt.Compo[vNearInn[2]].ptVert ;
ptPEn = AdjVoxEn.Compo[vNearBord[2]].ptVert ;
ptPSt = pVoxSt->Compo[vNearInn[2]].ptVert ;
ptPEn = pVoxEn->Compo[vNearBord[2]].ptVert ;
}
Vector3d vtStCurr = ptPCur - ptPSt ;
Vector3d vtStEn = ptPEn - ptPSt ;
@@ -2072,7 +2051,7 @@ VolZmap::RegulateFeaturesChain( std::vector<VoxelContainer>& vVecVox) const
}
bool bNewInside = IsPointInsideVoxelApprox( CurVox.i, CurVox.j, CurVox.k, ptNew, 0) ;
if ( abs( vtStCurr * vtStEn) > 0.95 && abs( vtStCurr * vtCurrEn) > 0.95 &&
abs( vtStEn * vtCurrEn) > 0.95 /*&& bNewInside*/) {
abs( vtStEn * vtCurrEn) > 0.95) {
CurVox.Compo[nComp].ptVert = ptNew ;
}
}
@@ -2096,36 +2075,34 @@ VolZmap::RegulateFeaturesChain( std::vector<VoxelContainer>& vVecVox) const
int nSizeInn = int( vNearInn.size()) ;
int nSizeBord = int( vNearBord.size() );
if ( nSizeInn + nSizeBord == 6) {
Voxel* pVoxSt = new Voxel ;
Voxel* pVoxEn = new Voxel ;
const Voxel* pVoxSt = nullptr ;
const Voxel* pVoxEn = nullptr ;
if ( nSizeInn == 6) {
*pVoxSt = vVecVox[vNearInn[0]].find( vNearInn[1])->second ;
*pVoxEn = vVecVox[vNearInn[3]].find( vNearInn[4])->second ;
pVoxSt = &( vVecVox[vNearInn[0]].find( vNearInn[1])->second) ;
pVoxEn = &( vVecVox[vNearInn[3]].find( vNearInn[4])->second) ;
}
else if ( nSizeBord == 6) {
*pVoxSt = m_InterBlockVox[vNearBord[0]].find( vNearBord[1])->second ;
*pVoxEn = m_InterBlockVox[vNearBord[3]].find( vNearBord[4])->second ;
pVoxSt = &( m_InterBlockVox[vNearBord[0]].find( vNearBord[1])->second) ;
pVoxEn = &( m_InterBlockVox[vNearBord[3]].find( vNearBord[4])->second) ;
}
else {
*pVoxSt = vVecVox[vNearInn[0]].find( vNearInn[1])->second ;
*pVoxEn = m_InterBlockVox[vNearBord[0]].find( vNearBord[1])->second ;
pVoxSt = &( vVecVox[vNearInn[0]].find( vNearInn[1])->second) ;
pVoxEn = &( m_InterBlockVox[vNearBord[0]].find( vNearBord[1])->second) ;
}
Voxel& AdjVoxSt = * pVoxSt ;
Voxel& AdjVoxEn = * pVoxEn ;
Point3d ptPCur = CurVox.Compo[nComp].ptVert ;
Point3d ptPSt ;
Point3d ptPEn ;
if ( nSizeInn == 6) {
ptPSt = AdjVoxSt.Compo[vNearInn[2]].ptVert ;
ptPEn = AdjVoxEn.Compo[vNearInn[5]].ptVert ;
ptPSt = pVoxSt->Compo[vNearInn[2]].ptVert ;
ptPEn = pVoxEn->Compo[vNearInn[5]].ptVert ;
}
else if ( nSizeBord == 6) {
ptPSt = AdjVoxSt.Compo[vNearBord[2]].ptVert ;
ptPEn = AdjVoxEn.Compo[vNearBord[5]].ptVert ;
ptPSt = pVoxSt->Compo[vNearBord[2]].ptVert ;
ptPEn = pVoxEn->Compo[vNearBord[5]].ptVert ;
}
else {
ptPSt = AdjVoxSt.Compo[vNearInn[2]].ptVert ;
ptPEn = AdjVoxEn.Compo[vNearBord[2]].ptVert ;
ptPSt = pVoxSt->Compo[vNearInn[2]].ptVert ;
ptPEn = pVoxEn->Compo[vNearBord[2]].ptVert ;
}
Vector3d vtStCurr = ptPCur - ptPSt ;
Vector3d vtStEn = ptPEn - ptPSt ;