EgtGeomKernel 1.8e3 :

- miglioramenti a Zmap (aggiunto blocco per triangoli di frontiera blocchi con possibilità di flip).
This commit is contained in:
Dario Sassi
2017-05-20 10:02:35 +00:00
parent 6faae39afd
commit 0a98461e3e
5 changed files with 1655 additions and 80 deletions
BIN
View File
Binary file not shown.
+9 -3
View File
@@ -75,7 +75,7 @@ VolZmap::Create( const Point3d& ptO, double dLengthX, double dLengthY, double dL
// Definisco il numero di blocchi lungo z
m_nFracLin[2] = max( nMinBlockNum,
m_nNy[1] / m_nDexNumPBlock +
( m_nNy[1] % m_nDexNumPBlock >= m_nDexNumPBlock / 2 ? 1 : 0)) ;
( m_nNy[1] % m_nDexNumPBlock >= m_nDexNumPBlock / 2 ? 1 : 0)) ;
}
else {
@@ -153,6 +153,8 @@ VolZmap::Create( const Point3d& ptO, double dLengthX, double dLengthY, double dL
for ( unsigned int nCount = 0 ; nCount < m_nNumBlock ; ++ nCount)
m_BlockToUpdate[nCount] = true ;
m_InterBlockTria.resize( m_nNumBlock) ;
// Aggiornamento dello stato
m_nStatus = OK ;
@@ -479,7 +481,9 @@ VolZmap::CreateFromFlatRegion( const ISurfFlatRegion& Surf, double dDimZ, double
for ( unsigned int nCount = 0 ; nCount < m_nNumBlock ; ++ nCount)
m_BlockToUpdate[nCount] = true ;
m_InterBlockTria.resize( m_nNumBlock) ;
// Aggiornamento dello stato
m_nStatus = OK ;
@@ -815,8 +819,10 @@ VolZmap::CreateFromTriMesh( const ISurfTriMesh& Surf, double dPrec, bool bFlag)
for ( unsigned int nCount = 0 ; nCount < m_nNumBlock ; ++ nCount)
m_BlockToUpdate[nCount] = true ;
m_BlockToUpdate[nCount] = true ;
m_InterBlockTria.resize( m_nNumBlock) ;
m_nStatus = OK ;
return true ;
+1586 -54
View File
File diff suppressed because it is too large Load Diff
+18 -18
View File
@@ -157,17 +157,17 @@ VolZmap::SubtractIntervals( unsigned int nGrid, unsigned int nI, unsigned int nJ
int nMaxZBlock = min( int( m_nFracLin[2] - 1), nMaxK / int( m_nDexNumPBlock)) ;
for ( int k = nMinZBlock ; k <= nMaxZBlock ; ++ k) {
for ( int nIndX = nXBlock - 1 ; nIndX <= nXBlock + 1 ; nIndX ++) {
for ( int nIndY = nYBlock - 1 ; nIndY <= nYBlock + 1 ; nIndY ++) {
/* for ( int nIndX = nXBlock - 1 ; nIndX <= nXBlock + 1 ; nIndX ++) {
for ( int nIndY = nYBlock - 1 ; nIndY <= nYBlock + 1 ; nIndY ++) {*/
if ( nIndX >= 0 && nIndX < int( m_nFracLin[0]) &&
nIndY >= 0 && nIndY < int( m_nFracLin[1])) {
/*if ( nIndX >= 0 && nIndX < int( m_nFracLin[0]) &&
nIndY >= 0 && nIndY < int( m_nFracLin[1])) {*/
int nBlockNum = k * nLayerBlock + nIndY * m_nFracLin[0] + nIndX ;
m_BlockToUpdate[nBlockNum] = true ;
}
int nBlockNum = k * nLayerBlock + nYBlock * m_nFracLin[0] + nXBlock ;
m_BlockToUpdate[nBlockNum] = true ;
/* }
}
}
}*/
}
}
else if ( nGrid == 1) {
@@ -182,17 +182,17 @@ VolZmap::SubtractIntervals( unsigned int nGrid, unsigned int nI, unsigned int nJ
int nMaxXBlock = min( int( m_nFracLin[0] - 1), nMaxI / int( m_nDexNumPBlock)) ;
for ( int k = nMinXBlock ; k <= nMaxXBlock ; ++ k) {
for( int nIndY = nYBlock - 1 ; nIndY <= nYBlock + 1 ; ++ nIndY) {
/* for( int nIndY = nYBlock - 1 ; nIndY <= nYBlock + 1 ; ++ nIndY) {
for ( int nIndZ = nZBlock - 1 ; nIndZ <= nZBlock + 1 ; ++ nIndZ) {
if ( nIndY >= 0 && nIndY < int( m_nFracLin[1]) &&
nIndZ >= 0 && nIndZ < int( m_nFracLin[2])) {
nIndZ >= 0 && nIndZ < int( m_nFracLin[2])) {*/
int nBlockNum = nIndZ * nLayerBlock + nIndY * m_nFracLin[0] + k ;
int nBlockNum = nZBlock * nLayerBlock + nYBlock * m_nFracLin[0] + k ;
m_BlockToUpdate[nBlockNum] = true ;
}
/* }
}
}
}*/
}
}
else if ( nGrid == 2) {
@@ -207,17 +207,17 @@ VolZmap::SubtractIntervals( unsigned int nGrid, unsigned int nI, unsigned int nJ
int nMaxYBlock = min( int( m_nFracLin[1] - 1), nMaxJ / int( m_nDexNumPBlock)) ;
for ( int k = nMinYBlock ; k <= nMaxYBlock ; ++ k) {
for ( int nIndX = nXBlock - 1 ; nIndX <= nXBlock + 1 ; ++ nIndX) {
/* for ( int nIndX = nXBlock - 1 ; nIndX <= nXBlock + 1 ; ++ nIndX) {
for ( int nIndZ = nZBlock - 1 ; nIndZ <= nZBlock + 1 ; ++ nIndZ) {
if ( nIndX >= 0 && nIndX < int( m_nFracLin[0]) &&
nIndZ >= 0 && nIndZ < int( m_nFracLin[2])) {
int nBlockNum = nIndZ * nLayerBlock + k * m_nFracLin[0] + nIndX ;
*/
int nBlockNum = nZBlock * nLayerBlock + k * m_nFracLin[0] + nXBlock ;
m_BlockToUpdate[nBlockNum] = true ;
}
/* }
}
}
}*/
}
}
+42 -5
View File
@@ -29,7 +29,29 @@ struct TriaStruct {
std::vector<Point3d> ptCompoVert ;
std::vector<TRIA3DVECTOR> vCompoTria ;
} ;
typedef std::vector <TriaStruct> TriHolder ;
// Vettore di TriaStruct con sharp fature interni a un blocco
typedef std::vector<TriaStruct> TriHolder ;
// Vettori di TriHolder con sharp feature di frontiera:
// il primo indice individua il blocco, il secondo il voxel
typedef std::vector<TriHolder> TriaMatrix ;
struct IndexStruct {
int i, j, k ;
} ;
typedef std::vector<std::vector<IndexStruct>> IndexMatrix ;
//struct BoundaryTriangle {
//
// int i, j, k ;
// int nCC ;
//
// Point3d ptVertex ;
//
// bool bInterBlockFlipping ;
//} ;
//----------------------------------------------------------------------------
class VolZmap : public IVolZmap, public IGeoObjRW
@@ -116,8 +138,13 @@ class VolZmap : public IVolZmap, public IGeoObjRW
const Vector3d& vtZ, const Vector3d& vtNorm, TRIA3DLIST& lstTria) const ;
bool MarchingCubes( TRIA3DLIST& lstTria) const ;
bool MarchingCubes( int nBlock, TRIA3DLIST& lstTria) const ;
bool ExtMarchingCubes( const int nLimits[], TRIA3DLIST& lstTria, TriHolder& triHold) const ;
bool FlipEdges( std::vector<TriHolder>& VecTriHold) const ;
bool ExtMarchingCubes( const int nLimits[], size_t nBlockNumber, TRIA3DLIST& lstTria, TriHolder& triHold) const ;
bool FlipEdges( TriaMatrix& VecTriHold) const ;
bool FlipEdgesII( TriHolder& TriHold) const ;
bool FlipEdgesBB( TriaMatrix& InterTria) const ;
bool FlipEdgesIB( TriHolder& InnerVox, size_t nBlock) const ;
bool FlipEdgesBB( size_t nCurBlock, size_t nAdjBlock) const ;
bool FlipEdgesIB( TriHolder& InnerVox, TriHolder& BoundaryVox) const ;
bool IsThereMat( int nI, int nJ, int nK) const ;
bool IsThereMat( const int nMatr[][3], int nNum, double & dHx, double & dHy, double & dHz) const ;
bool IntersPos( int nVec1[], int nVec2[], Point3d & ptInt) const ;
@@ -245,13 +272,21 @@ class VolZmap : public IVolZmap, public IGeoObjRW
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2) ;
// Funzioni di gestione dei blocchi
bool GetBlockIJK( int nBlock, int nIJK[]) const ;
bool GetBlockIJKFromN( int nBlock, int nIJK[]) const ;
bool GetBlockNFromIJK( int nIJK[], int& nBlock) const ;
bool GetBlockLimitsIJK( const int nIJK[], int nLimits[]) const ;
bool GetVoxelBlockIJK( const int nVoxIJK[], int nBlockIJK[]) const ;
bool GetAdjBlockToBlock( int nBlockN, int nDeltaI, int nDeltaJ, int nDeltaK, int& nAdjBlockN) const ;
bool IsAVoxelOnBoundary( const int nLimits[], const int nIJK[], bool bType) const ;
bool IsATriangleOnBorder( const Triangle3d& trTria, const Point3d& ptVert,
const int nBlockLimits[], const int nVoxIJK[]) const ;
bool IsATriangleOnBorder( const Triangle3d& trTria, const Point3d& ptVert,
const int nBlockLimits[], const int nVoxIJK[], bool bBorderBox) const ;
private :
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
static const int N_MAPS = 3 ;
static const int N_DEXBLOCK = 32 ; // 10000 ;//20 ;//32 ;
static const int N_DEXBLOCK = 32 ; // 10000 ; // 20 ; // 32 ;
private :
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
@@ -290,6 +325,8 @@ class VolZmap : public IVolZmap, public IGeoObjRW
double m_dRadius ;
double m_dRCorner ;
double m_dTipRadius ;
mutable TriaMatrix m_InterBlockTria ;
} ;