EgtGeomKernel :

- modifiche a sistemazione topologie di intersezioni di curve composite
- eliminazione di linee inutili in generale
- cambio nome di variabili che nascondono omonime.
This commit is contained in:
Dario Sassi
2020-10-05 06:56:24 +00:00
parent 74df7ecfcd
commit be027def9c
18 changed files with 152 additions and 232 deletions
+25 -49
View File
@@ -99,7 +99,7 @@ int
TestOnNormal( const AppliedVector CompoField[], int nCompoElem)
{
// Cerco la massima deviazione tra le normali nei punti della parte connessa
int nI, nJ ;
int nI = -1, nJ = -1 ;
double dMinCosTheta = 2 ;
for ( int i = 0 ; i < nCompoElem ; ++ i) {
for ( int j = i + 1 ; j < nCompoElem ; ++ j) {
@@ -142,7 +142,7 @@ bool
CanonicPlaneTest( const AppliedVector CompoField[], int nDir, double& dPos, int& nTool)
{
// Verifico posizione dei punti
int nI ;
int nI = -1 ;
switch ( nDir) {
case X_PLUS : case X_MINUS : nI = 0 ; break ;
case Y_PLUS : case Y_MINUS : nI = 1 ; break ;
@@ -166,7 +166,6 @@ CanonicPlaneTest( const AppliedVector CompoField[], int nDir, double& dPos, int&
case Z_PLUS : vtN = Z_AX ; break ;
case Z_MINUS : vtN = - Z_AX ; break ;
}
int nDifferent = 0 ;
for ( int i = 0 ; i < 4 ; ++ i) {
if ( CompoField[i].vtVec * vtN < 0.999)
return false ;
@@ -657,8 +656,8 @@ VolZmap::GetChunkPrisms( int nPos1, int nPos2, int nDim1, int nDim2, int nDimChk
{
// determino se è un semplice parallelepipedo
bool bIsSimple = true ;
double dBotZ ;
double dTopZ ;
double dBotZ = 0 ;
double dTopZ = 0 ;
for ( int i = 0 ; i < nDim1 && bIsSimple ; ++ i) {
for ( int j = 0 ; j < nDim2 && bIsSimple ; ++ j) {
int nPos = ( nPos1 + i) + ( nPos2 + j) * m_nNx[0] ;
@@ -1224,8 +1223,8 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
int nIJKSl[3] = { ( nAdjVox3[nCount] != 1 ? i : i + 1),
( nAdjVox3[nCount] != 2 ? j : j + 1),
( nAdjVox3[nCount] != 3 ? k : k + 1) } ;
int nSliceN ;
int nSlBlockN ;
int nSliceN = -1 ;
int nSlBlockN = -1 ;
if ( GetVoxNFromIJK(nIJKSl[0], nIJKSl[1], nIJKSl[2], nSliceN)) {
int nSlBlockIJK[3] ;
GetVoxelBlockIJK(nIJKSl, nSlBlockIJK) ;
@@ -1622,8 +1621,8 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
nFace[nCurFaceXY] = 0 ;
// Per ogni faccia in gioco vediamo se c'è materiale: se sì assegnamo l'indice 1
int nSlYZN ;
int nSlYZBlockN ;
int nSlYZN = -1 ;
int nSlYZBlockN =-1 ;
if ( GetVoxNFromIJK( nIJKSlYZ[0], nIJKSlYZ[1], nIJKSlYZ[2], nSlYZN)) {
// Slice interna al blocco
auto it = SliceYZ.find( nSlYZN) ;
@@ -1646,8 +1645,8 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
}
}
}
int nSlXZN ;
int nSlXZBlockN ;
int nSlXZN = -1 ;
int nSlXZBlockN =-1 ;
if ( GetVoxNFromIJK( nIJKSlXZ[0], nIJKSlXZ[1], nIJKSlXZ[2], nSlXZN)) {
// Slice interna al blocco
auto it = SliceXZ.find( nSlXZN) ;
@@ -1670,8 +1669,8 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
}
}
}
int nSlXYN ;
int nSlXYBlockN ;
int nSlXYN =-1 ;
int nSlXYBlockN =-1 ;
if ( GetVoxNFromIJK( nIJKSlXY[0], nIJKSlXY[1], nIJKSlXY[2], nSlXYN)) {
// Slice interna al blocco
auto it = SliceXY.find( nSlXYN) ;
@@ -1938,9 +1937,6 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
int nVoxSmootSizePrev = int( VoxSmoothTria.vTria.size()) ;
int nVoxSmootSize = nVoxSmootSizePrev ;
// Numero di feature nel voxel: al più vi è una feature per componente connessa.
int nFeatureInVoxel = 0 ;
// Ciclo sulle componenti
for ( int nComp = 0 ; nComp < nComponents ; ++ nComp) {
@@ -2482,31 +2478,12 @@ VolZmap::RegulateFeaturesChain( vector<VoxelContainer>& vVecVox) const
double dMidU = ( ptMid - ptPSt) * vtStEn ;
double dCurU = ( ptPCur - ptPSt) * vtStEn ;
Point3d ptNew ;
//Point3d ptPLine ;
//Vector3d vtDLine ;
if ( dMidU < dCurU) {
//ptPLine = ptPEn ;
//vtDLine = - vtCurrEn ;
ptNew = ptPEn + ( ptMid - ptPEn) * vtCurrEn * vtCurrEn ;
}
else {
//ptPLine = ptPSt ;
//vtDLine = vtStCurr ;
ptNew = ptPSt + ( ptMid - ptPSt) * vtStCurr * vtStCurr ;
}
//Point3d ptCubeInf( ( CurVox.i * m_nDexVoxRatio + 0.5) * m_dStep,
// ( CurVox.j * m_nDexVoxRatio + 0.5) * m_dStep,
// ( CurVox.k * m_nDexVoxRatio + 0.5) * m_dStep) ;
//Point3d ptCubeSup( ( ( CurVox.i + 1) * m_nDexVoxRatio + 0.5) * m_dStep,
// ( ( CurVox.j + 1) * m_nDexVoxRatio + 0.5) * m_dStep,
// ( ( CurVox.k + 1) * m_nDexVoxRatio + 0.5) * m_dStep) ;
//double dU1, dU2 ;
//if ( 1 - abs( vtStCurr * vtCurrEn ) < EPS_ZERO &&
// IntersLineBox( ptPLine, vtDLine, ptCubeInf, ptCubeSup, dU1, dU2)) {
// double dU = abs( dU1) < abs( dU2) ? dU1 + ( dU2 - dU1) / 2 : dU2 + ( dU1 - dU2) / 2 ;
// ptNew = ptPLine + dU * vtDLine ;
//}
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) {
CurVox.Compo[nComp].ptVert = ptNew ;
@@ -2597,7 +2574,6 @@ VolZmap::RegulateFeaturesChain( vector<VoxelContainer>& vVecVox) const
double dU = ( dU1 + dU2) / 2 ;
ptNew = ptPLine + dU * vtDLine ;
}
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*/) {
CurVox.Compo[nComp].ptVert = ptNew ;
@@ -2959,7 +2935,7 @@ VolZmap::FlipEdgesII( int nBlock) const
if ( bOnPlane) {
Triangle3d trT1 = vTria1[nTri1] ;
Triangle3d trT2 = vTria2[nTri2] ;
int nVert1, nVert2 ;
int nVert1 = -1, nVert2 = -1 ;
// Determino gli indici dei punti sharp-feature
for ( int nP = 0 ; nP < 3 ; ++ nP) {
if ( nP != 1 && nP != 2)
@@ -3023,7 +2999,7 @@ VolZmap::FlipEdgesII( int nBlock) const
}
}
// Trovo il colore associato al vertice di massimo prodotto scalare
int nCol ;
int nCol = -1 ;
switch ( nMaxPos) {
case 0 :
nCol = vTria1[nTri1].GetAttrib( 1) ;
@@ -3241,7 +3217,7 @@ VolZmap::FlipEdgesBB( void) const
if ( bOnPlane) {
Triangle3dEx trTF = m_InterBlockSharpTria[tFB][tVFB].vCompoTria[tCmpF][tTriFB] ;
Triangle3dEx trTL = m_InterBlockSharpTria[tLB][tVLB].vCompoTria[tCmpL][tTriLB] ;
int nVertF, nVertL ;
int nVertF = -1, nVertL =-1 ;
// Determino gli indici dei punti sharp-feature
for ( int nP = 0 ; nP < 3 ; ++ nP) {
if ( nP != 1 && nP != 2)
@@ -3312,7 +3288,7 @@ VolZmap::FlipEdgesBB( void) const
}
}
// Trovo il colore associato al vertice di massimo prodotto scalare
int nCol ;
int nCol = -1 ;
switch ( nMaxPos) {
case 0 :
nCol = m_InterBlockSharpTria[tFB][tVFB].vCompoTria[tCmpF][tTriFB].GetAttrib( 1) ;
@@ -3386,7 +3362,7 @@ VolZmap::IsThereMat( int nI, int nJ, int nK) const
bool bInterOnNode[3] = { false, false, false} ;
for ( int nGrid = 0 ; nGrid < int( m_nMapNum) ; ++ nGrid) {
// assegnazione dati vertice dipendenti dalla griglia
int nGrI, nGrJ ;
int nGrI = -1, nGrJ = -1 ;
switch ( nGrid) {
case 0 :
nGrI = nI ;
@@ -4086,7 +4062,7 @@ VolZmap::GetLastVoxIJK( int& i, int& j, int& k) const
if ( m_nShape != BOX)
return false ;
// Calcolo indici
int ni, nj ;
int ni = -1, nj = -1 ;
for ( ni = int( m_nNx[0]) - 1 ; ni > int( m_nNx[0]) - 3 ; -- ni) {
bool bNotEmpty = false ;
for ( nj = int( m_nNy[0]) - 1 ; nj > int( m_nNy[0]) - 3 ; -- nj) {
@@ -4099,7 +4075,7 @@ VolZmap::GetLastVoxIJK( int& i, int& j, int& k) const
if ( bNotEmpty)
break ;
}
int mi, mj ;
int mi = -1, mj = -1 ;
for ( mi = int( m_nNx[1]) - 1 ; mi > int( m_nNx[1]) - 3 ; -- mi) {
bool bNotEmpty = false ;
for ( mj = int( m_nNy[1]) - 1 ; mj > int( m_nNy[1]) - 3 ; -- mj) {
@@ -4332,8 +4308,8 @@ VolZmap::ProcessVoxContXY( FlatVoxelContainer& VoxContXY, int nBlock, bool bPlus
}
Tria0.SetGrade( nToolNum) ;
Tria1.SetGrade( nToolNum) ;
bool bV0 = Tria0.Validate( true) ;
bool bV1 = Tria1.Validate( true) ;
Tria0.Validate( true) ;
Tria1.Validate( true) ;
// Aggiungo alla lista
m_BlockBigTria[nBlock].emplace_back( Tria0) ;
m_BlockBigTria[nBlock].emplace_back( Tria1) ;
@@ -4452,8 +4428,8 @@ VolZmap::ProcessVoxContYZ( FlatVoxelContainer& VoxContYZ, int nBlock, bool bPlus
}
Tria0.SetGrade( nToolNum) ;
Tria1.SetGrade( nToolNum) ;
bool bV0 = Tria0.Validate( true) ;
bool bV1 = Tria1.Validate( true) ;
Tria0.Validate( true) ;
Tria1.Validate( true) ;
// Aggiungo alla lista
m_BlockBigTria[nBlock].emplace_back( Tria0) ;
m_BlockBigTria[nBlock].emplace_back( Tria1) ;
@@ -4572,8 +4548,8 @@ VolZmap::ProcessVoxContXZ( FlatVoxelContainer& VoxContXZ, int nBlock, bool bPlus
}
Tria0.SetGrade( nToolNum) ;
Tria1.SetGrade( nToolNum) ;
bool bV0 = Tria0.Validate( true) ;
bool bV1 = Tria1.Validate( true) ;
Tria0.Validate( true) ;
Tria1.Validate( true) ;
// Aggiungo alla lista
m_BlockBigTria[nBlock].emplace_back( Tria0) ;
m_BlockBigTria[nBlock].emplace_back( Tria1) ;