diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index 4ea657d..371ed0b 100644 Binary files a/EgtGeomKernel.rc and b/EgtGeomKernel.rc differ diff --git a/MC_Tables.h b/MC_Tables.h index 7106ee3..824a631 100644 --- a/MC_Tables.h +++ b/MC_Tables.h @@ -1246,7 +1246,7 @@ static int nAllConfig[256] = {/* 0 */ 0, /* 12 */ 2, /* 13 */ -1, /* 14 */ -1, - /* 15 */ -1, + /* 15 */ 8, /* 16 */ -1, /* 17 */ 2, /* 18 */ 3, @@ -1282,7 +1282,7 @@ static int nAllConfig[256] = {/* 0 */ 0, /* 48 */ 2, /* 49 */ -1, /* 50 */ -1, - /* 51 */ -1, + /* 51 */ 8, /* 52 */ 6, /* 53 */ -1, /* 54 */ -1, @@ -1333,7 +1333,7 @@ static int nAllConfig[256] = {/* 0 */ 0, /* 99 */ -1, /* 100 */ -1, /* 101 */ -1, - /* 102 */ -1, + /* 102 */ 8, /* 103 */ -1, /* 104 */ 6, /* 105 */ 10, @@ -1384,7 +1384,7 @@ static int nAllConfig[256] = {/* 0 */ 0, /* 150 */ 10, /* 151 */ 6, /* 152 */ -1, - /* 153 */ -1, + /* 153 */ 8, /* 154 */ -1, /* 155 */ -1, /* 156 */ -1, @@ -1435,7 +1435,7 @@ static int nAllConfig[256] = {/* 0 */ 0, /* 201 */ -1, /* 202 */ -1, /* 203 */ 6, - /* 204 */ -1, + /* 204 */ 8, /* 205 */ -1, /* 206 */ -1, /* 207 */ 2, @@ -1471,7 +1471,7 @@ static int nAllConfig[256] = {/* 0 */ 0, /* 237 */ 3, /* 238 */ 2, /* 239 */ -1, - /* 240 */ -1, + /* 240 */ 8, /* 241 */ -1, /* 242 */ -1, /* 243 */ 2, diff --git a/Tool.cpp b/Tool.cpp index 4d77586..5782277 100644 --- a/Tool.cpp +++ b/Tool.cpp @@ -26,7 +26,7 @@ using namespace std ; //---------------------------------------------------------------------------- Tool::Tool( void) - : m_dLinTol( 2 * LIN_TOL_STD), m_dAngTolDeg( ANG_TOL_APPROX_DEG), m_nType( UNDEF), m_nCurrentNum( 0), m_dHeight( 0), + : m_dLinTol( LIN_TOL_STD), m_dAngTolDeg( ANG_TOL_APPROX_DEG), m_nType( UNDEF), m_nCurrentNum( 0), m_dHeight( 0), m_dTipHeight( 0), m_dRadius( 0), m_dRCorner( 0), m_dTipRadius( 0), m_dMrtChsWidth( 0), m_dMrtChsThickness( 0) { } diff --git a/VolZmapGraphics.cpp b/VolZmapGraphics.cpp index 9c1aa52..37d54a5 100644 --- a/VolZmapGraphics.cpp +++ b/VolZmapGraphics.cpp @@ -699,7 +699,7 @@ VolZmap::GetTriangles( bool bAllBlocks, INTVECTOR& nModifiedBlocks, TRIA3DEXLIST for ( int nV = 0 ; nV < 3 ; ++ nV) { Vector3d vtNV = VecTriHold[t][t1].vCompoTria[t2][t3].GetVertexNorm( nV) ; bool bNormV = vtNV.IsNormalized() ; - if ( bNormN && bNormV && vtN * vtNV < 0.87) + if ( bNormN && bNormV && vtN * vtNV < 0.7) VecTriHold[t][t1].vCompoTria[t2][t3].SetVertexNorm( nV, vtN) ; } // aggiungo triangolo alla lista @@ -726,7 +726,7 @@ VolZmap::GetTriangles( bool bAllBlocks, INTVECTOR& nModifiedBlocks, TRIA3DEXLIST for ( int nV = 0 ; nV < 3 ; ++ nV) { Vector3d vtNV = InterBlockTria[t][t1].vCompoTria[t2][t3].GetVertexNorm( nV) ; bool bNormV = vtNV.IsNormalized() ; - if ( bNormN && bNormV && vtN * vtNV < 0.87) + if ( bNormN && bNormV && vtN * vtNV < 0.7) InterBlockTria[t][t1].vCompoTria[t2][t3].SetVertexNorm( nV, vtN) ; } // aggiungo triangolo alla lista @@ -1984,8 +1984,8 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DEXLIST& lstTria, TriHolder& triHold for ( int ni = 0 ; ni < nVertComp[nCompCount - 1] ; ++ ni) { int nj = ( ni + 1) % nVertComp[nCompCount - 1] ; if ( vtNorm[ni] * vtNorm[nj] > 0.92) { - Vector3d vtNI = ( 0.66 * vtNorm[ni] + 0.33 * vtNorm[nj]) ; - Vector3d vtNJ = ( 0.33 * vtNorm[ni] + 0.66 * vtNorm[nj]) ; + Vector3d vtNI = ( 0.6 * vtNorm[ni] + 0.4 * vtNorm[nj]) ; + Vector3d vtNJ = ( 0.4 * vtNorm[ni] + 0.6 * vtNorm[nj]) ; vtNorm[ni] = vtNI ; vtNorm[ni].Normalize() ; vtNorm[nj] = vtNJ ; @@ -2396,14 +2396,10 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DEXLIST& lstTria, TriHolder& triHold CurrentTriangle.Set( CompoTriVert[nCompCount - 1][TriIndex].ptInt, CompoTriVert[nCompCount - 1][TriIndex+1].ptInt, CompoTriVert[nCompCount - 1][TriIndex+2].ptInt) ; - // Setto il numero di utensile - int nTool0 = CompoTriVert[nCompCount - 1][TriIndex].nToolFlag ; - int nTool1 = CompoTriVert[nCompCount - 1][TriIndex+1].nToolFlag ; - int nTool2 = CompoTriVert[nCompCount - 1][TriIndex+2].nToolFlag ; - // Quoziento gli indici - nTool0 = Clamp( nTool0, -1, 1) ; - nTool1 = Clamp( nTool1, -1, 1) ; - nTool2 = Clamp( nTool2, -1, 1) ; + // Setto il numero di utensile (conta solo positivo, nullo o negativo) + int nTool0 = Clamp( CompoTriVert[nCompCount - 1][TriIndex].nToolFlag, -1, 1) ; + int nTool1 = Clamp( CompoTriVert[nCompCount - 1][TriIndex+1].nToolFlag, -1, 1) ; + int nTool2 = Clamp( CompoTriVert[nCompCount - 1][TriIndex+2].nToolFlag, -1, 1) ; // Setto il numero dei colori if ( nTool0 == nTool1 || nTool0 == nTool2) CurrentTriangle.SetGrade( nTool0) ; @@ -2413,8 +2409,7 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DEXLIST& lstTria, TriHolder& triHold if ( CurrentTriangle.Validate( true)) { for ( int nV = 0 ; nV < 3 ; ++ nV) { const Vector3d& vtVertNorm = CompoTriVert[nCompCount - 1][TriIndex+nV].vtNorm ; - // si puņ inserire controllo su normalizzazione di vtVertNorm - if ( CurrentTriangle.GetN() * vtVertNorm > 0.87) + if ( CurrentTriangle.GetN() * vtVertNorm > 0.5) CurrentTriangle.SetVertexNorm( nV, vtVertNorm) ; else CurrentTriangle.SetVertexNorm( nV, CurrentTriangle.GetN()) ; @@ -2444,6 +2439,7 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DEXLIST& lstTria, TriHolder& triHold // Standard MC else { + vector vTria ; // Costruzione dei triangoli for ( int TriIndex = 0; TriIndex < ( nVertComp[nCompCount - 1] - 2) * 3 ; TriIndex += 3) { // Il triangolo č pronto @@ -2463,20 +2459,32 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DEXLIST& lstTria, TriHolder& triHold if ( CurrentTriangle.Validate( true)) { for ( int nV = 0 ; nV < 3 ; ++ nV) { const Vector3d& vtVertNorm = CompoTriVert[nCompCount - 1][TriIndex+nV].vtNorm ; - if ( CurrentTriangle.GetN() * vtVertNorm > 0.87) + if ( CurrentTriangle.GetN() * vtVertNorm > 0.5) CurrentTriangle.SetVertexNorm( nV, vtVertNorm) ; else CurrentTriangle.SetVertexNorm( nV, CurrentTriangle.GetN()) ; } } - else - int qqq = 0 ; // si puņ inserire controllo sui colori per i casi 2 e 8 come per ext non confermato // Riporto le coordinate nel sistema in cui č immerso lo Zmap CurrentTriangle.ToGlob( m_MapFrame) ; // Aggiungo alla lista - lstTria.emplace_back( CurrentTriangle) ; + vTria.emplace_back( CurrentTriangle) ; } + // Controllo i colori di configurazioni 2 e 8 + if ( ( nAllConfig[nIndex] == 2 || nAllConfig[nIndex] == 8) && + vTria[0].GetN() * vTria[1].GetN() > 0.8) { + if ( vTria[0].GetGrade() < 0 || vTria[1].GetGrade() < 0) { + vTria[0].SetGrade( -1) ; + vTria[1].SetGrade( -1) ; + } + else if ( vTria[0].GetGrade() > 0 || vTria[1].GetGrade() > 0) { + vTria[0].SetGrade( 1) ; + vTria[1].SetGrade( 1) ; + } + } + for ( int nT = 0 ; nT < int( vTria.size()) ; ++ nT) + lstTria.emplace_back( vTria[nT]) ; } } }