EgtGeomKernel 1.6x2 :
- modifiche a Zmap per tridexel.
This commit is contained in:
Binary file not shown.
@@ -357,12 +357,12 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="Triangulate.cpp" />
|
||||
<ClCompile Include="Vector3d.cpp" />
|
||||
<ClCompile Include="NgeWriter.cpp" />
|
||||
<ClCompile Include="VolTriZmapCalculus.cpp" />
|
||||
<ClCompile Include="VolTriZmapCreation.cpp" />
|
||||
<ClCompile Include="VolTriZmapGraphics.cpp" />
|
||||
<ClCompile Include="VolTriZmapVolume.cpp" />
|
||||
<ClCompile Include="VolZmap.cpp" />
|
||||
<ClCompile Include="VolZmapCalculus.cpp" />
|
||||
<ClCompile Include="VolZmapCreation.cpp" />
|
||||
<ClCompile Include="VolZmapGraphics.cpp" />
|
||||
<ClCompile Include="VolZmapTool.cpp" />
|
||||
<ClCompile Include="VolZmapVolume.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Include\EGkAngle.h" />
|
||||
|
||||
@@ -339,19 +339,19 @@
|
||||
<ClCompile Include="CDBoxTria.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VolZmapCalculus.cpp">
|
||||
<Filter>File di origine\Geo</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VolZmapCreation.cpp">
|
||||
<Filter>File di origine\Geo</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VolZmapGraphics.cpp">
|
||||
<Filter>File di origine\Geo</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VolZmapTool.cpp">
|
||||
<Filter>File di origine\Geo</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VolZmapVolume.cpp">
|
||||
<ClCompile Include="VolTriZmapCalculus.cpp">
|
||||
<Filter>File di origine\Geo</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VolTriZmapCreation.cpp">
|
||||
<Filter>File di origine\Geo</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VolTriZmapGraphics.cpp">
|
||||
<Filter>File di origine\Geo</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VolTriZmapVolume.cpp">
|
||||
<Filter>File di origine\Geo</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
||||
+45
-24
@@ -2610,8 +2610,8 @@ GdbExecutor::ExecuteVolZmap(const string& sCmd2, const STRVECTOR& vsParams)
|
||||
bool
|
||||
GdbExecutor::VolZmapCreate( const STRVECTOR& vsParams)
|
||||
{
|
||||
// parametri : Id, IdParent, ptO, dPrec, dLengthX, dLengthY, dLengthZ
|
||||
if ( vsParams.size() != 7)
|
||||
// parametri : Id, IdParent, ptO, dLengthX, dLengthY, dLengthZ, dPrec [, bTriDexel]
|
||||
if ( vsParams.size() < 7)
|
||||
return false ;
|
||||
// recupero il riferimento in cui è immerso
|
||||
Frame3d frRef ;
|
||||
@@ -2621,27 +2621,32 @@ GdbExecutor::VolZmapCreate( const STRVECTOR& vsParams)
|
||||
Point3d ptO ;
|
||||
if ( ! GetPointParam( vsParams[2], frRef, ptO))
|
||||
return false ;
|
||||
// recupero precisione
|
||||
double dPrec ;
|
||||
if ( ! FromString( vsParams[3], dPrec))
|
||||
return false ;
|
||||
// recupero LunghezzaX
|
||||
double dLengthX ;
|
||||
if ( ! FromString( vsParams[4], dLengthX))
|
||||
if ( ! FromString( vsParams[3], dLengthX))
|
||||
return false ;
|
||||
// recupero LunghezzaY
|
||||
double dLengthY ;
|
||||
if ( ! FromString( vsParams[5], dLengthY))
|
||||
if ( ! FromString( vsParams[4], dLengthY))
|
||||
return false ;
|
||||
// recupero LunghezzaZ
|
||||
double dLengthZ ;
|
||||
if ( ! FromString( vsParams[6], dLengthZ))
|
||||
if ( ! FromString( vsParams[5], dLengthZ))
|
||||
return false ;
|
||||
// recupero precisione
|
||||
double dPrec ;
|
||||
if ( ! FromString( vsParams[6], dPrec))
|
||||
return false ;
|
||||
// recupero flag tipo Zmap
|
||||
bool bTriDexel = false ;
|
||||
if ( vsParams.size() >= 8 && vsParams[7] != "0")
|
||||
bTriDexel = true ;
|
||||
|
||||
// creo Zmap
|
||||
PtrOwner<VolZmap> pZprova( new VolZmap) ;
|
||||
pZprova->Create( ptO, dLengthX, dLengthY, dLengthZ, dPrec);
|
||||
pZprova->Create( ptO, dLengthX, dLengthY, dLengthZ, dPrec, bTriDexel) ;
|
||||
|
||||
// inserisco nel DB
|
||||
// inserisco nel DB
|
||||
return AddGeoObj(vsParams[0], vsParams[1], Release( pZprova)) ;
|
||||
}
|
||||
|
||||
@@ -2649,8 +2654,8 @@ GdbExecutor::VolZmapCreate( const STRVECTOR& vsParams)
|
||||
bool
|
||||
GdbExecutor::VolZmapCreateFromFlatRegion( const STRVECTOR& vsParams)
|
||||
{
|
||||
// parametri : Id, IdParent, idCurv, dPrec, dLengthZ
|
||||
if ( vsParams.size() != 5)
|
||||
// parametri : Id, IdParent, idCurv, dPrec, dLengthZ [, bTriDexel]
|
||||
if ( vsParams.size() < 5)
|
||||
return false ;
|
||||
// recupero il riferimento in cui è immerso
|
||||
Frame3d frRef ;
|
||||
@@ -2658,21 +2663,26 @@ GdbExecutor::VolZmapCreateFromFlatRegion( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
// recupero id flatregion
|
||||
int nIdFlat = GetIdParam( vsParams[2]) ;
|
||||
// recupero precisione
|
||||
double dPrec ;
|
||||
if ( ! FromString( vsParams[4], dPrec))
|
||||
return false ;
|
||||
// recupero dimensioneZ
|
||||
double dLengthZ ;
|
||||
if ( ! FromString( vsParams[3], dLengthZ))
|
||||
return false ;
|
||||
// recupero precisione
|
||||
double dPrec ;
|
||||
if ( ! FromString( vsParams[4], dPrec))
|
||||
return false ;
|
||||
// recupero puntatore a FlatRegion
|
||||
ISurfFlatRegion* pRegion = GetSurfFlatRegion( m_pGDB->GetGeoObj( nIdFlat)) ;
|
||||
if ( pRegion == nullptr)
|
||||
return false ;
|
||||
// Flag tipo di mappa
|
||||
bool bTriDexel = false ;
|
||||
if ( vsParams.size() >= 6 && vsParams[5] != "0")
|
||||
bTriDexel = true ;
|
||||
|
||||
// creo Zmap
|
||||
PtrOwner<VolZmap> pZprova( new VolZmap) ;
|
||||
pZprova->CreateFromFlatRegion( *pRegion, dLengthZ, dPrec);
|
||||
pZprova->CreateFromFlatRegion( *pRegion, dLengthZ, dPrec, bTriDexel) ;
|
||||
|
||||
// inserisco nel DB
|
||||
return AddGeoObj(vsParams[0], vsParams[1], Release( pZprova)) ;
|
||||
@@ -2682,8 +2692,8 @@ GdbExecutor::VolZmapCreateFromFlatRegion( const STRVECTOR& vsParams)
|
||||
bool
|
||||
GdbExecutor::VolZmapCreateFromTriMesh( const STRVECTOR& vsParams)
|
||||
{
|
||||
// parametri : Id, IdParent, idSurf, dPrec
|
||||
if ( vsParams.size() != 4)
|
||||
// parametri : Id, IdParent, idSurf, dPrec, bFlag
|
||||
if ( vsParams.size() != 5)
|
||||
return false ;
|
||||
// recupero il riferimento in cui è immerso
|
||||
Frame3d frRef ;
|
||||
@@ -2695,13 +2705,17 @@ GdbExecutor::VolZmapCreateFromTriMesh( const STRVECTOR& vsParams)
|
||||
double dPrec ;
|
||||
if ( ! FromString( vsParams[3], dPrec))
|
||||
return false ;
|
||||
// Flag tipo di mappa
|
||||
bool bType= false ;
|
||||
if ( vsParams.size() >= 5 && vsParams[4] != "0")
|
||||
bType = true ;
|
||||
// recupero puntatore a Trimesh
|
||||
SurfTriMesh* pSurf = GetBasicSurfTriMesh( m_pGDB->GetGeoObj( nIdSurf)) ;
|
||||
if ( pSurf == nullptr)
|
||||
return false ;
|
||||
// creo Zmap
|
||||
PtrOwner<VolZmap> pZprova( new VolZmap) ;
|
||||
pZprova->CreateFromTriMesh( * pSurf, dPrec);
|
||||
pZprova->CreateFromTriMesh( * pSurf, dPrec, bType) ;
|
||||
|
||||
// inserisco nel DB
|
||||
return AddGeoObj(vsParams[0], vsParams[1], Release( pZprova)) ;
|
||||
@@ -2711,8 +2725,8 @@ GdbExecutor::VolZmapCreateFromTriMesh( const STRVECTOR& vsParams)
|
||||
bool
|
||||
GdbExecutor::VolZmapMilling( const STRVECTOR& vsParams)
|
||||
{
|
||||
// parametri : Id, IdParent, ptPs, ptPe, vtVs, vtVe, dLinTol, dAngTolDeg (gli ultimi due servono per lavorazione con utensile generico)
|
||||
if ( vsParams.size() != 8)
|
||||
// parametri : Id, IdParent, ptPs, ptPe, vtVs, vtVe, dLinTol, dAngTolDeg (dLinTol e dAngTol sono per lavo con gen tool), bType
|
||||
if ( vsParams.size() != 9)
|
||||
return false ;
|
||||
// recupero il riferimento in cui è immerso
|
||||
Frame3d frRef ;
|
||||
@@ -2741,6 +2755,10 @@ GdbExecutor::VolZmapMilling( const STRVECTOR& vsParams)
|
||||
double dAngTolDeg ;
|
||||
if ( ! FromString( vsParams[7], dAngTolDeg))
|
||||
return false ;
|
||||
bool bType = false ;
|
||||
if ( vsParams.size() >= 9 && vsParams[2] != "0")
|
||||
bType = true ;
|
||||
|
||||
// recupero lo Zmap
|
||||
int nIdZmap = GetIdParam( vsParams[0]) ;
|
||||
VolZmap* pZmap = GetBasicVolZmap( m_pGDB->GetGeoObj( nIdZmap)) ;
|
||||
@@ -2748,7 +2766,10 @@ GdbExecutor::VolZmapMilling( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
// eseguo la lavorazione
|
||||
pZmap->SetTolerances( dLinTol, dAngTolDeg) ;
|
||||
return pZmap->MillingStep( ptPs, vtDs, ptPe, vtDe) ;
|
||||
//if ( bType)
|
||||
return pZmap->MillingStep( ptPs, vtDs, ptPe, vtDe) ;
|
||||
//else
|
||||
// return pZmap->MillingStep( ptPs, vtDs, ptPe, vtDe) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+298
@@ -0,0 +1,298 @@
|
||||
|
||||
// Tabella segmenti
|
||||
static int EdgeTable[256] = {
|
||||
|
||||
0x0 , 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,
|
||||
0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,
|
||||
0x190, 0x99 , 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,
|
||||
0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,
|
||||
0x230, 0x339, 0x33 , 0x13a, 0x636, 0x73f, 0x435, 0x53c,
|
||||
0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30,
|
||||
0x3a0, 0x2a9, 0x1a3, 0xaa , 0x7a6, 0x6af, 0x5a5, 0x4ac,
|
||||
0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0,
|
||||
0x460, 0x569, 0x663, 0x76a, 0x66 , 0x16f, 0x265, 0x36c,
|
||||
0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60,
|
||||
0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff , 0x3f5, 0x2fc,
|
||||
0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0,
|
||||
0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55 , 0x15c,
|
||||
0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950,
|
||||
0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc ,
|
||||
0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0,
|
||||
0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc,
|
||||
0xcc , 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0,
|
||||
0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c,
|
||||
0x15c, 0x55 , 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650,
|
||||
0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc,
|
||||
0x2fc, 0x3f5, 0xff , 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0,
|
||||
0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c,
|
||||
0x36c, 0x265, 0x16f, 0x66 , 0x76a, 0x663, 0x569, 0x460,
|
||||
0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac,
|
||||
0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa , 0x1a3, 0x2a9, 0x3a0,
|
||||
0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,
|
||||
0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33 , 0x339, 0x230,
|
||||
0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,
|
||||
0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99 , 0x190,
|
||||
0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,
|
||||
0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0
|
||||
} ;
|
||||
|
||||
// Tabella triangoli
|
||||
static int TriangleTable[256][16] = {
|
||||
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1},
|
||||
{3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1},
|
||||
{3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1},
|
||||
{3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1},
|
||||
{2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1},
|
||||
{8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1},
|
||||
{4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1},
|
||||
{3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1},
|
||||
{4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1},
|
||||
{4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1},
|
||||
{5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1},
|
||||
{2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1},
|
||||
{9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1},
|
||||
{2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1},
|
||||
{10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1},
|
||||
{4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1},
|
||||
{5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1},
|
||||
{5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1},
|
||||
{10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1},
|
||||
{8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1},
|
||||
{2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1},
|
||||
{7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1},
|
||||
{2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1},
|
||||
{11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1},
|
||||
{5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1},
|
||||
{11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1},
|
||||
{11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1},
|
||||
{5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1},
|
||||
{2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1},
|
||||
{5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1},
|
||||
{6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1},
|
||||
{3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1},
|
||||
{6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1},
|
||||
{5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1},
|
||||
{10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1},
|
||||
{6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1},
|
||||
{8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1},
|
||||
{7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1},
|
||||
{3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1},
|
||||
{5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1},
|
||||
{0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1},
|
||||
{9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1},
|
||||
{8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1},
|
||||
{5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1},
|
||||
{0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1},
|
||||
{6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1},
|
||||
{10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1},
|
||||
{10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1},
|
||||
{8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1},
|
||||
{1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1},
|
||||
{3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1},
|
||||
{0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1},
|
||||
{10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1},
|
||||
{3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1},
|
||||
{6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1},
|
||||
{9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1},
|
||||
{8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1},
|
||||
{3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1},
|
||||
{6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1},
|
||||
{10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1},
|
||||
{10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1},
|
||||
{2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1},
|
||||
{7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1},
|
||||
{7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1},
|
||||
{2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1},
|
||||
{1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1},
|
||||
{11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1},
|
||||
{8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1},
|
||||
{0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1},
|
||||
{7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1},
|
||||
{10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1},
|
||||
{2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1},
|
||||
{6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1},
|
||||
{7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1},
|
||||
{2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1},
|
||||
{10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1},
|
||||
{10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1},
|
||||
{0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1},
|
||||
{7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1},
|
||||
{6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1},
|
||||
{8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1},
|
||||
{6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1},
|
||||
{4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1},
|
||||
{10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1},
|
||||
{8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1},
|
||||
{1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1},
|
||||
{8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1},
|
||||
{10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1},
|
||||
{4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1},
|
||||
{10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1},
|
||||
{5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1},
|
||||
{11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1},
|
||||
{9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1},
|
||||
{6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1},
|
||||
{7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1},
|
||||
{3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1},
|
||||
{7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1},
|
||||
{3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1},
|
||||
{6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1},
|
||||
{9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1},
|
||||
{1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1},
|
||||
{4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1},
|
||||
{7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1},
|
||||
{6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1},
|
||||
{3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1},
|
||||
{0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1},
|
||||
{6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1},
|
||||
{0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1},
|
||||
{11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1},
|
||||
{6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1},
|
||||
{5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1},
|
||||
{9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1},
|
||||
{1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1},
|
||||
{10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1},
|
||||
{0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1},
|
||||
{5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1},
|
||||
{10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1},
|
||||
{11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1},
|
||||
{9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1},
|
||||
{7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1},
|
||||
{2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1},
|
||||
{8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1},
|
||||
{9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1},
|
||||
{9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1},
|
||||
{1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1},
|
||||
{5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1},
|
||||
{0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1},
|
||||
{10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1},
|
||||
{2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1},
|
||||
{0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1},
|
||||
{0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1},
|
||||
{9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1},
|
||||
{5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1},
|
||||
{3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1},
|
||||
{5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1},
|
||||
{8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1},
|
||||
{9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1},
|
||||
{1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1},
|
||||
{3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1},
|
||||
{4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1},
|
||||
{9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1},
|
||||
{11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1},
|
||||
{11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1},
|
||||
{2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1},
|
||||
{9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1},
|
||||
{3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1},
|
||||
{1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1},
|
||||
{4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1},
|
||||
{4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1},
|
||||
{3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1},
|
||||
{3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1},
|
||||
{0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1},
|
||||
{9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1},
|
||||
{1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}
|
||||
} ;
|
||||
@@ -0,0 +1,736 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2016
|
||||
//----------------------------------------------------------------------------
|
||||
// File : VolZmap.cpp Data : 22.01.15 Versione : 1.6a4
|
||||
// Contenuto : Implementazione della classe Volume Zmap (tre griglie)
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 22.01.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "CurveLine.h"
|
||||
#include "VolZmap.h"
|
||||
#include "GeoConst.h"
|
||||
#include "IntersLineSurfTm.h"
|
||||
#include "\EgtDev\Include\EgtNumUtils.h"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::IntersLineBox( const Point3d& ptP, const Vector3d& vtV,
|
||||
const Point3d& ptMin, const Point3d& ptMax, double& dU1, double& dU2)
|
||||
{
|
||||
// Il box è allineato agli assi
|
||||
|
||||
dU1 = - INFINITO ;
|
||||
dU2 = INFINITO ;
|
||||
|
||||
// confronto con piani YZ (perpendicolari ad asse X)
|
||||
if ( vtV.x > EPS_ZERO) {
|
||||
dU1 = max( dU1, ( ptMin.x - ptP.x) / vtV.x) ;
|
||||
dU2 = min( dU2, ( ptMax.x - ptP.x) / vtV.x) ;
|
||||
}
|
||||
else if ( vtV.x < - EPS_ZERO) {
|
||||
dU1 = max( dU1, ( ptMax.x - ptP.x) / vtV.x) ;
|
||||
dU2 = min( dU2, ( ptMin.x - ptP.x) / vtV.x) ;
|
||||
}
|
||||
else if ( ptP.x < ptMin.x - EPS_SMALL || ptP.x > ptMax.x + EPS_SMALL)
|
||||
return false ;
|
||||
|
||||
// confronto con piani ZX (perpendicolari ad asse Y)
|
||||
if ( vtV.y > EPS_ZERO) {
|
||||
dU1 = max( dU1, ( ptMin.y - ptP.y) / vtV.y) ;
|
||||
dU2 = min( dU2, ( ptMax.y - ptP.y) / vtV.y) ;
|
||||
}
|
||||
else if ( vtV.y < - EPS_ZERO) {
|
||||
dU1 = max( dU1, ( ptMax.y - ptP.y) / vtV.y) ;
|
||||
dU2 = min( dU2, ( ptMin.y - ptP.y) / vtV.y) ;
|
||||
}
|
||||
else if ( ptP.y < ptMin.y - EPS_SMALL || ptP.y > ptMax.y + EPS_SMALL)
|
||||
return false ;
|
||||
|
||||
// confronto con piani XZ (perpendicolari ad asse Z)
|
||||
if ( vtV.z > EPS_ZERO) {
|
||||
dU1 = max( dU1, ( ptMin.z - ptP.z) / vtV.z) ;
|
||||
dU2 = min( dU2, ( ptMax.z - ptP.z) / vtV.z) ;
|
||||
}
|
||||
else if ( vtV.z < - EPS_ZERO) {
|
||||
dU1 = max( dU1, ( ptMax.z - ptP.z) / vtV.z) ;
|
||||
dU2 = min( dU2, ( ptMin.z - ptP.z) / vtV.z) ;
|
||||
}
|
||||
else if ( ptP.z < ptMin.z - EPS_SMALL || ptP.z > ptMax.z + EPS_SMALL)
|
||||
return false ;
|
||||
|
||||
return ( dU2 >= dU1) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::IntersLineZMapBBox( unsigned int nGrid, const Point3d& ptP, const Vector3d& vtV, double& dU1, double& dU2)
|
||||
{
|
||||
// Punti estremi del box dello Zmap
|
||||
Point3d ptMin = ORIG ;
|
||||
Point3d ptMax = ptMin + Vector3d( m_nVNx[nGrid] * m_dStep, m_nVNy[nGrid] * m_dStep, m_dVMaxZ[nGrid]) ;
|
||||
|
||||
return ( IntersLineBox( ptP, vtV, ptMin, ptMax, dU1, dU2) && ( dU1 > 0 || dU2 > 0)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::IntersLineDexel( unsigned int nGrid, const Point3d& ptP, const Vector3d& vtV, unsigned int nI,
|
||||
unsigned int nJ, double& dU1, double& dU2)
|
||||
{
|
||||
// Determino l'indice del dexel e il doppio del numero di suo intervalli
|
||||
unsigned int nDexelPos = nJ * m_nVNx[nGrid] + nI ;
|
||||
unsigned int nDexelSize = unsigned int( m_TriZValues[nGrid][nDexelPos].size()) ;
|
||||
|
||||
// Se non c'è materiale non devo fare alcunché
|
||||
if ( nDexelSize == 0)
|
||||
return false ;
|
||||
|
||||
// Determino estremi nel piano XY intrinseco del dexel
|
||||
double dXmin = nI * m_dStep ;
|
||||
double dYmin = nJ * m_dStep ;
|
||||
double dXmax = ( nI + 1) * m_dStep ;
|
||||
double dYmax = ( nJ + 1) * m_dStep ;
|
||||
|
||||
// ciclo sugli intervalli
|
||||
dU1 = INFINITO ;
|
||||
dU2 = - INFINITO ;
|
||||
bool bInters = false ;
|
||||
for ( unsigned int nIndex = 0 ; nIndex < nDexelSize ; nIndex += 2) {
|
||||
// estremi del box del singolo intervallo
|
||||
Point3d ptE1( dXmin, dYmin, m_TriZValues[nGrid][nDexelPos][nIndex]) ;
|
||||
Point3d ptE2( dXmax, dYmax, m_TriZValues[nGrid][nDexelPos][nIndex+1]) ;
|
||||
double dt1, dt2 ;
|
||||
if ( IntersLineBox( ptP, vtV, ptE1, ptE2, dt1, dt2)) {
|
||||
bInters = true ;
|
||||
dU1 = min( dU1, dt1) ;
|
||||
dU2 = max( dU2, dt2) ;
|
||||
}
|
||||
}
|
||||
|
||||
return bInters ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::GetDepth( const Point3d& ptPGlob, const Vector3d& vtDir, double& dInLength, double& dOutLength)
|
||||
{
|
||||
// Porto il raggio nel riferimento intrinseco
|
||||
Point3d ptP = ptPGlob ;
|
||||
ptP.ToLoc( m_MapFrame[0]) ;
|
||||
Vector3d vtV = vtDir ;
|
||||
vtV.ToLoc( m_MapFrame[0]) ;
|
||||
vtV.Normalize() ;
|
||||
|
||||
// Studio dell'intersezione fra semiretta e BBox dello Zmap
|
||||
double dU1, dU2 ;
|
||||
bool bTest = IntersLineZMapBBox( 0, ptP, vtV, dU1, dU2) ;
|
||||
|
||||
// Semiretta esterna al box dello Zmap
|
||||
if ( ! bTest) {
|
||||
dInLength = - 2 ;
|
||||
dOutLength = - 2 ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
Point3d ptI, ptF ;
|
||||
// Una sola intersezione valida ( punto interno, intersezione valida 2)
|
||||
if ( dU1 < 0 && dU2 > 0) {
|
||||
ptI = ptP ;
|
||||
ptF = ptP + dU2 * vtV ;
|
||||
}
|
||||
// due soluzioni valide ( punto esterno)
|
||||
else {
|
||||
ptI = ptP + dU1 * vtV ;
|
||||
ptF = ptP + dU2 * vtV ;
|
||||
}
|
||||
|
||||
// Determinazione degli indici i j dei punti ptI e ptF
|
||||
int nIi = Clamp( int( floor( ptI.x / m_dStep)), 0, m_nVNx[0] - 1) ;
|
||||
int nIj = Clamp( int( floor( ptI.y / m_dStep)), 0, m_nVNy[0] - 1) ;
|
||||
int nFi = Clamp( int( floor( ptF.x / m_dStep)), 0, m_nVNx[0] - 1) ;
|
||||
int nFj = Clamp( int( floor( ptF.y / m_dStep)), 0, m_nVNy[0] - 1) ;
|
||||
|
||||
// Inizializzo distanze
|
||||
dInLength = INFINITO ;
|
||||
dOutLength = - INFINITO ;
|
||||
|
||||
// Variazioni
|
||||
double dDeltaX = ptF.x - ptI.x ;
|
||||
double dDeltaY = ptF.y - ptI.y ;
|
||||
|
||||
// se inclinazione da asse X minore di 45 gradi (in assoluto)
|
||||
if ( abs( dDeltaY) <= abs( dDeltaX)) {
|
||||
// mi muovo lungo X (i)
|
||||
int nIncrI = ( nFi >= nIi ? 1 : - 1) ;
|
||||
for ( int i = nIi, j = nIj ;
|
||||
i != nFi + nIncrI ;
|
||||
i += nIncrI) {
|
||||
|
||||
// Controllo con nuovo i e j corrente (considero il bordo sinistro del dexel)
|
||||
double dU1, dU2 ;
|
||||
if ( IntersLineDexel( 0, ptP, vtV, i, j, dU1, dU2)) {
|
||||
dInLength = min( dInLength, dU1) ;
|
||||
dOutLength = max( dOutLength, dU2) ;
|
||||
}
|
||||
|
||||
// Mi sposto sul bordo destro del dexel
|
||||
double dMoveX = ( ( i + max( nIncrI, 0)) * m_dStep - ptI.x) ;
|
||||
double dMoveY = dMoveX * dDeltaY / dDeltaX ;
|
||||
double dY = ptI.y + dMoveY ;
|
||||
int OldJ = j ;
|
||||
j = Clamp( int( floor( dY / m_dStep)), 0, m_nVNy[0] - 1) ;
|
||||
|
||||
// Analisi del dexel
|
||||
if ( j != OldJ) {
|
||||
double dU1, dU2 ;
|
||||
if ( IntersLineDexel( 0, ptP, vtV, i, j, dU1, dU2)) {
|
||||
dInLength = min( dInLength, dU1) ;
|
||||
dOutLength = max( dOutLength, dU2) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// altrimenti
|
||||
else {
|
||||
// mi muovo lungo Y (j)
|
||||
int nIncrJ = ( nFj >= nIj ? 1 : - 1) ;
|
||||
for ( int i = nIi, j = nIj ;
|
||||
j != nFj + nIncrJ ;
|
||||
j += nIncrJ) {
|
||||
|
||||
// Controllo con nuovo j e i corrente (considero il bordo sotto del dexel)
|
||||
double dU1, dU2 ;
|
||||
if ( IntersLineDexel( 0, ptP, vtV, i, j, dU1, dU2)) {
|
||||
dInLength = min( dInLength, dU1) ;
|
||||
dOutLength = max( dOutLength, dU2) ;
|
||||
}
|
||||
|
||||
// Mi sposto sul bordo sopra del dexel
|
||||
double dMoveY = ( ( j + max( nIncrJ, 0)) * m_dStep - ptI.y) ;
|
||||
double dMoveX = dMoveY * dDeltaX / dDeltaY ;
|
||||
double dX = ptI.x + dMoveX ;
|
||||
int OldI = i ;
|
||||
i = Clamp( int( floor( dX / m_dStep)), 0, m_nVNx[0] - 1) ;
|
||||
|
||||
// Analisi del dexel
|
||||
if ( i != OldI) {
|
||||
double dU1, dU2 ;
|
||||
if ( IntersLineDexel( 0, ptP, vtV, i, j, dU1, dU2)) {
|
||||
dInLength = min( dInLength, dU1) ;
|
||||
dOutLength = max( dOutLength, dU2) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Se non abbiamo incontrato materiale
|
||||
if ( dInLength > dOutLength - EPS_SMALL) {
|
||||
dInLength = - 2 ;
|
||||
dOutLength = - 2 ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
// Se parto dall'interno
|
||||
if ( dInLength < - EPS_SMALL)
|
||||
dInLength = - 1 ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::AvoidBox( const Frame3d& frBox, const Vector3d& vtDiag)
|
||||
{
|
||||
// BBox
|
||||
BBox3d b3Box( ORIG, ORIG + vtDiag) ;
|
||||
|
||||
// lo porto nel riferimento intrinseco dello Zmap
|
||||
b3Box.LocToLoc( frBox, m_MapFrame[0]) ;
|
||||
|
||||
// BBox dello Zmap nel suo riferimento intrinseco
|
||||
BBox3d b3Zmap( ORIG, Point3d( m_nVNx[0] * m_dStep, m_nVNy[0] * m_dStep, m_dVMaxZ[0])) ;
|
||||
|
||||
// Se non interferiscono, posso uscire
|
||||
BBox3d b3Int ;
|
||||
if ( ! b3Zmap.FindIntersection( b3Box, b3Int))
|
||||
return true ;
|
||||
|
||||
// Limiti su indici
|
||||
int nStI = Clamp( int( b3Int.GetMin().x / m_dStep), 0, m_nVNx[0] -1) ;
|
||||
int nEnI = Clamp( int( b3Int.GetMax().x / m_dStep), 0, m_nVNx[0] -1) ;
|
||||
int nStJ = Clamp( int( b3Int.GetMin().y / m_dStep), 0, m_nVNy[0] -1) ;
|
||||
int nEnJ = Clamp( int( b3Int.GetMax().y / m_dStep), 0, m_nVNy[0] -1) ;
|
||||
|
||||
// Vettore direzione dei dexel nel riferimento del Box
|
||||
Vector3d vtK = Z_AX ; vtK.LocToLoc( m_MapFrame[0], frBox) ;
|
||||
|
||||
// Riferimento intrinseco dei dexel nel riferimento del box
|
||||
Point3d ptO = ORIG ; ptO.LocToLoc( m_MapFrame[0], frBox) ;
|
||||
Vector3d vtX = X_AX ; vtX.LocToLoc( m_MapFrame[0], frBox) ;
|
||||
Vector3d vtY = Y_AX ; vtY.LocToLoc( m_MapFrame[0], frBox) ;
|
||||
|
||||
// Ciclo di intersezione dei dexel con il BBox
|
||||
for ( int i = nStI ; i <= nEnI ; ++ i) {
|
||||
|
||||
for ( int j = nStJ ; j <= nEnJ ; ++ j) {
|
||||
|
||||
int nPos = j * m_nVNx[0] + i ;
|
||||
int nSize = int( m_TriZValues[0][nPos].size()) ;
|
||||
if ( nSize == 0)
|
||||
continue ;
|
||||
|
||||
Point3d ptC = ptO + ( i + 0.5) * m_dStep * vtX + ( j + 0.5) * m_dStep * vtY ;
|
||||
|
||||
double dZmin, dZmax ;
|
||||
if ( IntersLineBox( ptC, vtK, ORIG, ORIG + vtDiag, dZmin, dZmax)) {
|
||||
|
||||
for ( int nIndex = 0 ; nIndex < nSize ; nIndex += 2) {
|
||||
if ( ! ( dZmax < m_TriZValues[0][nPos][nIndex] - EPS_SMALL ||
|
||||
dZmin > m_TriZValues[0][nPos][nIndex + 1] + EPS_SMALL))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::IntersLineCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
||||
const Frame3d& CylFrame, double dL, double dR,
|
||||
Point3d& ptInt1, Point3d& ptInt2)
|
||||
{
|
||||
// NB: L'origine del sistema di riferimento deve essere
|
||||
// nel centro della circonferenza di base e l'asse di simmetria
|
||||
// deve coincidere con l'asse x.
|
||||
// La funzione restituisce true in caso di intersezione,
|
||||
// false altrimenti.
|
||||
|
||||
Point3d ptP = ptLineSt ;
|
||||
Vector3d vtV = vtLineDir ;
|
||||
|
||||
// Trasformazione delle coordinate
|
||||
ptP.ToLoc( CylFrame) ;
|
||||
vtV.ToLoc( CylFrame) ;
|
||||
|
||||
DBLVECTOR vdCoef(3) ;
|
||||
DBLVECTOR vdRoots ;
|
||||
|
||||
double dSqRad = dR * dR ;
|
||||
|
||||
vdCoef[0] = ptP.y * ptP.y + ptP.z * ptP.z - dSqRad ;
|
||||
vdCoef[1] = 2 * ( ptP.y * vtV.y + ptP.z * vtV.z) ;
|
||||
vdCoef[2] = vtV.y * vtV.y + vtV.z * vtV.z ;
|
||||
|
||||
// Computo radici
|
||||
int nRoot = PolynomialRoots( 2, vdCoef, vdRoots) ;
|
||||
|
||||
// Nessuna soluzione
|
||||
if ( nRoot == 0) {
|
||||
|
||||
if ( abs( vtV.x) > EPS_ZERO) {
|
||||
|
||||
ptInt1 = ptP - ( ptP.x / vtV.x) * vtV ;
|
||||
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
|
||||
|
||||
if ( ptInt1.y * ptInt1.y + ptInt1.z * ptInt1.z <= dSqRad &&
|
||||
ptInt2.y * ptInt2.y + ptInt2.z * ptInt2.z <= dSqRad) {
|
||||
|
||||
ptInt1.ToGlob( CylFrame) ;
|
||||
ptInt2.ToGlob( CylFrame) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
// Nessuna intersezione
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
// Nessuna intersezione
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
// L'equazione ammette o due soluzioni (eventualmente
|
||||
// coincidenti) oppure nessuna o infinite se la la retta
|
||||
// appartiene alla superficie
|
||||
|
||||
if ( nRoot == 2) {
|
||||
|
||||
ptInt1 = ptP + vdRoots[0] * vtV ;
|
||||
ptInt2 = ptP + vdRoots[1] * vtV ;
|
||||
|
||||
if ( ptInt1.x > ptInt2.x)
|
||||
swap( ptInt1, ptInt2) ;
|
||||
|
||||
if ( ptInt1.x < 0 && ptInt2.x >= 0 && ptInt2.x <= dL) {
|
||||
|
||||
ptInt1 = ptP - ( ptP.x / vtV.x) * vtV ;
|
||||
}
|
||||
else if ( ptInt1.x < 0 && ptInt2.x > dL) {
|
||||
|
||||
ptInt1 = ptP - ( ptP.x / vtV.x) * vtV ;
|
||||
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
|
||||
}
|
||||
else if ( ptInt1.x >= 0 && ptInt2.x <= dL) {
|
||||
|
||||
;
|
||||
}
|
||||
else if ( ptInt1.x >= 0 && ptInt1.x < dL && ptInt2.x >= dL) {
|
||||
|
||||
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
|
||||
}
|
||||
// Intersezioni esterne alla regione di interesse
|
||||
// (quella compresa fra 0 e dL)
|
||||
else
|
||||
return false ;
|
||||
|
||||
// Riporto le coordinate nel sistema di riferimento griglia
|
||||
ptInt1.ToGlob( CylFrame) ;
|
||||
ptInt2.ToGlob( CylFrame) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::IntersZLineCylinder( const Point3d& ptLine,
|
||||
const Point3d& ptBase, const Point3d& ptTop, const Vector3d& vtDir, double dCylR,
|
||||
double& dInfZ, double& dSupZ)
|
||||
{
|
||||
// NB: Le coordinate sono espresse nel sistema griglia
|
||||
// La funzione restituisce true in caso di intersezione,
|
||||
// false altrimenti.
|
||||
|
||||
double dSqRad = dCylR * dCylR ;
|
||||
|
||||
// Cilindro verticale
|
||||
if ( AreSamePointXYApprox( ptBase, ptTop)) {
|
||||
|
||||
// Intersezione
|
||||
if ( SqDistXY( ptLine, ptBase) <= dSqRad) {
|
||||
dInfZ = min( ptBase.z, ptTop.z) ;
|
||||
dSupZ = max( ptBase.z, ptTop.z) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
// Non vi è intersezione
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Cilindro non verticale
|
||||
else {
|
||||
|
||||
// Studio delle simmetrie
|
||||
Point3d ptS = ( ptBase.z < ptTop.z ? ptBase : ptTop) ;
|
||||
Point3d ptE = ( ptBase.z < ptTop.z ? ptTop : ptBase) ;
|
||||
|
||||
Vector3d vtV1 = ptE - ptS ; vtV1.z = 0 ;
|
||||
|
||||
double dLenXY = vtV1.LenXY() ;
|
||||
double dSZ = ptS.z ;
|
||||
double dEZ = ptE.z ;
|
||||
double dDeltaZ = dEZ - dSZ ;
|
||||
|
||||
Vector3d vtL( ptLine.x - ptS.x, ptLine.y - ptS.y, 0) ;
|
||||
|
||||
// vtV1 e vtV2 formano un sistema ortonormale
|
||||
// sul piano e insieme a ptSxy formano un sistema
|
||||
// di riferimento bidimensionale
|
||||
vtV1.Normalize() ;
|
||||
Vector3d vtV2 = vtV1 ;
|
||||
vtV2.Rotate( Z_AX, 90) ;
|
||||
|
||||
double dLen = ( ptE - ptS).Len() ;
|
||||
|
||||
// Sono seno e coseno dell'angolo complementare
|
||||
// rispetto a quello formato dal vettore movimento
|
||||
// con il piano, per questo motivo si ha dCos con
|
||||
// dDeltaZ e dSin con dLenXY
|
||||
double dCos = dDeltaZ / dLen ;
|
||||
double dSin = dLenXY / dLen ;
|
||||
|
||||
// Nuove coordinate piane del punto
|
||||
double dLocX1 = vtL * vtV1 ;
|
||||
double dLocX2 = vtL * vtV2 ;
|
||||
|
||||
double dSqRoot = sqrt( dSqRad - dLocX2 * dLocX2) ;
|
||||
double dX1_0 = dCos * dSqRoot ;
|
||||
|
||||
if ( dLocX1 >= - dX1_0 && dLocX1 <= dLenXY + dX1_0 &&
|
||||
abs( dLocX2) < dCylR) {
|
||||
|
||||
// Minimi
|
||||
if ( dLocX1 < dX1_0) {
|
||||
|
||||
double dDotS = vtDir * ( ptS - ORIG) ;
|
||||
// Qui usiamo ptLine perché servono coordinate griglia
|
||||
dInfZ = ( dDotS - vtDir.x * ptLine.x - vtDir.y * ptLine.y) / vtDir.z ;
|
||||
}
|
||||
else {
|
||||
|
||||
double dZ0 = - dSin * dSqRoot ;
|
||||
|
||||
dInfZ = dSZ + dZ0 + ( dLocX1 - dX1_0) * dDeltaZ / dLenXY ;
|
||||
}
|
||||
|
||||
// Massimi
|
||||
if ( dLocX1 < dLenXY - dX1_0) {
|
||||
|
||||
double dZ0 = dSin * dSqRoot ;
|
||||
|
||||
dSupZ = dSZ + dZ0 + ( dLocX1 - dX1_0) * dDeltaZ / dLenXY ;
|
||||
}
|
||||
else {
|
||||
|
||||
double dDotE = vtDir * ( ptE - ORIG) ;
|
||||
// Qui usiamo ptLine perché servono coordinate griglia
|
||||
dSupZ = ( dDotE - vtDir.x * ptLine.x - vtDir.y * ptLine.y) / vtDir.z ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
||||
const Frame3d& ConusFrame, double dTan, double dl, double dL,
|
||||
Point3d& ptInt1, Point3d& ptInt2)
|
||||
{
|
||||
// NB: L'origine del sistema di riferimento deve essere
|
||||
// nel vertice del cono e l'asse di simmetria deve coincidere
|
||||
// con l'asse x.
|
||||
// La funzione restituisce true in caso di intersezione,
|
||||
// false altrimenti.
|
||||
|
||||
Point3d ptP = ptLineSt ;
|
||||
Vector3d vtV = vtLineDir ;
|
||||
|
||||
// Trasformazione delle coordinate
|
||||
ptP.ToLoc( ConusFrame) ;
|
||||
vtV.ToLoc( ConusFrame) ;
|
||||
|
||||
DBLVECTOR vdCoef(3) ;
|
||||
DBLVECTOR vdRoots ;
|
||||
|
||||
double dSqTan = dTan * dTan ;
|
||||
|
||||
vdCoef[0] = dSqTan * ptP.x * ptP.x - ptP.y * ptP.y - ptP.z * ptP.z ;
|
||||
vdCoef[1] = 2 * ( dSqTan * ptP.x * vtV.x - ptP.y * vtV.y - ptP.z * vtV.z) ;
|
||||
vdCoef[2] = dSqTan * vtV.x * vtV.x - vtV.y * vtV.y - vtV.z * vtV.z ;
|
||||
|
||||
// Computo radici
|
||||
int nRoot = PolynomialRoots( 2, vdCoef, vdRoots) ;
|
||||
|
||||
// Nessuna soluzione
|
||||
if ( nRoot == 0)
|
||||
return false ;
|
||||
|
||||
// Una soluzione: la retta iterseca superficie
|
||||
// laterale e un piano
|
||||
if ( nRoot == 1) {
|
||||
|
||||
ptInt1 = ptP + vdRoots[0] * vtV ;
|
||||
|
||||
if ( ptInt1.x >= dl && ptInt1.x < dL) {
|
||||
|
||||
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
|
||||
}
|
||||
else if ( ptInt1.x >= 0 && ptInt1.x < dl) {
|
||||
|
||||
ptInt1 = ptP + ( ( dl - ptP.x) / vtV.x) * vtV ;
|
||||
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
|
||||
}
|
||||
|
||||
// Riporto le coordinate nel sistema di riferimento
|
||||
// griglia
|
||||
ptInt1.ToGlob( ConusFrame) ;
|
||||
ptInt2.ToGlob( ConusFrame) ;
|
||||
}
|
||||
// Due soluzioni: la retta interseca due volte la
|
||||
// superficie laterale
|
||||
else if ( nRoot == 2) {
|
||||
|
||||
ptInt1 = ptP + vdRoots[0] * vtV ;
|
||||
ptInt2 = ptP + vdRoots[1] * vtV ;
|
||||
|
||||
if ( ptInt1.x > ptInt2.x) {
|
||||
swap( ptInt1, ptInt2) ;
|
||||
}
|
||||
|
||||
if ( ptInt1.x < 0 && ptInt2.x > 0 && ptInt2.x < dl) {
|
||||
|
||||
ptInt1 = ptP + ( ( dl - ptP.x) / vtV.x) * vtV ;
|
||||
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
|
||||
}
|
||||
else if ( ptInt1.x < 0 && ptInt2.x >= dl && ptInt2.x < dL) {
|
||||
|
||||
ptInt1 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
|
||||
}
|
||||
else if ( ptInt1.x > 0 && ptInt1.x < dl && ptInt2.x >= dl && ptInt2.x < dL) {
|
||||
|
||||
ptInt1 = ptP + ( ( dl - ptP.x) / vtV.x) * vtV ;
|
||||
}
|
||||
else if ( ptInt1.x > 0 && ptInt1.x < dl && ptInt2.x >= dL) {
|
||||
|
||||
ptInt1 = ptP + ( ( dl - ptP.x) / vtV.x) * vtV ;
|
||||
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
|
||||
}
|
||||
else if ( ptInt1.x >= dl && ptInt1.x < dL && ptInt2.x < dL) {
|
||||
|
||||
;
|
||||
}
|
||||
else if ( ptInt1.x >= dl && ptInt1.x < dL && ptInt2.x >= dL) {
|
||||
|
||||
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
|
||||
}
|
||||
// Intersezioni esterne alla regione di interesse
|
||||
// (quella compresa fra dl e dL)
|
||||
else
|
||||
return false ;
|
||||
|
||||
// Riporto le coordinate nel sistema di riferimento
|
||||
// griglia
|
||||
ptInt1.ToGlob( ConusFrame) ;
|
||||
ptInt2.ToGlob( ConusFrame) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::IntersLineEllipticalCylinder( const Frame3d & CircFrame, const Vector3d & vtLineDir, const Point3d & ptLineSt,
|
||||
std::vector <Point3d> & ptInters, double dObCoef, double dSqRad, double dL)
|
||||
{
|
||||
// NB: L'origine del sistema di riferimento deve essere
|
||||
// nel centro della circonferenza di base, la cui tralsazione obliqua
|
||||
// genera il cilindro ellittico, e l'asse x deve essere l'asse
|
||||
// di simmetria di tale circonferenza.
|
||||
// La funzione restituisce true in caso di intersezione,
|
||||
// false altrimenti.
|
||||
// NB: Il Parametro dObCoef è il coeffociente angolare della retta movimento
|
||||
// rispetto all'asse x, e dSqRad è il quadrato del raggio della circonferenza.
|
||||
|
||||
double dSqCoef = dObCoef * dObCoef ;
|
||||
|
||||
Point3d ptP = ptLineSt ;
|
||||
Vector3d vtV = vtLineDir ;
|
||||
|
||||
// Sistema di riferimanto grigia
|
||||
Frame3d GridFrame ;
|
||||
GridFrame.Set( ORIG, X_AX, Y_AX, Z_AX) ;
|
||||
|
||||
// Trasformazione delle coordinate
|
||||
ptP.LocToLoc( GridFrame, CircFrame) ;
|
||||
vtV.LocToLoc( GridFrame, CircFrame) ;
|
||||
|
||||
std::vector <double> vdCoef(3) ;
|
||||
std::vector <double> vdRoots ;
|
||||
|
||||
vdCoef[0] = dSqCoef * ptP.x * ptP.x + ptP.y * ptP.y + ptP.z * ptP.z - 2 * dObCoef * ptP.x * ptP.y - dSqRad ;
|
||||
vdCoef[1] = 2 * ( dSqCoef * vtV.x * ptP.x + vtV.y * ptP.y + vtV.z * ptP.z - dObCoef * ( vtV.x * ptP.y + vtV.y * ptP.x)) ;
|
||||
vdCoef[2] = dSqCoef * vtV.x * vtV.x + vtV.y * vtV.y + vtV.z * vtV.z - 2 * dObCoef * vtV.x * vtV.y ;
|
||||
|
||||
int nRoot = PolynomialRoots( 2, vdCoef, vdRoots) ;
|
||||
|
||||
Point3d ptR1, ptR2 ;
|
||||
|
||||
// Nessuna soluzione
|
||||
if ( nRoot == 0) {
|
||||
|
||||
if ( abs( vtV.x) > EPS_ZERO) {
|
||||
|
||||
ptR1 = ptP - ( ptP.x / vtV.x) * vtV ;
|
||||
ptR2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
|
||||
|
||||
if ( ptR1.y * ptR1.y + ptR1.z * ptR1.z < dSqRad &&
|
||||
ptR1.y * ptR1.y + ptR1.z * ptR1.z < dSqRad) {
|
||||
|
||||
ptR1.LocToLoc( CircFrame, GridFrame) ;
|
||||
ptR2.LocToLoc( CircFrame, GridFrame) ;
|
||||
|
||||
ptInters.resize(2) ;
|
||||
|
||||
ptInters[0] = ptR1 ;
|
||||
ptInters[0] = ptR2 ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
// Nessuna intersezione
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
// Nessuna intersezione
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
// L'equazione ammette o due soluzioni (eventualmente
|
||||
// coincidenti) oppure nessuna o infinite se la la retta
|
||||
// appartiene alla superficie
|
||||
|
||||
ptInters.resize(2) ;
|
||||
|
||||
if ( nRoot == 2) {
|
||||
|
||||
ptR1 = ptP + vdRoots[0] * vtV ;
|
||||
ptR2 = ptP + vdRoots[1] * vtV ;
|
||||
|
||||
|
||||
if ( ptR1.x > ptR2.x) {
|
||||
|
||||
Point3d ptTemp = ptR1 ;
|
||||
ptR1 = ptR2 ;
|
||||
ptR2 = ptTemp ;
|
||||
}
|
||||
|
||||
if ( ptR1.x >= 0 && ptR1.x < dL &&
|
||||
ptR2.x > dL) {
|
||||
|
||||
ptR1 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
|
||||
}
|
||||
else if ( ptR1.x >= 0 && ptR2.x <= dL) {
|
||||
|
||||
;
|
||||
}
|
||||
else if ( ptR1.x < 0 && ptR2.x > dL) {
|
||||
|
||||
ptR1 = ptP - ( ptP.x / vtV.x) * vtV ;
|
||||
ptR2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
|
||||
}
|
||||
else if ( ptR1.x < 0 && ptR2.x >= 0 && ptR2.x <= dL) {
|
||||
|
||||
ptR1 = ptP - ( ptP.x / vtV.x) * vtV ;
|
||||
}
|
||||
|
||||
// Riporto le coordinate nel sistema di riferimento
|
||||
// griglia
|
||||
ptR1.LocToLoc( CircFrame, GridFrame) ;
|
||||
ptR2.LocToLoc( CircFrame, GridFrame) ;
|
||||
|
||||
ptInters[0] = ptR1 ;
|
||||
ptInters[1] = ptR2 ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -0,0 +1,595 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2016
|
||||
//----------------------------------------------------------------------------
|
||||
// File : VolZmap.cpp Data : 22.01.15 Versione : 1.6a4
|
||||
// Contenuto : Implementazione della classe Volume Zmap (tre griglie)
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 22.01.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "CurveLine.h"
|
||||
#include "VolZmap.h"
|
||||
#include "GeoConst.h"
|
||||
#include "IntersLineSurfTm.h"
|
||||
#include "\EgtDev\Include\EgtNumUtils.h"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
|
||||
// ------------------------- CREAZIONE MAPPA --------------------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::Create( const Point3d& ptO, double dLengthX, double dLengthY, double dLengthZ, double dPrec, bool bFlag)
|
||||
{
|
||||
|
||||
// Controlli l'ammissibilità delle dimensioni lineari del grezzo e del passo
|
||||
if ( dPrec < EPS_SMALL || dLengthX < EPS_SMALL || dLengthY < EPS_SMALL || dLengthZ < EPS_SMALL)
|
||||
return false ;
|
||||
|
||||
// Aggiorno il passo
|
||||
m_dStep = dPrec ;
|
||||
|
||||
// Aggiorno la dimensione della mappa 1 o 3
|
||||
m_nMapNum = ( bFlag ? 3 : 1) ;
|
||||
|
||||
// Disponendo i sistemi di riferimento in una successione, le coordinate x,y,z
|
||||
// di uno si ottengono da una permutazione ciclica di quelle del precedente sistema.
|
||||
// es: X(n) = Z(n-1), Y(n) = X(n-1), Z(n) = Y(n-1)
|
||||
|
||||
// Definisco i sistemi di riferimento
|
||||
m_MapFrame[0].Set( ptO, X_AX, Y_AX, Z_AX) ;
|
||||
|
||||
// Definisco i vettori dei limiti su indici
|
||||
m_nVNx[0] = static_cast <unsigned int> ( ceil( dLengthX / m_dStep)) ;
|
||||
m_nVNy[0] = static_cast <unsigned int> ( ceil( dLengthY / m_dStep)) ;
|
||||
|
||||
if ( m_nMapNum > 1) {
|
||||
|
||||
m_MapFrame[1].Set( ptO, Y_AX, Z_AX, X_AX) ;
|
||||
m_MapFrame[2].Set( ptO, Z_AX, X_AX, Y_AX) ;
|
||||
|
||||
m_nVNx[1] = static_cast <unsigned int> ( ceil( dLengthY / m_dStep)) ;
|
||||
m_nVNy[1] = static_cast <unsigned int> ( ceil( dLengthZ / m_dStep)) ;
|
||||
|
||||
m_nVNx[2] = static_cast <unsigned int> ( ceil( dLengthZ / m_dStep)) ;
|
||||
m_nVNy[2] = static_cast <unsigned int> ( ceil( dLengthX / m_dStep)) ;
|
||||
}
|
||||
else {
|
||||
|
||||
m_MapFrame[1].Set( ptO, Y_AX, Z_AX, X_AX) ;
|
||||
m_MapFrame[2].Set( ptO, Z_AX, X_AX, Y_AX) ;
|
||||
|
||||
m_nVNx[1] = 0 ;
|
||||
m_nVNy[1] = 0 ;
|
||||
|
||||
m_nVNx[2] = 0 ;
|
||||
m_nVNy[2] = 0 ;
|
||||
}
|
||||
|
||||
// Definizione della mappa
|
||||
|
||||
// Creazione delle mappe
|
||||
// Calcolo del numero di celle per ogni mappa
|
||||
for ( unsigned int i = 0 ; i < m_nMapNum ; ++ i)
|
||||
|
||||
m_nVDim[i] = m_nVNx[i] * m_nVNy[i] ;
|
||||
|
||||
// Creazione delle celle per ogni mappa
|
||||
for ( unsigned int i = 0 ; i < m_nMapNum ; ++ i)
|
||||
|
||||
m_TriZValues[i].resize( m_nVDim[i]) ;
|
||||
|
||||
// Riempimento delle celle
|
||||
for ( unsigned int i = 0 ; i < m_nMapNum ; ++ i)
|
||||
for ( unsigned int j = 0 ; j < m_nVDim[i] ; ++ j) {
|
||||
|
||||
m_TriZValues[i][j].resize(2) ;
|
||||
|
||||
m_TriZValues[i][j][0] = 0 ;
|
||||
|
||||
if ( i == 0)
|
||||
m_TriZValues[i][j][1] = dLengthZ ;
|
||||
else if ( i == 1)
|
||||
m_TriZValues[i][j][1] = dLengthX ;
|
||||
else if ( i == 2)
|
||||
m_TriZValues[i][j][1] = dLengthY ;
|
||||
}
|
||||
|
||||
// Definizione delle limitazioni iniziali in Z per ogni mappa
|
||||
for ( unsigned int i = 0 ; i < m_nMapNum ; ++ i) {
|
||||
|
||||
m_dVMinZ[i] = 0 ;
|
||||
|
||||
if ( i == 0)
|
||||
m_dVMaxZ[i] = dLengthZ ;
|
||||
else if ( i == 1)
|
||||
m_dVMaxZ[i] = dLengthX ;
|
||||
else if ( i == 2)
|
||||
m_dVMaxZ[i] = dLengthY ;
|
||||
}
|
||||
|
||||
// Aggiornamento dello stato
|
||||
m_nStatus = OK ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool
|
||||
VolZmap::CreateFromFlatRegion( const ISurfFlatRegion& Surf, double dDimZ, double dPrec, bool bFlag)
|
||||
{
|
||||
|
||||
Point3d ptMapOrig, ptMapEnd ;
|
||||
|
||||
// Aggiorno la dimensione della mappa 1 o 3
|
||||
m_nMapNum = ( bFlag ? 3 : 1) ;
|
||||
|
||||
// Il passo di discretizzazione non può essere inferiore a 100 * EPS_SMALL
|
||||
m_dStep = max( dPrec, 100 * EPS_SMALL) ;
|
||||
|
||||
// Determino il bounding box della flat region
|
||||
BBox3d SurfBBox ;
|
||||
Surf.GetLocalBBox( SurfBBox, BBF_EXACT) ;
|
||||
|
||||
// Determino i punti estremi del bounding box
|
||||
SurfBBox.GetMinMax( ptMapOrig, ptMapEnd) ;
|
||||
|
||||
// Sistema di riferimento mappa
|
||||
m_MapFrame[0].Set( ptMapOrig, X_AX, Y_AX, Z_AX) ;
|
||||
|
||||
|
||||
// Determino le dimensioni lineari X Y della griglia
|
||||
double dLengthX = ptMapEnd.x - ptMapOrig.x ;
|
||||
double dLengthY = ptMapEnd.y - ptMapOrig.y ;
|
||||
|
||||
// A partire dalle dimensioni di xy del grezzo determino il numero di colonne e righe
|
||||
// della griglia Zmap e da questi la dimensione del vettore di dexel
|
||||
m_nVNx[0] = static_cast <unsigned int> ( ceil( dLengthX / m_dStep)) ;
|
||||
m_nVNy[0] = static_cast <unsigned int> ( ceil( dLengthY / m_dStep)) ;
|
||||
|
||||
m_nVDim[0] = m_nVNx[0] * m_nVNy[0] ;
|
||||
|
||||
// Ridimensiono il vettore di dexel e creo lo Zmap
|
||||
m_TriZValues[0].resize( m_nVDim[0]) ;
|
||||
|
||||
// Se Tridexel ridimensiono anche gli altri vettori
|
||||
if ( bFlag) {
|
||||
|
||||
m_MapFrame[1].Set( ptMapOrig, Y_AX, Z_AX, X_AX) ;
|
||||
m_MapFrame[2].Set( ptMapOrig, Z_AX, X_AX, Y_AX) ;
|
||||
|
||||
m_nVNx[1] = static_cast <unsigned int> ( ceil( dLengthY / m_dStep)) ;
|
||||
m_nVNy[1] = static_cast <unsigned int> ( ceil( dDimZ / m_dStep)) ;
|
||||
|
||||
m_nVDim[1] = m_nVNx[1] * m_nVNy[1] ;
|
||||
|
||||
m_nVNx[2] = static_cast <unsigned int> ( ceil( dDimZ / m_dStep)) ;
|
||||
m_nVNy[2] = static_cast <unsigned int> ( ceil( dLengthX / m_dStep)) ;
|
||||
|
||||
m_nVDim[2] = m_nVNx[2] * m_nVNy[2] ;
|
||||
|
||||
m_TriZValues[1].resize( m_nVDim[1]) ;
|
||||
m_TriZValues[2].resize( m_nVDim[2]) ;
|
||||
}
|
||||
else {
|
||||
|
||||
m_MapFrame[1].Set( ptMapOrig, Y_AX, Z_AX, X_AX) ;
|
||||
m_MapFrame[2].Set( ptMapOrig, Z_AX, X_AX, Y_AX) ;
|
||||
|
||||
m_nVNx[1] = 0 ;
|
||||
m_nVNy[1] = 0 ;
|
||||
|
||||
m_nVDim[1] = 0 ;
|
||||
|
||||
m_nVNx[2] = 0 ;
|
||||
m_nVNy[2] = 0 ;
|
||||
|
||||
m_nVDim[2] = 0 ;
|
||||
}
|
||||
|
||||
// Determinazione e ridimensionamento dei dexel
|
||||
// interni alla regione
|
||||
|
||||
// Griglia 0
|
||||
for ( unsigned int i = 0 ; i < m_nVNx[0] ; ++ i) {
|
||||
|
||||
// Definisco la retta da intersecare con la regione
|
||||
double dX = ( i + 0.5) * m_dStep ;
|
||||
Point3d ptP0 = ptMapOrig + Vector3d( dX, 0, 0) ;
|
||||
CurveLine GridLine ;
|
||||
GridLine.SetPVL( ptP0, Y_AX, dLengthY) ;
|
||||
|
||||
// Determino le intersezioni della retta con la regione
|
||||
CRVCVECTOR IntersectionResults ;
|
||||
Surf.GetCurveClassification( GridLine, IntersectionResults) ;
|
||||
// Parti di cui la retta analizzata è composta
|
||||
int nPart = int( IntersectionResults.size()) ;
|
||||
|
||||
// Analizzo le parti
|
||||
for ( int k = 0 ; k < nPart ; ++ k) {
|
||||
|
||||
// Tipo di curva
|
||||
int nType = IntersectionResults[k].nClass ;
|
||||
|
||||
// Parametri iniziale e finale
|
||||
double dt1 = IntersectionResults[k].dParS ;
|
||||
double dt2 = IntersectionResults[k].dParE ;
|
||||
|
||||
// Se la retta è interna alla regione o coincidente con parte della sua frontiera
|
||||
if ( nType == CRVC_IN || nType == CRVC_ON_P || nType == CRVC_ON_M) {
|
||||
|
||||
// Indici corrispondenti alle coordinate dei punti
|
||||
int nStartJ = Clamp( int( floor( dt1 * dLengthY / m_dStep + 0.5)), 0, m_nVNy[0] - 1) ;
|
||||
int nEndJ = Clamp( int( floor( dt2 * dLengthY / m_dStep - 0.5)), 0, m_nVNy[0] - 1) ;
|
||||
|
||||
// Ridimensiono e riempio i dexel
|
||||
for ( int j = nStartJ ; j <= nEndJ ; ++ j) {
|
||||
// Determino il dexel
|
||||
int nPos0 = j * m_nVNx[0] + i ;
|
||||
|
||||
m_TriZValues[0][nPos0].resize( 2) ;
|
||||
// Aggiorno le quote estreme del segmento
|
||||
m_TriZValues[0][nPos0][0] = 0 ;
|
||||
m_TriZValues[0][nPos0][1] = dDimZ ;
|
||||
}
|
||||
|
||||
// Se tridexel riempio i singoli dexel della
|
||||
// griglia 2 con gli intervalli
|
||||
if ( bFlag) {
|
||||
|
||||
for ( size_t a = 0 ; a < m_nVNx[2] ; ++ a) {
|
||||
|
||||
size_t nPos2 = i * m_nVNx[2] + a ;
|
||||
|
||||
size_t nCurrentSize = m_TriZValues[2][nPos2].size( ) ;
|
||||
|
||||
m_TriZValues[2][nPos2].resize( nCurrentSize + 2) ;
|
||||
|
||||
m_TriZValues[2][nPos2][nCurrentSize] = dt1 * dLengthY ;
|
||||
m_TriZValues[2][nPos2][nCurrentSize + 1] = dt2 * dLengthY ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Se tridexel resta la griglia 1
|
||||
if ( bFlag) {
|
||||
|
||||
for ( unsigned int i = 0 ; i < m_nVNx[1] ; ++ i) {
|
||||
|
||||
// Definisco la retta da intersecare con la regione
|
||||
double dX = ( i + 0.5) * m_dStep ;
|
||||
Point3d ptP0 = ptMapOrig + Vector3d( 0, dX, 0) ;
|
||||
CurveLine GridLine ;
|
||||
GridLine.SetPVL( ptP0, X_AX, dLengthX) ;
|
||||
|
||||
// Determino le intersezioni della retta con la regione
|
||||
CRVCVECTOR IntersectionResults ;
|
||||
Surf.GetCurveClassification( GridLine, IntersectionResults) ;
|
||||
// Parti di cui la retta analizzata è composta
|
||||
int nPart = int( IntersectionResults.size()) ;
|
||||
|
||||
// Analizzo le parti
|
||||
for ( int k = 0 ; k < nPart ; ++ k) {
|
||||
|
||||
// Tipo di curva
|
||||
int nType = IntersectionResults[k].nClass ;
|
||||
|
||||
// Se la retta è interna alla regione o coincidente con parte della sua frontiera
|
||||
if ( nType == CRVC_IN || nType == CRVC_ON_P || nType == CRVC_ON_M) {
|
||||
|
||||
// Parametri iniziale e finale
|
||||
double dt1 = IntersectionResults[k].dParS ;
|
||||
double dt2 = IntersectionResults[k].dParE ;
|
||||
|
||||
for ( size_t j = 0 ; j < m_nVNy[1] ; ++ j) {
|
||||
|
||||
size_t nPos1 = j * m_nVNx[1] + i ;
|
||||
|
||||
size_t nCurrentSize = m_TriZValues[1][nPos1].size( ) ;
|
||||
|
||||
m_TriZValues[1][nPos1].resize( nCurrentSize + 2) ;
|
||||
|
||||
m_TriZValues[1][nPos1][nCurrentSize] = dt1 * dLengthX ;
|
||||
m_TriZValues[1][nPos1][nCurrentSize + 1] = dt2 * dLengthX ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_dVMinZ[0] = 0 ;
|
||||
m_dVMaxZ[0] = dDimZ ;
|
||||
|
||||
if ( bFlag) {
|
||||
|
||||
m_dVMinZ[1] = 0 ;
|
||||
m_dVMaxZ[1] = dLengthX ;
|
||||
m_dVMinZ[2] = 0 ;
|
||||
m_dVMaxZ[2] = dLengthY ;
|
||||
}
|
||||
else {
|
||||
|
||||
m_dVMinZ[1] = 0 ;
|
||||
m_dVMaxZ[1] = 0 ;
|
||||
m_dVMinZ[2] = 0 ;
|
||||
m_dVMaxZ[2] = 0 ;
|
||||
}
|
||||
|
||||
// Aggiornamento dello stato
|
||||
m_nStatus = OK ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::CreateFromTriMesh( const ISurfTriMesh& Surf, double dPrec, bool bFlag)
|
||||
{
|
||||
// Se la superficie non è chiusa non ha senso continuare
|
||||
if ( ! Surf.IsClosed())
|
||||
return false ;
|
||||
|
||||
// Aggiorno la dimensione della mappa 1 o 3
|
||||
m_nMapNum = ( bFlag ? 3 : 1) ;
|
||||
|
||||
// Determino il bounding box della TriMesh
|
||||
BBox3d SurfBBox ;
|
||||
Surf.GetLocalBBox( SurfBBox) ;
|
||||
|
||||
// Determino i punti estremi del bounding box
|
||||
Point3d ptMapOrig, ptMapEnd ;
|
||||
SurfBBox.GetMinMax( ptMapOrig, ptMapEnd) ;
|
||||
|
||||
// Sistema di riferimento mappa
|
||||
m_MapFrame[0].Set( ptMapOrig, Frame3d::TOP) ;
|
||||
|
||||
// Il passo di discretizzazione non può essere inferiore a 100 * EPS_SMALL
|
||||
m_dStep = max( dPrec, 100 * EPS_SMALL) ;
|
||||
|
||||
// Determino le dimensioni lineari del BBox
|
||||
double dLengthX = ptMapEnd.x - ptMapOrig.x ;
|
||||
double dLengthY = ptMapEnd.y - ptMapOrig.y ;
|
||||
double dLengthZ = ptMapEnd.z - ptMapOrig.z ;
|
||||
|
||||
|
||||
// A partire dalle dimensioni di xy del grezzo determino il numero di colonne e righe
|
||||
// della griglia Zmap e da questi la dimensione del vettore di dexel
|
||||
m_nVNx[0] = static_cast <unsigned int> ( ceil( dLengthX / m_dStep)) ;
|
||||
m_nVNy[0] = static_cast <unsigned int> ( ceil( dLengthY / m_dStep)) ;
|
||||
|
||||
m_nVDim[0] = m_nVNx[0] * m_nVNy[0] ;
|
||||
|
||||
// Ridimensiono il vettore di dexel e creo lo Zmap
|
||||
m_TriZValues[0].resize( m_nVDim[0]) ;
|
||||
|
||||
// Se Tridexel ridimensiono anche gli altri vettori
|
||||
if ( bFlag) {
|
||||
|
||||
m_MapFrame[1].Set( ptMapOrig, Y_AX, Z_AX, X_AX) ; // Sarà Front Left
|
||||
m_MapFrame[2].Set( ptMapOrig, Z_AX, X_AX, Y_AX) ;
|
||||
|
||||
m_nVNx[1] = static_cast <unsigned int> ( ceil( dLengthY / m_dStep)) ;
|
||||
m_nVNy[1] = static_cast <unsigned int> ( ceil( dLengthZ / m_dStep)) ;
|
||||
|
||||
m_nVDim[1] = m_nVNx[1] * m_nVNy[1] ;
|
||||
|
||||
m_nVNx[2] = static_cast <unsigned int> ( ceil( dLengthZ / m_dStep)) ;
|
||||
m_nVNy[2] = static_cast <unsigned int> ( ceil( dLengthX / m_dStep)) ;
|
||||
|
||||
m_nVDim[2] = m_nVNx[2] * m_nVNy[2] ;
|
||||
|
||||
m_TriZValues[1].resize( m_nVDim[1]) ;
|
||||
m_TriZValues[2].resize( m_nVDim[2]) ;
|
||||
}
|
||||
|
||||
|
||||
// Oggetto per calcolo massivo intersezioni
|
||||
IntersParLinesSurfTm intPLSTM( m_MapFrame[0], Surf) ;
|
||||
|
||||
// Determinazione e ridimensionamento dei dexel interni alla trimesh
|
||||
for ( unsigned int i = 0 ; i < m_nVNx[0] ; ++ i) {
|
||||
for ( unsigned int j = 0 ; j < m_nVNy[0] ; ++ j) {
|
||||
|
||||
// Definisco la retta da intersecare con la trimesh
|
||||
double dX = ( i + 0.5) * m_dStep ;
|
||||
double dY = ( j + 0.5) * m_dStep ;
|
||||
Point3d ptP0( dX, dY, 0) ;
|
||||
|
||||
// Determino le intersezioni della retta con la TriMesh
|
||||
ILSIVECTOR IntersectionResults ;
|
||||
intPLSTM.GetInters( ptP0, dLengthZ, IntersectionResults) ;
|
||||
|
||||
int nInt = int( IntersectionResults.size()) ;
|
||||
|
||||
unsigned int nPos = j * m_nVNx[0] + i ;
|
||||
|
||||
bool bInside = false ;
|
||||
Point3d ptIn ;
|
||||
for ( int k = 0 ; k < nInt ; ++ k) {
|
||||
|
||||
int nIntType = IntersectionResults[k].nILTT ;
|
||||
|
||||
// Se c'è intersezione
|
||||
if ( nIntType != ILTT_NO) {
|
||||
|
||||
double dCos = IntersectionResults[k].dCosDN ;
|
||||
|
||||
// entro nella superficie trimesh
|
||||
if ( dCos < - EPS_SMALL) {
|
||||
|
||||
ptIn = IntersectionResults[k].ptI ;
|
||||
|
||||
bInside = true ;
|
||||
}
|
||||
|
||||
// esco dalla superficie trimesh
|
||||
else if ( dCos > EPS_SMALL && bInside) {
|
||||
|
||||
Point3d ptOut = IntersectionResults[k].ptI ;
|
||||
|
||||
unsigned int nCurrentSize = unsigned int( m_TriZValues[0][nPos].size()) ;
|
||||
|
||||
m_TriZValues[0][nPos].resize( nCurrentSize + 2) ;
|
||||
|
||||
m_TriZValues[0][nPos][nCurrentSize] = ptIn.z - ptMapOrig.z ;
|
||||
m_TriZValues[0][nPos][nCurrentSize + 1] = ptOut.z - ptMapOrig.z ;
|
||||
|
||||
bInside = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( bFlag) {
|
||||
|
||||
IntersParLinesSurfTm intPLSTM1( m_MapFrame[1], Surf) ;
|
||||
|
||||
// Determinazione e ridimensionamento dei dexel interni alla trimesh
|
||||
for ( unsigned int i = 0 ; i < m_nVNx[1] ; ++ i) {
|
||||
for ( unsigned int j = 0 ; j < m_nVNy[1] ; ++ j) {
|
||||
|
||||
// Definisco la retta da intersecare con la trimesh
|
||||
double dX = ( i + 0.5) * m_dStep ;
|
||||
double dY = ( j + 0.5) * m_dStep ;
|
||||
Point3d ptP0( dX, dY, 0) ;
|
||||
|
||||
// Determino le intersezioni della retta con la TriMesh
|
||||
ILSIVECTOR IntersectionResults ;
|
||||
intPLSTM1.GetInters( ptP0, dLengthX, IntersectionResults) ;
|
||||
|
||||
int nInt = int( IntersectionResults.size()) ;
|
||||
|
||||
unsigned int nPos = j * m_nVNx[1] + i ;
|
||||
|
||||
bool bInside = false ;
|
||||
Point3d ptIn ;
|
||||
for ( int k = 0 ; k < nInt ; ++ k) {
|
||||
|
||||
int nIntType = IntersectionResults[k].nILTT ;
|
||||
|
||||
// Se c'è intersezione
|
||||
if ( nIntType != ILTT_NO) {
|
||||
|
||||
double dCos = IntersectionResults[k].dCosDN ;
|
||||
|
||||
// entro nella superficie trimesh
|
||||
if ( dCos < - EPS_SMALL) {
|
||||
|
||||
ptIn = IntersectionResults[k].ptI ;
|
||||
|
||||
bInside = true ;
|
||||
}
|
||||
|
||||
// esco dalla superficie trimesh
|
||||
else if ( dCos > EPS_SMALL && bInside) {
|
||||
|
||||
Point3d ptOut = IntersectionResults[k].ptI ;
|
||||
|
||||
unsigned int nCurrentSize = unsigned int( m_TriZValues[1][nPos].size()) ;
|
||||
|
||||
m_TriZValues[1][nPos].resize( nCurrentSize + 2) ;
|
||||
|
||||
m_TriZValues[1][nPos][nCurrentSize] = ptIn.x - ptMapOrig.x ;
|
||||
m_TriZValues[1][nPos][nCurrentSize + 1] = ptOut.x - ptMapOrig.x ;
|
||||
|
||||
bInside = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IntersParLinesSurfTm intPLSTM2( m_MapFrame[2], Surf) ;
|
||||
|
||||
// Determinazione e ridimensionamento dei dexel interni alla trimesh
|
||||
for ( unsigned int i = 0 ; i < m_nVNx[2] ; ++ i) {
|
||||
for ( unsigned int j = 0 ; j < m_nVNy[2] ; ++ j) {
|
||||
|
||||
// Definisco la retta da intersecare con la trimesh
|
||||
double dX = ( i + 0.5) * m_dStep ;
|
||||
double dY = ( j + 0.5) * m_dStep ;
|
||||
Point3d ptP0( dX, dY, 0) ;
|
||||
|
||||
// Determino le intersezioni della retta con la TriMesh
|
||||
ILSIVECTOR IntersectionResults ;
|
||||
intPLSTM2.GetInters( ptP0, dLengthY, IntersectionResults) ;
|
||||
|
||||
int nInt = int( IntersectionResults.size()) ;
|
||||
|
||||
unsigned int nPos = j * m_nVNx[2] + i ;
|
||||
|
||||
bool bInside = false ;
|
||||
Point3d ptIn ;
|
||||
for ( int k = 0 ; k < nInt ; ++ k) {
|
||||
|
||||
int nIntType = IntersectionResults[k].nILTT ;
|
||||
|
||||
// Se c'è intersezione
|
||||
if ( nIntType != ILTT_NO) {
|
||||
|
||||
double dCos = IntersectionResults[k].dCosDN ;
|
||||
|
||||
// entro nella superficie trimesh
|
||||
if ( dCos < - EPS_SMALL) {
|
||||
|
||||
ptIn = IntersectionResults[k].ptI ;
|
||||
|
||||
bInside = true ;
|
||||
}
|
||||
|
||||
// esco dalla superficie trimesh
|
||||
else if ( dCos > EPS_SMALL && bInside) {
|
||||
|
||||
Point3d ptOut = IntersectionResults[k].ptI ;
|
||||
|
||||
unsigned int nCurrentSize = unsigned int( m_TriZValues[2][nPos].size()) ;
|
||||
|
||||
m_TriZValues[2][nPos].resize( nCurrentSize + 2) ;
|
||||
|
||||
m_TriZValues[2][nPos][nCurrentSize] = ptIn.y - ptMapOrig.y ;
|
||||
m_TriZValues[2][nPos][nCurrentSize + 1] = ptOut.y - ptMapOrig.y ;
|
||||
|
||||
bInside = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Assegno il minimo e massimo valore di Z della mappa
|
||||
m_dVMinZ[0] = 0 ;
|
||||
m_dVMaxZ[0] = dLengthZ ;
|
||||
|
||||
if ( bFlag) {
|
||||
|
||||
m_dVMinZ[1] = 0 ;
|
||||
m_dVMaxZ[1] = dLengthX ;
|
||||
m_dVMinZ[2] = 0 ;
|
||||
m_dVMaxZ[2] = dLengthY ;
|
||||
}
|
||||
else {
|
||||
|
||||
m_dVMinZ[1] = 0 ;
|
||||
m_dVMaxZ[1] = 0 ;
|
||||
m_dVMinZ[2] = 0 ;
|
||||
m_dVMaxZ[2] = 0 ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
m_nStatus = OK ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+143
-100
@@ -28,12 +28,16 @@ GEOOBJ_REGISTER( VOL_ZMAP, NGE_V_ZMP, VolZmap) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
VolZmap::VolZmap(void)
|
||||
: m_nStatus( TO_VERIFY), m_nTempProp(), m_dLinTol( LIN_TOL_STD), m_dAngTolDeg( ANG_TOL_APPROX_DEG)
|
||||
: m_nStatus( TO_VERIFY), m_dStep( EPS_SMALL), m_nTempProp( 0), m_dLinTol( LIN_TOL_STD), m_dAngTolDeg( ANG_TOL_APPROX_DEG)
|
||||
{
|
||||
m_dStep = 0 ;
|
||||
m_nNx = 0 ;
|
||||
m_nNy = 0 ;
|
||||
m_nDim = 0 ;
|
||||
m_nMapNum = 0 ;
|
||||
for ( int i = 0 ; i < 3 ; ++ i) {
|
||||
m_nVNx[i] = 0 ;
|
||||
m_nVNy[i] = 0 ;
|
||||
m_nVDim[i] = 0 ;
|
||||
m_dVMinZ[i] = 0 ;
|
||||
m_dVMaxZ[i] = 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -74,12 +78,24 @@ VolZmap::CopyFrom( const VolZmap& vzmSrc)
|
||||
if ( &vzmSrc == this)
|
||||
return true ;
|
||||
m_OGrMgr.Reset() ;
|
||||
m_LocalFrame = vzmSrc.m_LocalFrame ;
|
||||
|
||||
m_nMapNum = vzmSrc.m_nMapNum ;
|
||||
|
||||
for ( int i = 0 ; i < int ( m_nMapNum) ; ++ i) {
|
||||
|
||||
m_MapFrame[i] = vzmSrc.m_MapFrame[i] ;
|
||||
|
||||
m_nVNx[i] = vzmSrc.m_nVNx[i] ;
|
||||
m_nVNy[i] = vzmSrc.m_nVNy[i] ;
|
||||
m_nVDim[i] = vzmSrc.m_nVDim[i] ;
|
||||
|
||||
m_dVMinZ[i] = vzmSrc.m_dVMinZ[i] ;
|
||||
m_dVMaxZ[i] = vzmSrc.m_dVMaxZ[i] ;
|
||||
|
||||
m_TriZValues[i] = vzmSrc.m_TriZValues[i] ;
|
||||
}
|
||||
|
||||
m_dStep = vzmSrc.m_dStep ;
|
||||
m_nDim = vzmSrc.m_nDim ;
|
||||
m_nNx = vzmSrc.m_nNx ;
|
||||
m_nNy = vzmSrc.m_nNy ;
|
||||
m_ZValues = vzmSrc.m_ZValues ;
|
||||
m_nStatus = vzmSrc.m_nStatus ;
|
||||
m_nTempProp = vzmSrc.m_nTempProp ;
|
||||
return true ;
|
||||
@@ -118,38 +134,44 @@ VolZmap::GetNgeId( void) const
|
||||
bool
|
||||
VolZmap::Save( NgeWriter& ngeOut) const
|
||||
{
|
||||
// parametri di scrittura: sistema di riferimento, minimo incremento, numero di passi
|
||||
// in direzione x e y, e per ogni casella, numero di valori e valori
|
||||
if ( ! ngeOut.WriteFrame( m_LocalFrame, ";", true))
|
||||
return false ;
|
||||
if ( ! ngeOut.WriteDouble( m_dStep, ",", false))
|
||||
return false ;
|
||||
if ( ! ngeOut.WriteInt( m_nNx, ",", false))
|
||||
return false ;
|
||||
if ( ! ngeOut.WriteInt( m_nNy, ";", true))
|
||||
return false ;
|
||||
// ciclo sui dexel
|
||||
for ( unsigned int i = 0 ; i < m_nDim ; ++ i) {
|
||||
// numero di estremi
|
||||
int nDim = int( m_ZValues[i].size()) ;
|
||||
if ( ! ngeOut.WriteInt( nDim, ",", false))
|
||||
// parametri di scrittura: sistema di riferimento, numero di passi
|
||||
// in direzione x e y, minimo incremento e per ogni casella, numero di valori e valori
|
||||
for ( int i = 0 ; i < int ( m_nMapNum) ; ++ i) {
|
||||
if ( ! ngeOut.WriteFrame( m_MapFrame[i], ",", true))
|
||||
return false ;
|
||||
if ( ! ngeOut.WriteInt( m_nVNx[i], ",", false))
|
||||
return false ;
|
||||
// se dexel nullo
|
||||
if ( nDim == 0) {
|
||||
if ( ! ngeOut.WriteInt( m_nVNy[i], ",", true))
|
||||
return false ;
|
||||
}
|
||||
|
||||
if ( ! ngeOut.WriteDouble( m_dStep, ";", false))
|
||||
return false ;
|
||||
|
||||
// ciclo sulle mappe
|
||||
for ( int i = 0 ; i < int ( m_nMapNum) ; ++ i) {
|
||||
// ciclo sui dexel
|
||||
for ( unsigned int j = 0 ; j < m_nVDim[i] ; ++ j) {
|
||||
// numero di estremi
|
||||
int nDim = int( m_TriZValues[i][j].size()) ;
|
||||
if ( ! ngeOut.WriteInt( nDim, ",", false))
|
||||
return false ;
|
||||
// se dexel nullo
|
||||
if ( nDim == 0) {
|
||||
// scrivo un valore dummy
|
||||
if ( ! ngeOut.WriteDouble( 0, ";", true))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
for ( unsigned int k = 0 ; k < m_ZValues[i].size() ; ++ k) {
|
||||
bool bEndL = ( k == m_ZValues[i].size() - 1) ;
|
||||
if ( ! ngeOut.WriteDouble( m_ZValues[i][k], ( bEndL ? ";" : ","), bEndL))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// altrimenti
|
||||
else {
|
||||
for ( unsigned int k = 0 ; k < m_TriZValues[i][j].size() ; ++ k) {
|
||||
bool bEndL = ( k == m_TriZValues[i][j].size() - 1) ;
|
||||
if ( ! ngeOut.WriteDouble( m_TriZValues[i][j][k], ( bEndL ? ";" : ","), bEndL))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -158,49 +180,61 @@ bool
|
||||
VolZmap::Load( NgeReader& ngeIn)
|
||||
{
|
||||
m_nStatus = TO_VERIFY ;
|
||||
// parametri di lettura: sistema di riferimento, minimo incremento, numero di passi
|
||||
// in direzione x e y, e per ogni casella, numero di valori e valori
|
||||
if ( ! ngeIn.ReadFrame( m_LocalFrame, ";", true))
|
||||
return false ;
|
||||
if ( ! ngeIn.ReadDouble( m_dStep, ",", false))
|
||||
return false ;
|
||||
// parametri di lettura: sistema di riferimento, numero di passi
|
||||
// in direzione x e y, minimo incremento e per ogni casella, numero di valori e valori
|
||||
|
||||
int nTemp ;
|
||||
if ( ! ngeIn.ReadInt( nTemp, ",", false))
|
||||
return false ;
|
||||
m_nNx = nTemp ;
|
||||
if ( ! ngeIn.ReadInt( nTemp, ";", true))
|
||||
return false ;
|
||||
m_nNy = nTemp ;
|
||||
|
||||
// dimensione del vettore di dexel
|
||||
m_nDim = m_nNx * m_nNy ;
|
||||
m_ZValues.resize(m_nDim) ;
|
||||
for ( int i = 0 ; i < int ( m_nMapNum) ; ++ i) {
|
||||
|
||||
// ciclo sui dexel
|
||||
for ( unsigned int i = 0 ; i < m_nDim ; ++ i) {
|
||||
// leggo il numero di estremi nel dexel
|
||||
if ( ! ngeIn.ReadFrame( m_MapFrame[i], ";", true))
|
||||
return false ;
|
||||
if ( ! ngeIn.ReadInt( nTemp, ",", false))
|
||||
return false ;
|
||||
// devono essere pari
|
||||
if ( ( nTemp % 2) != 0)
|
||||
m_nVNx[i] = nTemp ;
|
||||
if ( ! ngeIn.ReadInt( nTemp, ";", true))
|
||||
return false ;
|
||||
// se dexel nullo
|
||||
if ( nTemp == 0) {
|
||||
// leggo un valore dummy
|
||||
double dDummy ;
|
||||
if ( ! ngeIn.ReadDouble( dDummy, ",", true))
|
||||
m_nVNy[i] = nTemp ;
|
||||
}
|
||||
|
||||
if ( ! ngeIn.ReadDouble( m_dStep, ",", false))
|
||||
return false ;
|
||||
|
||||
// dimensione dei vettori di dexel
|
||||
for ( int i = 0 ; i < int ( m_nMapNum) ; ++ i) {
|
||||
|
||||
m_nVDim[i] = m_nVNx[i] * m_nVNy[i] ;
|
||||
m_TriZValues[i].resize(m_nVDim[i]) ;
|
||||
}
|
||||
|
||||
// ciclo sulle mappe
|
||||
for ( int i = 0 ; i < int ( m_nMapNum) ; ++ i) {
|
||||
// ciclo sui dexel
|
||||
for ( unsigned int j = 0 ; j < m_nVDim[i] ; ++ j) {
|
||||
// leggo il numero di estremi nel dexel
|
||||
if ( ! ngeIn.ReadInt( nTemp, ",", false))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
// dimensiono l'array
|
||||
m_ZValues[i].resize(nTemp) ;
|
||||
// leggo i valori
|
||||
for ( unsigned int k = 0 ; k < m_ZValues[i].size() ; ++ k) {
|
||||
bool bEndL = ( k == m_ZValues[i].size() - 1) ;
|
||||
if ( ! ngeIn.ReadDouble( m_ZValues[i][k], ( bEndL ? ";" : ","), bEndL))
|
||||
// devono essere pari
|
||||
if ( ( nTemp % 2) != 0)
|
||||
return false ;
|
||||
// se dexel nullo
|
||||
if ( nTemp == 0) {
|
||||
// leggo un valore dummy
|
||||
double dDummy ;
|
||||
if ( ! ngeIn.ReadDouble( dDummy, ",", true))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
// dimensiono l'array
|
||||
m_TriZValues[i][j].resize(nTemp) ;
|
||||
// leggo i valori
|
||||
for ( unsigned int k = 0 ; k < m_TriZValues[i][j].size() ; ++ k) {
|
||||
bool bEndL = ( k == m_TriZValues[i][j].size() - 1) ;
|
||||
if ( ! ngeIn.ReadDouble( m_TriZValues[i][j][k], ( bEndL ? ";" : ","), bEndL))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,24 +254,24 @@ VolZmap::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
|
||||
// se richiesto approssimato
|
||||
if ( ( nFlag & BBF_EXACT) == 0) {
|
||||
b3Loc.Add( ORIG) ;
|
||||
b3Loc.Add( Point3d( m_nNx * m_dStep, m_nNy * m_dStep, m_dMaxZ)) ;
|
||||
b3Loc.ToGlob( m_LocalFrame) ;
|
||||
b3Loc.Add( Point3d( m_nVNx[0] * m_dStep, m_nVNy[0] * m_dStep, m_dVMaxZ[0])) ;
|
||||
b3Loc.ToGlob( m_MapFrame[0]) ;
|
||||
return true ;
|
||||
}
|
||||
// calcolo preciso
|
||||
// ciclo sui dexel (punti in basso con ciclo aggiunto per punti in alto di ultima riga)
|
||||
double dY = 0 ;
|
||||
for ( size_t j = 0 ; j <= m_nNy ; ++ j) {
|
||||
size_t jc = ( ( j != m_nNy) ? j : m_nNy -1) ;
|
||||
for ( size_t j = 0 ; j <= m_nVNy[0] ; ++ j) {
|
||||
size_t jc = ( ( j != m_nVNy[0]) ? j : m_nVNy[0] -1) ;
|
||||
double dX = 0 ;
|
||||
// punto a sinistra di ogni dexel (aggiungo un ciclo per fare punto a destra di ultimo)
|
||||
for ( size_t i = 0 ; i <= m_nNx ; ++ i) {
|
||||
size_t ic = ( ( i != m_nNx) ? i : m_nNx -1) ;
|
||||
size_t nPos = ic + jc * m_nNx ;
|
||||
if ( m_ZValues[nPos].size() > 0) {
|
||||
Point3d ptP = m_LocalFrame.Orig() + dX * m_LocalFrame.VersX() + dY * m_LocalFrame.VersY() ;
|
||||
b3Loc.Add( ptP + m_ZValues[nPos][0] * m_LocalFrame.VersZ()) ;
|
||||
b3Loc.Add( ptP + m_ZValues[nPos][m_ZValues[nPos].size()-1] * m_LocalFrame.VersZ()) ;
|
||||
for ( size_t i = 0 ; i <= m_nVNx[0] ; ++ i) {
|
||||
size_t ic = ( ( i != m_nVNx[0]) ? i : m_nVNx[0] -1) ;
|
||||
size_t nPos = ic + jc * m_nVNx[0] ;
|
||||
if ( m_TriZValues[0][nPos].size() > 0) {
|
||||
Point3d ptP = m_MapFrame[0].Orig() + dX * m_MapFrame[0].VersX() + dY * m_MapFrame[0].VersY() ;
|
||||
b3Loc.Add( ptP + m_TriZValues[0][nPos][0] * m_MapFrame[0].VersZ()) ;
|
||||
b3Loc.Add( ptP + m_TriZValues[0][nPos][m_TriZValues[0][nPos].size()-1] * m_MapFrame[0].VersZ()) ;
|
||||
}
|
||||
// passo al punto successivo
|
||||
dX += m_dStep ;
|
||||
@@ -259,29 +293,29 @@ VolZmap::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
||||
// reset box
|
||||
b3Ref.Reset() ;
|
||||
// trasformo il riferimento locale tramite quello passato
|
||||
Frame3d frUse = m_LocalFrame ;
|
||||
Frame3d frUse = m_MapFrame[0] ;
|
||||
frUse.ToGlob( frRef) ;
|
||||
// se richiesto approssimato
|
||||
if ( ( nFlag & BBF_EXACT) == 0) {
|
||||
b3Ref.Add( ORIG) ;
|
||||
b3Ref.Add( Point3d( m_nNx * m_dStep, m_nNy * m_dStep, m_dMaxZ)) ;
|
||||
b3Ref.Add( Point3d( m_nVNx[0] * m_dStep, m_nVNy[0] * m_dStep, m_dVMaxZ[0])) ;
|
||||
b3Ref.ToGlob( frUse) ;
|
||||
return true ;
|
||||
}
|
||||
// calcolo preciso
|
||||
// ciclo sui dexel (punti in basso con ciclo aggiunto per punti in alto di ultima riga)
|
||||
double dY = 0 ;
|
||||
for ( size_t j = 0 ; j <= m_nNy ; ++ j) {
|
||||
size_t jc = ( ( j != m_nNy) ? j : m_nNy -1) ;
|
||||
for ( size_t j = 0 ; j <= m_nVNy[0] ; ++ j) {
|
||||
size_t jc = ( ( j != m_nVNy[0]) ? j : m_nVNy[0] -1) ;
|
||||
double dX = 0 ;
|
||||
// punto a sinistra di ogni dexel (aggiungo un ciclo per fare punto a destra di ultimo)
|
||||
for ( size_t i = 0 ; i <= m_nNx ; ++ i) {
|
||||
size_t ic = ( ( i != m_nNx) ? i : m_nNx -1) ;
|
||||
size_t nPos = ic + jc * m_nNx ;
|
||||
if ( m_ZValues[nPos].size() > 0) {
|
||||
for ( size_t i = 0 ; i <= m_nVNx[0] ; ++ i) {
|
||||
size_t ic = ( ( i != m_nVNx[0]) ? i : m_nVNx[0] -1) ;
|
||||
size_t nPos = ic + jc * m_nVNx[0] ;
|
||||
if ( m_TriZValues[0][nPos].size() > 0) {
|
||||
Point3d ptP = frUse.Orig() + dX * frUse.VersX() + dY * frUse.VersY() ;
|
||||
b3Ref.Add( ptP + m_ZValues[nPos][0] * frUse.VersZ()) ;
|
||||
b3Ref.Add( ptP + m_ZValues[nPos][m_ZValues[nPos].size()-1] * frUse.VersZ()) ;
|
||||
b3Ref.Add( ptP + m_TriZValues[0][nPos][0] * frUse.VersZ()) ;
|
||||
b3Ref.Add( ptP + m_TriZValues[0][nPos][m_TriZValues[0][nPos].size()-1] * frUse.VersZ()) ;
|
||||
}
|
||||
// passo al punto successivo
|
||||
dX += m_dStep ;
|
||||
@@ -291,7 +325,7 @@ VolZmap::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
@@ -302,8 +336,9 @@ VolZmap::Translate( const Vector3d& vtMove)
|
||||
return false ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// traslo il riferimento
|
||||
m_LocalFrame.Translate( vtMove) ;
|
||||
// traslo i riferimenti
|
||||
for ( int i = 0 ; i < int( m_nMapNum) ; ++ i)
|
||||
m_MapFrame[i].Translate( vtMove) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -316,8 +351,10 @@ VolZmap::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, doub
|
||||
return false ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// ruoto il riferimento
|
||||
return m_LocalFrame.Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
// ruoto i riferimenti
|
||||
for ( int i = 0 ; i < int( m_nMapNum) ; ++ i)
|
||||
m_MapFrame[i].Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -360,7 +397,9 @@ VolZmap::ToGlob( const Frame3d& frRef)
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// trasformo il riferimento
|
||||
return m_LocalFrame.ToGlob( frRef) ;
|
||||
for ( int i = 0 ; i < int ( m_nMapNum) ; ++ i)
|
||||
m_MapFrame[i].ToGlob( frRef) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -373,7 +412,9 @@ VolZmap::ToLoc( const Frame3d& frRef)
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// trasformo il riferimento
|
||||
return m_LocalFrame.ToLoc( frRef) ;
|
||||
for ( int i = 0 ; i < int( m_nMapNum) ; ++ i)
|
||||
m_MapFrame[i].ToLoc( frRef) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -386,7 +427,9 @@ VolZmap::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// trasformo il riferimento
|
||||
return m_LocalFrame.LocToLoc( frOri, frDest) ;
|
||||
for ( int i = 0 ; i < int( m_nMapNum) ; ++ i)
|
||||
m_MapFrame[i].LocToLoc( frOri, frDest) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -60,9 +60,9 @@ class VolZmap : public IVolZmap, public IGeoObjRW
|
||||
|
||||
public : // IVolZmap
|
||||
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
||||
bool Create( const Point3d& ptO, double dDimX, double dDimY, double dDimZ, double dPrec) override ;
|
||||
bool CreateFromFlatRegion( const ISurfFlatRegion& Surf, double dDimZ, double dPrec) override ;
|
||||
bool CreateFromTriMesh( const ISurfTriMesh& Surf, double dPrec) override ;
|
||||
bool Create( const Point3d& ptO, double dDimX, double dDimY, double dDimZ, double dPrec, bool bTriDex) override ;
|
||||
bool CreateFromFlatRegion( const ISurfFlatRegion& Surf, double dDimZ, double dPrec, bool bTriDex) override ;
|
||||
bool CreateFromTriMesh( const ISurfTriMesh& Surf, double dPrec, bool bTriDex) override ;
|
||||
bool GetAllTriangles( TRIA3DLIST& lstTria) const override ;
|
||||
bool GetDexelLines( int nDir, int nPos1, int nPos2, POLYLINELIST& lstPL) const override ;
|
||||
bool SetTolerances( double dLinTol, double dAngTolDeg = 90) override ;
|
||||
@@ -70,10 +70,12 @@ class VolZmap : public IVolZmap, public IGeoObjRW
|
||||
bool SetAdvTool( const std::string& pToolName,
|
||||
double dH, double dR, double dTipH, double dTipR, double dCornR) override ;
|
||||
bool SetGenTool( const std::string& pToolName, const ICurveComposite* pToolOutline) override ;
|
||||
bool MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Point3d& ptPe, const Vector3d& vtDe) override ;
|
||||
bool GetDepth( const Point3d& ptP, const Vector3d& vtDir, double& dInLength, double& dOutLength) override ;
|
||||
bool AvoidBox( const Frame3d& frBox, const Vector3d& vtDiag) override ;
|
||||
|
||||
|
||||
bool MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Point3d& ptPe, const Vector3d& vtDe) override ;
|
||||
|
||||
public : // IGeoObjRW
|
||||
virtual int GetNgeId( void) const ;
|
||||
virtual bool Save( NgeWriter& ngeOut) const ;
|
||||
@@ -103,144 +105,110 @@ class VolZmap : public IVolZmap, public IGeoObjRW
|
||||
bool CalcDexelPrisms( int nPos1, int nPos2, TRIA3DLIST& lstTria) const ;
|
||||
bool AddDexelSideFace( int nPos, int nPosAdj, const Point3d& ptP, const Point3d& ptQ,
|
||||
const Vector3d& vtZ, const Vector3d& vtNorm, TRIA3DLIST& lstTria) const ;
|
||||
|
||||
bool SubtractIntervals( unsigned int nI, unsigned int nJ, double dMin, double dMax) ;
|
||||
bool SubtractIntervals( const Point3d& ptP, double dMin, double dMax) ;
|
||||
bool AddIntervals( unsigned int nI, unsigned int nJ, double dMin, double dMax) ;
|
||||
bool AddIntervals( const Point3d& ptP, double dMin, double dMax) ;
|
||||
|
||||
// frese: cylindrical, ball-end, bull-nose e conus
|
||||
// Versore utensile parallelo all'asse Z
|
||||
// Fori
|
||||
bool DrillingZ( const Point3d & ptLs, const Point3d & ptLe, const Vector3d & vtToolDir) ;
|
||||
|
||||
bool CBTDrillZ( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool ConusDrillingZ( const Point3d ptLs, const Point3d ptLe, const Vector3d vtToolDir) ;
|
||||
|
||||
// Tagli orizzontali
|
||||
bool MillingPerpZ( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
|
||||
bool CBTMillingPerpZ( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool ConusPerpZ( const Point3d ptLs, const Point3d ptLe, const Vector3d vtToolDir) ;
|
||||
|
||||
inline bool GetMinMaxZSw( const Point3d ptO, unsigned int nStartI, unsigned int nEndI, unsigned int nStartJ, unsigned int nEndJ, double dMinZ, double dMaxZ, double dMinRad, double dMaxRad, double dDir, double dDeltaZ) ;
|
||||
inline bool GetMinMaxZDr( const Point3d ptO, unsigned int nStartI, unsigned int nEndI, unsigned int nStartJ, unsigned int nEndJ, double dMinZ, double dMaxZ, double dMinRad, double dMaxRad, double dDir, double dDeltaZ) ;
|
||||
inline bool GetMinMaxZ( unsigned int nI, unsigned int nJ, double dZCutBase, double dDeltaZ, double dSqDist, const Vector3d& vtToolDir) ;
|
||||
|
||||
// generico 3 assi
|
||||
bool MillingZ( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
|
||||
bool CBMillingZ( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool ConusMillingZDr( const Point3d ptLs, const Point3d ptLe, const Vector3d vtToolDir) ;
|
||||
bool ConusMillingZSw( const Point3d ptLs, const Point3d ptLe, const Vector3d vtToolDir) ;
|
||||
|
||||
inline bool GetMinMaxZGen( unsigned int nI, unsigned int nJ, double dProj, double dSqd, double dLenPath, double dZheight, double dDelta, const Vector3d& vtToolDir) ;
|
||||
|
||||
bool MarchingCubes( TRIA3DLIST& lstTria) 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 ;
|
||||
|
||||
// Versore utensile nel piano XY
|
||||
// DeltaZ = 0
|
||||
bool DrillingXY( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
// OPERAZIONI SU INTERVALLI
|
||||
bool SubtractIntervals( unsigned int nGrid, unsigned int nI, unsigned int nJ, double dMin, double dMax) ;
|
||||
bool SubtractIntervals( unsigned int nGrid, const Point3d& ptP, double dMin, double dMax) ;
|
||||
bool AddIntervals( unsigned int nGrid, unsigned int nI, unsigned int nJ, double dMin, double dMax) ;
|
||||
bool AddIntervals( unsigned int nGrid, const Point3d& ptP, double dMin, double dMax) ;
|
||||
|
||||
bool CBTDrillXY( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool ConusDrillingXY( const Point3d ptLs, const Point3d ptLe, const Vector3d vtToolDir) ;
|
||||
|
||||
bool MillingPerpXY( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
// SOTTRAZIONI
|
||||
// UTENSILI
|
||||
// Asse di simmetria parallelo a Z
|
||||
bool CylBall_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
bool CylBall_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
bool CylBall_ZMilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
|
||||
bool CBTPerpXY( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool ConusPerpXY( const Point3d ptLs, const Point3d ptLe, const Vector3d vtToolDir) ;
|
||||
|
||||
bool MillingXYPlaneGen( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool PlaneGenCylBall( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool ConusPlaneGen( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool Conus_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
bool Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
bool Conus_ZMilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
|
||||
inline bool GetMinMaxXY( unsigned int nI, unsigned int nJ, double dProj, double dZheight, double dSqD, double dPathPerp, double dPathPar, double dScProd) ;
|
||||
inline bool GetMMPlaneGenCyl( unsigned int i, unsigned int j, double dZ, double dLen1, double dLen2, double dProj1, double dProj2) ;
|
||||
inline bool GetMMPlaneGenBall( unsigned int i, unsigned int j, double dZ, double dLen1, double dLen2, Point3d ptIxy, Vector3d vtMove, Vector3d vtV1, Vector3d vtV2) ;
|
||||
|
||||
// DeltaZ != 0
|
||||
bool MillingXYVert( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool Dr_ZMilling( unsigned int nGrid, const Point3d & ptLs, const Point3d & ptLe, const Vector3d & vtToolDir) ;
|
||||
bool Sw_ZMilling( unsigned int nGrid, const Point3d & ptLs, const Point3d & ptLe, const Vector3d & vtToolDir) ;
|
||||
|
||||
bool MillingXYLongVert( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool GenTool_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
bool GenTool_ZMilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
|
||||
bool XYLongVertCylBall( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool XYLongVertConus( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
|
||||
bool MillingXY( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
|
||||
bool MillingXYCyl( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool MillingXYBall( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool MillingXYConus( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
|
||||
bool MillingXYPlus( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
|
||||
bool MillingXYPlusCyl( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool MillingXYPlusBall( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool MillingXYPlusConus( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
// Asse di simmetria nel piano
|
||||
bool CylBall_XYDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
bool CylBall_XYPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
bool CylBall_XYMilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
|
||||
// Virtual milling per componenti elementari
|
||||
bool Conus_XYDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
bool Conus_XYPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
bool Conus_XYMilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
|
||||
// Versore utensile parallelo all'asse Z
|
||||
// Movimento parallelo al versore utensile
|
||||
bool DrillZ( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
|
||||
// Componenti
|
||||
bool LongCylV( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir, double dHei, double dRad) ;
|
||||
bool LongConusV( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad) ;
|
||||
// Asse di simmetria con orientazione generica
|
||||
bool CylBall_Drilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
bool CylBall_Milling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
|
||||
// Angolo generico fra movimento e versore utensile
|
||||
bool MillZ( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
|
||||
// Componenti
|
||||
bool MillCylV( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir, double dHei, double dRad) ;
|
||||
bool MillConusV( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad) ;
|
||||
bool Conus_Drilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
bool Conus_Milling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
|
||||
// Direzione generica del versore utensile
|
||||
// Movimento parallelo al versore utensile
|
||||
bool Drilling( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool DrillingGT( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool GenTool_Drilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
bool GenTool_Milling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
|
||||
// Componenti elementari degli untensili
|
||||
bool LongBall( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir, double dRad) ;
|
||||
bool LongCyl( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir, double dHei, double dRad) ;
|
||||
bool LongConus( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad) ;
|
||||
// COMPONENTI
|
||||
// Asse di simmetria diretto come l'asse Z
|
||||
|
||||
// Angolo generico fra movimento e versore utensile
|
||||
bool Milling( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
bool MillingGT( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
|
||||
|
||||
// Componenti elementari degli utensili
|
||||
bool MillCyl( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir, double dHei, double dRad) ;
|
||||
bool MillCyl2( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir, double dHei, double dRad) ;
|
||||
bool MillBall( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir, double dRad) ;
|
||||
bool MillConus( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad) ;
|
||||
bool MillConusAux( const Point3d& ptI, const Point3d& ptF, const Vector3d& vtV1, const Vector3d& vtV2, const Vector3d& vtV3,
|
||||
unsigned int & nStI, unsigned int & nStJ, unsigned int & nEnI, unsigned int & nEnJ,
|
||||
double dHei, double dMaxRad, double dMinRad, double dCoef) ;
|
||||
// Drilling
|
||||
bool CompCyl_ZDrilling( unsigned int nGrid, const Point3d & ptLs, const Point3d & ptLe, const Vector3d & vtToolDir, double dHei, double dRad) ;
|
||||
bool CompConus_ZDrilling( unsigned int nGrid, const Point3d & ptLs, const Point3d & ptLe, const Vector3d & vtToolDir, double dHei, double dMaxRad, double dMinRad) ;
|
||||
|
||||
// Traslazioni
|
||||
bool Ball( const Point3d& ptLs, const Point3d& ptLe, double dRad) ;
|
||||
// Milling
|
||||
bool CompCyl_ZMilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir, double dHei, double dRad) ;
|
||||
bool CompConus_ZMilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir, double dHei, double dMaxRad, double dMinRad) ;
|
||||
|
||||
// Sottrazione per tridexel
|
||||
bool ZDrillingCB( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir) ;
|
||||
// Asse di simmetria con orientazione generica
|
||||
|
||||
// Bounding Box
|
||||
inline bool BoundingBox( const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV1, const Vector3d& vtV2,
|
||||
unsigned int & nStI, unsigned int & nStJ, unsigned int & nEnI, unsigned int & nEnJ) ;
|
||||
// Drilling
|
||||
bool CompCyl_Drilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir, double dHei, double dRad) ;
|
||||
bool CompConus_Drilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir, double dHei, double dMaxRad, double dMinRad) ;
|
||||
|
||||
// Milling
|
||||
bool CompCyl_Milling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir, double dHei, double dRad) ;
|
||||
bool CompConus_Milling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir, double dHei, double dMaxRad, double dMinRad) ;
|
||||
bool CompConusAux_Milling( unsigned int nGrid, const Point3d & ptI, const Point3d & ptF, const Vector3d & vtV1, const Vector3d & vtV2, const Vector3d & vtV3,
|
||||
unsigned int & nStI, unsigned int & nStJ, unsigned int & nEnI, unsigned int & nEnJ,
|
||||
double dHei, double dMaxRad, double dMinRad, double dCoef) ;
|
||||
|
||||
// Generica traslazione sfera
|
||||
bool CompBall_Milling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, double dRad) ;
|
||||
|
||||
// BBox per utensili e solidi semplici
|
||||
inline bool BoundingBox( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV1, const Vector3d& vtV2,
|
||||
unsigned int & nStI, unsigned int & nStJ, unsigned int & nEnI, unsigned int & nEnJ) ;
|
||||
inline bool BoundingBox( const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV1, const Vector3d& vtV2) ;
|
||||
inline bool BBoxComponent( const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV1, const Vector3d& vtV2,
|
||||
unsigned int & nStI, unsigned int & nStJ, unsigned int & nEnI, unsigned int & nEnJ,
|
||||
double dRad, double dTipRad, double dHei) ;
|
||||
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ) ;
|
||||
inline bool BBoxComponent( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV1, const Vector3d& vtV2,
|
||||
unsigned int & nStI, unsigned int & nStJ, unsigned int & nEnI, unsigned int & nEnJ,
|
||||
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ,
|
||||
double dRad, double dTipRad, double dHei) ;
|
||||
|
||||
|
||||
// Intersezioni
|
||||
bool IntersLineBox( const Point3d& ptP, const Vector3d& vtV,
|
||||
const Point3d& ptMin, const Point3d& ptMax, double& dU1, double& dU2) ;
|
||||
bool IntersLineZMapBBox( unsigned int nGrid, const Point3d& ptP, const Vector3d& vtV, double& dU1, double& dU2) ;
|
||||
bool IntersLineDexel( unsigned int nGrid, const Point3d& ptP, const Vector3d& vtV, unsigned int nI, unsigned int nJ,
|
||||
double& dU1, double& dU2) ;
|
||||
bool IntersLineZMapBBox( const Point3d& ptP, const Vector3d& vtV, double& dU1, double& dU2) ;
|
||||
bool IntersLineDexel( const Point3d& ptP, const Vector3d& vtV, unsigned int nI, unsigned int nJ,
|
||||
double& dU1, double& dU2) ;
|
||||
double& dU1, double& dU2) ;
|
||||
bool IntersLineCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
||||
const Frame3d& CylFrame, double dL, double dR,
|
||||
Point3d& ptInt1, Point3d& ptInt2) ;
|
||||
bool IntersZLineCylinder( const Point3d& ptLine,
|
||||
const Point3d& ptBase, const Point3d& ptTop, const Vector3d& vtDir, double dCylR,
|
||||
double& dInfZ, double& dSupZ) ;
|
||||
bool IntersLineEllipticalCylinder( const Frame3d& CircFrame, const Vector3d& vtLineDir, const Point3d& ptLineSt,
|
||||
PNTVECTOR& ptInters, double dObCoef, double dSqRad, double dL) ;
|
||||
bool IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
||||
const Frame3d& ConusFrame, double dTan, double dl, double dL,
|
||||
Point3d& ptInt1, Point3d& ptInt2) ;
|
||||
bool IntersLineSphere( const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
||||
const Point3d& ptCenter, double dRad,
|
||||
Point3d& ptInt1, Point3d& ptInt2) ;
|
||||
|
||||
private :
|
||||
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
||||
@@ -248,47 +216,27 @@ class VolZmap : public IVolZmap, public IGeoObjRW
|
||||
private :
|
||||
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
||||
Status m_nStatus ; // stato
|
||||
int m_nTempProp ; // proprietà temporanea
|
||||
|
||||
Frame3d m_LocalFrame ;
|
||||
Frame3d m_LocalFrame2 ;
|
||||
Frame3d m_LocalFrame3 ;
|
||||
double m_dStep ;
|
||||
|
||||
unsigned int m_nNx ; // i = 0, 1, ..., m_nNx - 1
|
||||
unsigned int m_nNy ; // j = 0, 1, ..., m_nNy - 1
|
||||
unsigned int m_nNx2 ;
|
||||
unsigned int m_nNy2 ;
|
||||
unsigned int m_nNx3 ;
|
||||
unsigned int m_nNy3 ;
|
||||
unsigned int m_nDim ;
|
||||
unsigned int m_nDim2 ;
|
||||
unsigned int m_nDim3 ;
|
||||
|
||||
double m_dMinZ ;
|
||||
double m_dMaxZ ;
|
||||
|
||||
double m_dMinZ2 ;
|
||||
double m_dMaxZ2 ;
|
||||
|
||||
double m_dMinZ3 ;
|
||||
double m_dMaxZ3 ;
|
||||
|
||||
std::vector <std::vector<double>> m_ZValues ;
|
||||
std::vector <std::vector<double>> m_ZValues2 ;
|
||||
std::vector <std::vector<double>> m_ZValues3 ;
|
||||
|
||||
double m_dLinTol ;
|
||||
double m_dAngTolDeg ;
|
||||
std::string m_sToolName ;
|
||||
unsigned int m_nToolType ;
|
||||
int m_nTempProp ; // proprietà temporanea
|
||||
double m_dStep ; // passo delle griglie
|
||||
unsigned int m_nMapNum ; // numero di griglie ( 1 o 3)
|
||||
Frame3d m_MapFrame[3] ; // riferimenti delle griglie
|
||||
unsigned int m_nVNx[3] ; // dimensione di ciascuna griglia in X
|
||||
unsigned int m_nVNy[3] ; // dimensione di ciascuna griglia in Y
|
||||
unsigned int m_nVDim[3] ; // dimensione di ciascuna griglia ( X * Y)
|
||||
double m_dVMinZ[3] ; // minimo in Zlocale di ciascuna griglia
|
||||
double m_dVMaxZ[3] ; // massimo in Zlocale di ciascuna griglia
|
||||
std::vector<std::vector<double>> m_TriZValues[3] ; // dexel delle 3 griglie
|
||||
double m_dLinTol ; // dati per utensile
|
||||
double m_dAngTolDeg ;
|
||||
std::string m_sToolName ;
|
||||
unsigned int m_nToolType ;
|
||||
CurveComposite m_ToolOutline ;
|
||||
CurveComposite m_ToolArcLineApprox ;
|
||||
double m_dHeight ;
|
||||
double m_dTipHeight ;
|
||||
double m_dRadius ;
|
||||
double m_dRCorner ;
|
||||
double m_dTipRadius ;
|
||||
double m_dHeight ;
|
||||
double m_dTipHeight ;
|
||||
double m_dRadius ;
|
||||
double m_dRCorner ;
|
||||
double m_dTipRadius ;
|
||||
} ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -1,313 +0,0 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2016-2016
|
||||
//----------------------------------------------------------------------------
|
||||
// File : VolZmap.cpp Data : 03.11.16 Versione : 1.6w1
|
||||
// Contenuto : Implementazione della classe Volume Zmap : intersezioni.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 03.11.16 LM Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "VolZmap.h"
|
||||
#include "GeoConst.h"
|
||||
#include "\EgtDev\Include\EgtNumUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::IntersLineBox( const Point3d& ptP, const Vector3d& vtV,
|
||||
const Point3d& ptMin, const Point3d& ptMax, double& dU1, double& dU2)
|
||||
{
|
||||
// Il box è allineato agli assi
|
||||
|
||||
dU1 = - INFINITO ;
|
||||
dU2 = INFINITO ;
|
||||
|
||||
// confronto con piani YZ (perpendicolari ad asse X)
|
||||
if ( vtV.x > EPS_ZERO) {
|
||||
dU1 = max( dU1, ( ptMin.x - ptP.x) / vtV.x) ;
|
||||
dU2 = min( dU2, ( ptMax.x - ptP.x) / vtV.x) ;
|
||||
}
|
||||
else if ( vtV.x < - EPS_ZERO) {
|
||||
dU1 = max( dU1, ( ptMax.x - ptP.x) / vtV.x) ;
|
||||
dU2 = min( dU2, ( ptMin.x - ptP.x) / vtV.x) ;
|
||||
}
|
||||
else if ( ptP.x < ptMin.x - EPS_SMALL || ptP.x > ptMax.x + EPS_SMALL)
|
||||
return false ;
|
||||
|
||||
// confronto con piani ZX (perpendicolari ad asse Y)
|
||||
if ( vtV.y > EPS_ZERO) {
|
||||
dU1 = max( dU1, ( ptMin.y - ptP.y) / vtV.y) ;
|
||||
dU2 = min( dU2, ( ptMax.y - ptP.y) / vtV.y) ;
|
||||
}
|
||||
else if ( vtV.y < - EPS_ZERO) {
|
||||
dU1 = max( dU1, ( ptMax.y - ptP.y) / vtV.y) ;
|
||||
dU2 = min( dU2, ( ptMin.y - ptP.y) / vtV.y) ;
|
||||
}
|
||||
else if ( ptP.y < ptMin.y - EPS_SMALL || ptP.y > ptMax.y + EPS_SMALL)
|
||||
return false ;
|
||||
|
||||
// confronto con piani XZ (perpendicolari ad asse Z)
|
||||
if ( vtV.z > EPS_ZERO) {
|
||||
dU1 = max( dU1, ( ptMin.z - ptP.z) / vtV.z) ;
|
||||
dU2 = min( dU2, ( ptMax.z - ptP.z) / vtV.z) ;
|
||||
}
|
||||
else if ( vtV.z < - EPS_ZERO) {
|
||||
dU1 = max( dU1, ( ptMax.z - ptP.z) / vtV.z) ;
|
||||
dU2 = min( dU2, ( ptMin.z - ptP.z) / vtV.z) ;
|
||||
}
|
||||
else if ( ptP.z < ptMin.z - EPS_SMALL || ptP.z > ptMax.z + EPS_SMALL)
|
||||
return false ;
|
||||
|
||||
return ( dU2 >= dU1) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::IntersLineZMapBBox( const Point3d& ptP, const Vector3d& vtV, double& dU1, double& dU2)
|
||||
{
|
||||
// Punti estremi del box dello Zmap
|
||||
Point3d ptMin = ORIG ;
|
||||
Point3d ptMax = ptMin + m_nNx * m_dStep * X_AX + m_nNy * m_dStep * Y_AX + m_dMaxZ * Z_AX ;
|
||||
|
||||
if ( IntersLineBox( ptP, vtV, ptMin, ptMax, dU1, dU2) && ( dU1 > 0 || dU2 > 0)) {
|
||||
return true ;
|
||||
}
|
||||
|
||||
else {
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::IntersLineDexel( const Point3d& ptP, const Vector3d& vtV, unsigned int nI,
|
||||
unsigned int nJ, double& dU1, double& dU2)
|
||||
{
|
||||
// Determino l'indice del dexel e il doppio del numero di suo intervalli
|
||||
unsigned int nDexelPos = nJ * m_nNx + nI ;
|
||||
unsigned int nDexelSize = unsigned int( m_ZValues[nDexelPos].size()) ;
|
||||
|
||||
// Se non c'è materiale non devo fare alcunché
|
||||
if ( nDexelSize == 0)
|
||||
return false ;
|
||||
|
||||
// Determino estremi nel piano XY intrinseco del dexel
|
||||
double dXmin = nI * m_dStep ;
|
||||
double dYmin = nJ * m_dStep ;
|
||||
double dXmax = ( nI + 1) * m_dStep ;
|
||||
double dYmax = ( nJ + 1) * m_dStep ;
|
||||
|
||||
// ciclo sugli intervalli
|
||||
dU1 = INFINITO ;
|
||||
dU2 = - INFINITO ;
|
||||
bool bInters = false ;
|
||||
for ( unsigned int nIndex = 0 ; nIndex < nDexelSize ; nIndex += 2) {
|
||||
// estremi del box del singolo intervallo
|
||||
Point3d ptE1( dXmin, dYmin, m_ZValues[nDexelPos][nIndex]) ;
|
||||
Point3d ptE2( dXmax, dYmax, m_ZValues[nDexelPos][nIndex+1]) ;
|
||||
double dt1, dt2 ;
|
||||
if ( IntersLineBox( ptP, vtV, ptE1, ptE2, dt1, dt2)) {
|
||||
bInters = true ;
|
||||
dU1 = min( dU1, dt1) ;
|
||||
dU2 = max( dU2, dt2) ;
|
||||
}
|
||||
}
|
||||
|
||||
return bInters ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::GetDepth( const Point3d& ptPGlob, const Vector3d& vtDir, double& dInLength, double& dOutLength)
|
||||
{
|
||||
// Porto il raggio nel riferimento intrinseco
|
||||
Point3d ptP = ptPGlob ;
|
||||
ptP.ToLoc( m_LocalFrame) ;
|
||||
Vector3d vtV = vtDir ;
|
||||
vtV.ToLoc( m_LocalFrame) ;
|
||||
vtV.Normalize() ;
|
||||
|
||||
// Studio dell'intersezione fra semiretta e BBox dello Zmap
|
||||
double dU1, dU2 ;
|
||||
bool bTest = IntersLineZMapBBox( ptP, vtV, dU1, dU2) ;
|
||||
|
||||
// Semiretta esterna al box dello Zmap
|
||||
if ( ! bTest) {
|
||||
dInLength = - 2 ;
|
||||
dOutLength = - 2 ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
Point3d ptI, ptF ;
|
||||
// Una sola intersezione valida ( punto interno, intersezione valida 2)
|
||||
if ( dU1 < 0 && dU2 > 0) {
|
||||
ptI = ptP ;
|
||||
ptF = ptP + dU2 * vtV ;
|
||||
}
|
||||
// due soluzioni valide ( punto esterno)
|
||||
else {
|
||||
ptI = ptP + dU1 * vtV ;
|
||||
ptF = ptP + dU2 * vtV ;
|
||||
}
|
||||
|
||||
// Determinazione degli indici i j dei punti ptI e ptF
|
||||
int nIi = Clamp( int( floor( ptI.x / m_dStep)), 0, m_nNx - 1) ;
|
||||
int nIj = Clamp( int( floor( ptI.y / m_dStep)), 0, m_nNy - 1) ;
|
||||
int nFi = Clamp( int( floor( ptF.x / m_dStep)), 0, m_nNx - 1) ;
|
||||
int nFj = Clamp( int( floor( ptF.y / m_dStep)), 0, m_nNy - 1) ;
|
||||
|
||||
// Inizializzo distanze
|
||||
dInLength = INFINITO ;
|
||||
dOutLength = - INFINITO ;
|
||||
|
||||
// Variazioni
|
||||
double dDeltaX = ptF.x - ptI.x ;
|
||||
double dDeltaY = ptF.y - ptI.y ;
|
||||
|
||||
// se inclinazione da asse X minore di 45 gradi (in assoluto)
|
||||
if ( abs( dDeltaY) <= abs( dDeltaX)) {
|
||||
// mi muovo lungo X (i)
|
||||
int nIncrI = ( nFi >= nIi ? 1 : - 1) ;
|
||||
for ( int i = nIi, j = nIj ;
|
||||
i != nFi + nIncrI ;
|
||||
i += nIncrI) {
|
||||
|
||||
// Controllo con nuovo i e j corrente (considero il bordo sinistro del dexel)
|
||||
double dU1, dU2 ;
|
||||
if ( IntersLineDexel( ptP, vtV, i, j, dU1, dU2)) {
|
||||
dInLength = min( dInLength, dU1) ;
|
||||
dOutLength = max( dOutLength, dU2) ;
|
||||
}
|
||||
|
||||
// Mi sposto sul bordo destro del dexel
|
||||
double dMoveX = ( ( i + max( nIncrI, 0)) * m_dStep - ptI.x) ;
|
||||
double dMoveY = dMoveX * dDeltaY / dDeltaX ;
|
||||
double dY = ptI.y + dMoveY ;
|
||||
int OldJ = j ;
|
||||
j = Clamp( int( floor( dY / m_dStep)), 0, m_nNy - 1) ;
|
||||
|
||||
// Analisi del dexel
|
||||
if ( j != OldJ) {
|
||||
double dU1, dU2 ;
|
||||
if ( IntersLineDexel( ptP, vtV, i, j, dU1, dU2)) {
|
||||
dInLength = min( dInLength, dU1) ;
|
||||
dOutLength = max( dOutLength, dU2) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// altrimenti
|
||||
else {
|
||||
// mi muovo lungo Y (j)
|
||||
int nIncrJ = ( nFj >= nIj ? 1 : - 1) ;
|
||||
for ( int i = nIi, j = nIj ;
|
||||
j != nFj + nIncrJ ;
|
||||
j += nIncrJ) {
|
||||
|
||||
// Controllo con nuovo j e i corrente (considero il bordo sotto del dexel)
|
||||
double dU1, dU2 ;
|
||||
if ( IntersLineDexel( ptP, vtV, i, j, dU1, dU2)) {
|
||||
dInLength = min( dInLength, dU1) ;
|
||||
dOutLength = max( dOutLength, dU2) ;
|
||||
}
|
||||
|
||||
// Mi sposto sul bordo sopra del dexel
|
||||
double dMoveY = ( ( j + max( nIncrJ, 0)) * m_dStep - ptI.y) ;
|
||||
double dMoveX = dMoveY * dDeltaX / dDeltaY ;
|
||||
double dX = ptI.x + dMoveX ;
|
||||
int OldI = i ;
|
||||
i = Clamp( int( floor( dX / m_dStep)), 0, m_nNx - 1) ;
|
||||
|
||||
// Analisi del dexel
|
||||
if ( i != OldI) {
|
||||
double dU1, dU2 ;
|
||||
if ( IntersLineDexel( ptP, vtV, i, j, dU1, dU2)) {
|
||||
dInLength = min( dInLength, dU1) ;
|
||||
dOutLength = max( dOutLength, dU2) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Se non abbiamo incontrato materiale
|
||||
if ( dInLength > dOutLength - EPS_SMALL) {
|
||||
dInLength = - 2 ;
|
||||
dOutLength = - 2 ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
// Se parto dall'interno
|
||||
if ( dInLength < - EPS_SMALL)
|
||||
dInLength = - 1 ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::AvoidBox( const Frame3d& frBox, const Vector3d& vtDiag)
|
||||
{
|
||||
// BBox
|
||||
BBox3d b3Box( ORIG, ORIG + vtDiag) ;
|
||||
|
||||
// lo porto nel riferimento intrinseco dello Zmap
|
||||
b3Box.LocToLoc( frBox, m_LocalFrame) ;
|
||||
|
||||
// BBox dello Zmap nel suo riferimento intrinseco
|
||||
BBox3d b3Zmap( ORIG, Point3d( m_nNx * m_dStep, m_nNy * m_dStep, m_dMaxZ)) ;
|
||||
|
||||
// Se non interferiscono, posso uscire
|
||||
BBox3d b3Int ;
|
||||
if ( ! b3Zmap.FindIntersection( b3Box, b3Int))
|
||||
return true ;
|
||||
|
||||
// Limiti su indici
|
||||
int nStI = Clamp( int( b3Int.GetMin().x / m_dStep), 0, m_nNx -1) ;
|
||||
int nEnI = Clamp( int( b3Int.GetMax().x / m_dStep), 0, m_nNx -1) ;
|
||||
int nStJ = Clamp( int( b3Int.GetMin().y / m_dStep), 0, m_nNy -1) ;
|
||||
int nEnJ = Clamp( int( b3Int.GetMax().y / m_dStep), 0, m_nNy -1) ;
|
||||
|
||||
// Vettore direzione dei dexel nel riferimento del Box
|
||||
Vector3d vtK = Z_AX ; vtK.LocToLoc( m_LocalFrame, frBox) ;
|
||||
|
||||
// Riferimento intrinseco dei dexel nel riferimento del box
|
||||
Point3d ptO = ORIG ; ptO.LocToLoc( m_LocalFrame, frBox) ;
|
||||
Vector3d vtX = X_AX ; vtX.LocToLoc( m_LocalFrame, frBox) ;
|
||||
Vector3d vtY = Y_AX ; vtY.LocToLoc( m_LocalFrame, frBox) ;
|
||||
|
||||
// Ciclo di intersezione dei dexel con il BBox
|
||||
for ( int i = nStI ; i <= nEnI ; ++ i) {
|
||||
|
||||
for ( int j = nStJ ; j <= nEnJ ; ++ j) {
|
||||
|
||||
int nPos = j * m_nNx + i ;
|
||||
int nSize = int( m_ZValues[nPos].size()) ;
|
||||
if ( nSize == 0)
|
||||
continue ;
|
||||
|
||||
Point3d ptC = ptO + ( i + 0.5) * m_dStep * vtX + ( j + 0.5) * m_dStep * vtY ;
|
||||
|
||||
double dZmin, dZmax ;
|
||||
if ( IntersLineBox( ptC, vtK, ORIG, ORIG + vtDiag, dZmin, dZmax)) {
|
||||
|
||||
for ( int nIndex = 0 ; nIndex < nSize ; nIndex += 2) {
|
||||
if ( m_ZValues[nPos].size() == 0)
|
||||
continue ;
|
||||
if ( ! ( dZmax < m_ZValues[nPos][nIndex] - EPS_SMALL ||
|
||||
dZmin > m_ZValues[nPos][nIndex + 1] + EPS_SMALL))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -1,258 +0,0 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2016
|
||||
//----------------------------------------------------------------------------
|
||||
// File : VolZmap.cpp Data : 22.01.15 Versione : 1.6a4
|
||||
// Contenuto : Implementazione della classe Volume Zmap (singola griglia)
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 22.01.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "CurveLine.h"
|
||||
#include "VolZmap.h"
|
||||
#include "GeoConst.h"
|
||||
#include "IntersLineSurfTm.h"
|
||||
#include "\EgtDev\Include\EgtNumUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//---------- Creazione da parallelepipedo ------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::Create( const Point3d& ptO, double dLengthX, double dLengthY, double dLengthZ, double dPrec)
|
||||
{
|
||||
// Controlli sui parametri
|
||||
if ( dLengthX < EPS_SMALL || dLengthY < EPS_SMALL || dLengthZ < EPS_SMALL)
|
||||
return false ;
|
||||
|
||||
// Definisco il sistema di riferimento in trinseco dello Zmap
|
||||
m_LocalFrame.Set( ptO, X_AX, Y_AX, Z_AX) ;
|
||||
|
||||
// Il passo di discretizzazione non può essere inferiore a 100 * EPS_SMALL
|
||||
m_dStep = max( dPrec, 100 * EPS_SMALL) ;
|
||||
|
||||
// A partire dalle dimensioni di xy del grezzo determino il numero di colonne e righe
|
||||
// della griglia Zmap e da questi la dimensione del vettore di dexel
|
||||
m_nNx = static_cast <unsigned int> ( ceil( dLengthX / m_dStep)) ;
|
||||
m_nNy = static_cast <unsigned int> ( ceil( dLengthY / m_dStep)) ;
|
||||
|
||||
m_nDim = m_nNx * m_nNy ;
|
||||
|
||||
// Ridimensiono il vettore di dexel e creo lo Zmap
|
||||
m_ZValues.resize( m_nDim) ;
|
||||
|
||||
for ( int i = 0 ; i < int( m_nDim) ; i++) {
|
||||
m_ZValues[i].resize(2) ;
|
||||
m_ZValues[i][0] = 0 ;
|
||||
m_ZValues[i][1] = dLengthZ ;
|
||||
}
|
||||
|
||||
// Assegno il minimo e massimo valore di Z della mappa
|
||||
m_dMinZ = 0 ;
|
||||
m_dMaxZ = dLengthZ ;
|
||||
|
||||
m_nStatus = OK ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//---------- Creazione da flat region ----------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::CreateFromFlatRegion( const ISurfFlatRegion& Surf, double dLengthZ, double dPrec)
|
||||
{
|
||||
Point3d ptMapOrig, ptMapEnd ;
|
||||
|
||||
// Determino il bounding box della flat region
|
||||
BBox3d SurfBBox ;
|
||||
Surf.GetLocalBBox( SurfBBox, BBF_EXACT) ;
|
||||
|
||||
// Determino i punti estremi del bounding box
|
||||
SurfBBox.GetMinMax( ptMapOrig, ptMapEnd) ;
|
||||
|
||||
// Sistema di riferimento mappa
|
||||
m_LocalFrame.Set( ptMapOrig, X_AX, Y_AX, Z_AX) ;
|
||||
|
||||
// Il passo di discretizzazione non può essere inferiore a 100 * EPS_SMALL
|
||||
m_dStep = max( dPrec, 100 * EPS_SMALL) ;
|
||||
|
||||
// Determino le dimensioni lineari X Y della griglia
|
||||
double dLengthX = ptMapEnd.x - ptMapOrig.x ;
|
||||
double dLengthY = ptMapEnd.y - ptMapOrig.y ;
|
||||
|
||||
// A partire dalle dimensioni di xy del grezzo determino il numero di colonne e righe
|
||||
// della griglia Zmap e da questi la dimensione del vettore di dexel
|
||||
m_nNx = static_cast <unsigned int> ( ceil( dLengthX / m_dStep)) ;
|
||||
m_nNy = static_cast <unsigned int> ( ceil( dLengthY / m_dStep)) ;
|
||||
|
||||
m_nDim = m_nNx * m_nNy ;
|
||||
|
||||
// Ridimensiono il vettore di dexel e creo lo Zmap
|
||||
m_ZValues.resize( m_nDim) ;
|
||||
|
||||
// Determinazione e ridimensionamento dei dexel
|
||||
// interni alla regione
|
||||
for ( unsigned int i = 0 ; i < m_nNx ; ++ i) {
|
||||
|
||||
// Definisco la retta da intersecare con la regione
|
||||
double dX = ( i + 0.5) * m_dStep ;
|
||||
Point3d ptP0 = ptMapOrig + Vector3d( dX, 0, 0) ;
|
||||
CurveLine GridLine ;
|
||||
GridLine.SetPVL( ptP0, Y_AX, dLengthY) ;
|
||||
|
||||
// Determino le intersezioni della retta con la regione
|
||||
CRVCVECTOR IntersectionResults ;
|
||||
Surf.GetCurveClassification( GridLine, IntersectionResults) ;
|
||||
// Parti di cui la retta analizzata è composta
|
||||
int nPart = int( IntersectionResults.size()) ;
|
||||
|
||||
// Analizzo le parti
|
||||
for ( int k = 0 ; k < nPart ; ++ k) {
|
||||
|
||||
// Tipo di curva
|
||||
int nType = IntersectionResults[k].nClass ;
|
||||
|
||||
// Se la retta è interna alla regione o coincidente con parte della sua frontiera
|
||||
if ( nType == CRVC_IN || nType == CRVC_ON_P || nType == CRVC_ON_M) {
|
||||
|
||||
// Parametri iniziale e finale
|
||||
double dt1 = IntersectionResults[k].dParS ;
|
||||
double dt2 = IntersectionResults[k].dParE ;
|
||||
|
||||
// Indici corrispondenti alle coordinate dei punti
|
||||
int nStartJ = Clamp( int( floor( dt1 * dLengthY / m_dStep + 0.5)), 0, m_nNy - 1) ;
|
||||
int nEndJ = Clamp( int( floor( dt2 * dLengthY / m_dStep - 0.5)), 0, m_nNy - 1) ;
|
||||
|
||||
// Ridimensiono e riempio i dexel
|
||||
for ( int j = nStartJ ; j <= nEndJ ; ++ j) {
|
||||
// Determino il dexel
|
||||
int nPos = j * m_nNx + i ;
|
||||
|
||||
m_ZValues[nPos].resize( 2) ;
|
||||
// Aggiorno le quote estreme del segmento
|
||||
m_ZValues[nPos][0] = 0 ;
|
||||
m_ZValues[nPos][1] = dLengthZ ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Assegno il minimo e massimo valore di Z della mappa
|
||||
m_dMinZ = 0 ;
|
||||
m_dMaxZ = dLengthZ ;
|
||||
|
||||
m_nStatus = OK ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//---------- Creazione da trimesh --------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::CreateFromTriMesh( const ISurfTriMesh& Surf, double dPrec)
|
||||
{
|
||||
// Se la superficie non è chiusa non ha senso continuare
|
||||
if ( ! Surf.IsClosed())
|
||||
return false ;
|
||||
|
||||
// Determino il bounding box della TriMesh
|
||||
BBox3d SurfBBox ;
|
||||
Surf.GetLocalBBox( SurfBBox) ;
|
||||
|
||||
// Determino i punti estremi del bounding box
|
||||
Point3d ptMapOrig, ptMapEnd ;
|
||||
SurfBBox.GetMinMax( ptMapOrig, ptMapEnd) ;
|
||||
|
||||
// Sistema di riferimento mappa
|
||||
m_LocalFrame.Set( ptMapOrig, Frame3d::TOP) ;
|
||||
|
||||
// Il passo di discretizzazione non può essere inferiore a 100 * EPS_SMALL
|
||||
m_dStep = max( dPrec, 100 * EPS_SMALL) ;
|
||||
|
||||
// Determino le dimensioni lineari X Y della griglia
|
||||
double dLengthX = ptMapEnd.x - ptMapOrig.x ;
|
||||
double dLengthY = ptMapEnd.y - ptMapOrig.y ;
|
||||
double dLengthZ = ptMapEnd.z - ptMapOrig.z ;
|
||||
|
||||
// A partire dalle dimensioni di xy del grezzo determino il numero di colonne e righe
|
||||
// della griglia Zmap e da questi la dimensione del vettore di dexel
|
||||
m_nNx = static_cast <unsigned int> ( ceil( dLengthX / m_dStep)) ;
|
||||
m_nNy = static_cast <unsigned int> ( ceil( dLengthY / m_dStep)) ;
|
||||
|
||||
m_nDim = m_nNx * m_nNy ;
|
||||
|
||||
// Ridimensiono il vettore di dexel e creo lo Zmap
|
||||
m_ZValues.resize( m_nDim) ;
|
||||
|
||||
// Oggetto per calcolo massivo intersezioni
|
||||
IntersParLinesSurfTm intPLSTM( m_LocalFrame, Surf) ;
|
||||
|
||||
// Determinazione e ridimensionamento dei dexel interni alla trimesh
|
||||
for ( unsigned int i = 0 ; i < m_nNx ; ++ i) {
|
||||
|
||||
for ( unsigned int j = 0 ; j < m_nNy ; ++ j) {
|
||||
|
||||
// Definisco la retta da intersecare con la trimesh
|
||||
double dX = ( i + 0.5) * m_dStep ;
|
||||
double dY = ( j + 0.5) * m_dStep ;
|
||||
Point3d ptP0( dX, dY, 0) ;
|
||||
|
||||
// Determino le intersezioni della retta con la TriMesh
|
||||
ILSIVECTOR IntersectionResults ;
|
||||
intPLSTM.GetInters( ptP0, dLengthZ, IntersectionResults) ;
|
||||
|
||||
int nInt = int( IntersectionResults.size()) ;
|
||||
|
||||
unsigned int nPos = j * m_nNx + i ;
|
||||
|
||||
bool bInside = false ;
|
||||
Point3d ptIn ;
|
||||
for ( int k = 0 ; k < nInt ; ++ k) {
|
||||
|
||||
int nIntType = IntersectionResults[k].nILTT ;
|
||||
|
||||
// Se c'è intersezione
|
||||
if ( nIntType != ILTT_NO) {
|
||||
|
||||
double dCos = IntersectionResults[k].dCosDN ;
|
||||
|
||||
// entro nella superficie trimesh
|
||||
if ( dCos < - EPS_SMALL) {
|
||||
|
||||
ptIn = IntersectionResults[k].ptI ;
|
||||
|
||||
bInside = true ;
|
||||
}
|
||||
|
||||
// esco dalla superficie trimesh
|
||||
else if ( dCos > EPS_SMALL && bInside) {
|
||||
|
||||
Point3d ptOut = IntersectionResults[k].ptI ;
|
||||
|
||||
unsigned int nCurrentSize = unsigned int( m_ZValues[nPos].size()) ;
|
||||
|
||||
m_ZValues[nPos].resize( nCurrentSize + 2) ;
|
||||
|
||||
m_ZValues[nPos][nCurrentSize] = ptIn.z - ptMapOrig.z ;
|
||||
m_ZValues[nPos][nCurrentSize + 1] = ptOut.z - ptMapOrig.z ;
|
||||
|
||||
bInside = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Assegno il minimo e massimo valore di Z della mappa
|
||||
m_dMinZ = 0 ;
|
||||
m_dMaxZ = dLengthZ ;
|
||||
|
||||
m_nStatus = OK ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -1,255 +0,0 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2016
|
||||
//----------------------------------------------------------------------------
|
||||
// File : VolZmap.cpp Data : 22.01.15 Versione : 1.6a4
|
||||
// Contenuto : Implementazione della classe Volume Zmap (singola griglia)
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 22.01.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "VolZmap.h"
|
||||
#include "GeoConst.h"
|
||||
#include "\EgtDev\Include\EGkIntervals.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::GetDexelLines( int nDir, int nPos1, int nPos2, POLYLINELIST& lstPL) const
|
||||
{
|
||||
// per ora solo perpendicolari a XY (1)
|
||||
if ( nDir != 1)
|
||||
return false ;
|
||||
// verifiche sugli indici
|
||||
if ( nPos1 < 0 || nPos1 >= int( m_nNx) || nPos2 < 0 || nPos2 >= int( m_nNy))
|
||||
return false ;
|
||||
int nPos = nPos1 + nPos2 * m_nNx ;
|
||||
if ( nPos < 0 || nPos >= int( m_ZValues.size()))
|
||||
return false ;
|
||||
// calcolo coordinate punto
|
||||
double dX = m_dStep * ( 0.5 + nPos1) ;
|
||||
double dY = m_dStep * ( 0.5 + nPos2) ;
|
||||
Point3d ptP = m_LocalFrame.Orig() + dX * m_LocalFrame.VersX() + dY * m_LocalFrame.VersY() ;
|
||||
// creo le polilinee
|
||||
for ( int i = 1 ; i < int( m_ZValues[nPos].size()) ; i += 2) {
|
||||
// aggiungo polilinea a lista
|
||||
lstPL.emplace_back() ;
|
||||
// inserisco punti estremi
|
||||
lstPL.back().AddUPoint( 0, ptP + m_ZValues[nPos][i-1] * m_LocalFrame.VersZ()) ;
|
||||
lstPL.back().AddUPoint( 1, ptP + m_ZValues[nPos][i] * m_LocalFrame.VersZ()) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::GetAllTriangles( TRIA3DLIST& lstTria) const
|
||||
{
|
||||
const int MAX_DIM_CHUNK = 128 ;
|
||||
for ( int i = 0 ; i < int( m_nNx) ; i += MAX_DIM_CHUNK) {
|
||||
int nDimChunkX = min( MAX_DIM_CHUNK, int( m_nNx) - i) ;
|
||||
for ( int j = 0 ; j < int( m_nNy) ; j += MAX_DIM_CHUNK) {
|
||||
int nDimChunkY = min( MAX_DIM_CHUNK, int( m_nNy) - j) ;
|
||||
GetChunkPrisms( i, j, nDimChunkX, nDimChunkY, MAX_DIM_CHUNK, lstTria) ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::GetChunkPrisms( int nPos1, int nPos2, int nDim1, int nDim2, int nDimChk, TRIA3DLIST& lstTria) const
|
||||
{
|
||||
// determino se è un semplice parallelepipedo
|
||||
bool bIsSimple = true ;
|
||||
double dBotZ ;
|
||||
double dTopZ ;
|
||||
for ( int i = 0 ; i < nDim1 && bIsSimple ; ++ i) {
|
||||
for ( int j = 0 ; j < nDim2 && bIsSimple ; ++ j) {
|
||||
int nPos = ( nPos1 + i) + ( nPos2 + j) * m_nNx ;
|
||||
if ( nPos > int( m_nDim) ||
|
||||
int( m_ZValues[nPos].size()) != 2)
|
||||
bIsSimple = false ;
|
||||
else if ( i == 0 && j == 0) {
|
||||
dBotZ = m_ZValues[nPos][0] ;
|
||||
dTopZ = m_ZValues[nPos][1] ;
|
||||
}
|
||||
else if ( abs( m_ZValues[nPos][0] - dBotZ) > EPS_SMALL ||
|
||||
abs( m_ZValues[nPos][1] - dTopZ) > EPS_SMALL)
|
||||
bIsSimple = false ;
|
||||
}
|
||||
}
|
||||
|
||||
// se semplice parallelepipedo
|
||||
if ( bIsSimple) {
|
||||
CalcChunkPrisms( nPos1, nPos2, nDim1, nDim2, lstTria) ;
|
||||
}
|
||||
// se chunk di dimensioni accettabili
|
||||
else if ( nDimChk >= 4) {
|
||||
int nNewDimChk = nDimChk / 2 ;
|
||||
for ( int i = nPos1 ; i < int( nPos1 + nDim1) ; i += nNewDimChk) {
|
||||
int nDimChunkX = min( nNewDimChk, int( nPos1 + nDim1) - i) ;
|
||||
for ( int j = nPos2 ; j < int( nPos2 + nDim2) ; j += nNewDimChk) {
|
||||
int nDimChunkY = min( nNewDimChk, int( nPos2 + nDim2) - j) ;
|
||||
GetChunkPrisms( i, j, nDimChunkX, nDimChunkY, nNewDimChk, lstTria) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
// elaboro ogni singolo dexel
|
||||
for ( int i = 0 ; i < nDim1 ; ++ i) {
|
||||
for ( int j = 0 ; j < nDim2 ; ++ j) {
|
||||
CalcDexelPrisms( nPos1 + i, nPos2 + j, lstTria) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::CalcChunkPrisms( int nPos1, int nPos2, int nDim1, int nDim2, TRIA3DLIST& lstTria) const
|
||||
{
|
||||
// verifiche sugli indici
|
||||
if ( nPos1 < 0 || nPos1 + nDim1 > int( m_nNx) || nPos2 < 0 || nPos2 + nDim2 > int( m_nNy))
|
||||
return false ;
|
||||
int nPos = nPos1 + nPos2 * m_nNx ;
|
||||
if ( nPos < 0 || nPos >= int( m_nDim))
|
||||
return false ;
|
||||
|
||||
// calcolo coordinate punti
|
||||
double dX = m_dStep * nPos1 ;
|
||||
double dY = m_dStep * nPos2 ;
|
||||
Point3d ptP1 = m_LocalFrame.Orig() + dX * m_LocalFrame.VersX() + dY * m_LocalFrame.VersY() ;
|
||||
Point3d ptP2 = ptP1 + nDim1 * m_dStep * m_LocalFrame.VersX() ;
|
||||
Point3d ptP3 = ptP2 + nDim2 * m_dStep * m_LocalFrame.VersY() ;
|
||||
Point3d ptP4 = ptP1 + nDim2 * m_dStep * m_LocalFrame.VersY() ;
|
||||
|
||||
// creo le facce sopra e sotto
|
||||
Vector3d vtDZt = m_ZValues[nPos][1] * m_LocalFrame.VersZ() ;
|
||||
Vector3d vtDZb = m_ZValues[nPos][0] * m_LocalFrame.VersZ() ;
|
||||
// faccia superiore P1t->P2t->P3t->P4t : sempre visibile
|
||||
lstTria.emplace_back() ;
|
||||
lstTria.back().Set( ptP1 + vtDZt, ptP2 + vtDZt, ptP3 + vtDZt, m_LocalFrame.VersZ()) ;
|
||||
lstTria.emplace_back() ;
|
||||
lstTria.back().Set( ptP3 + vtDZt, ptP4 + vtDZt, ptP1 + vtDZt, m_LocalFrame.VersZ()) ;
|
||||
// faccia inferiore P1b->P4b->P3b->P2b : sempre visibile
|
||||
lstTria.emplace_back() ;
|
||||
lstTria.back().Set( ptP1 + vtDZb, ptP4 + vtDZb, ptP3 + vtDZb, - m_LocalFrame.VersZ()) ;
|
||||
lstTria.emplace_back() ;
|
||||
lstTria.back().Set( ptP3 + vtDZb, ptP2 + vtDZb, ptP1 + vtDZb, - m_LocalFrame.VersZ()) ;
|
||||
|
||||
// creo le facce laterali
|
||||
for ( int j = 0 ; j < nDim2 ; ++ j) {
|
||||
int nPosD = nPos + nDim1 - 1 + j * m_nNx ;
|
||||
int nPosEst = ( nPos1 + nDim1 - 1 < int( m_nNx - 1) ? nPosD + 1 : - 1) ;
|
||||
Point3d ptP2D = ptP2 + j * m_dStep * m_LocalFrame.VersY() ;
|
||||
Point3d ptP3D = ptP2D + m_dStep * m_LocalFrame.VersY() ;
|
||||
AddDexelSideFace( nPosD, nPosEst, ptP2D, ptP3D, m_LocalFrame.VersZ(), m_LocalFrame.VersX(), lstTria) ;
|
||||
}
|
||||
for ( int i = 0 ; i < nDim1 ; ++ i) {
|
||||
int nPosD = nPos + ( nDim2 - 1) * m_nNx + i ;
|
||||
int nPosNord = ( nPos2 + nDim2 - 1 < int( m_nNy - 1) ? nPosD + m_nNx : - 1) ;
|
||||
Point3d ptP4D = ptP4 + i * m_dStep * m_LocalFrame.VersX() ;
|
||||
Point3d ptP3D = ptP4D + m_dStep * m_LocalFrame.VersX() ;
|
||||
AddDexelSideFace( nPosD, nPosNord, ptP3D, ptP4D, m_LocalFrame.VersZ(), m_LocalFrame.VersY(), lstTria) ;
|
||||
}
|
||||
for ( int j = 0 ; j < nDim2 ; ++ j) {
|
||||
int nPosD = nPos + j * m_nNx ;
|
||||
int nPosWest = ( nPos1 > 0 ? nPosD - 1 : - 1) ;
|
||||
Point3d ptP1D = ptP1 + j * m_dStep * m_LocalFrame.VersY() ;
|
||||
Point3d ptP4D = ptP1D + m_dStep * m_LocalFrame.VersY() ;
|
||||
AddDexelSideFace( nPosD, nPosWest, ptP4D, ptP1D, m_LocalFrame.VersZ(), - m_LocalFrame.VersX(), lstTria) ;
|
||||
}
|
||||
for ( int i = 0 ; i < nDim1 ; ++ i) {
|
||||
int nPosD = nPos + i ;
|
||||
int nPosSud = ( nPos2 > 0 ? nPosD - m_nNx : - 1) ;
|
||||
Point3d ptP1D = ptP1 + i * m_dStep * m_LocalFrame.VersX() ;
|
||||
Point3d ptP2D = ptP1D + m_dStep * m_LocalFrame.VersX() ;
|
||||
AddDexelSideFace( nPosD, nPosSud, ptP1D, ptP2D, m_LocalFrame.VersZ(), - m_LocalFrame.VersY(), lstTria) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::CalcDexelPrisms( int nPos1, int nPos2, TRIA3DLIST& lstTria) const
|
||||
{
|
||||
// verifiche sugli indici
|
||||
if ( nPos1 < 0 || nPos1 >= int( m_nNx) || nPos2 < 0 || nPos2 >= int( m_nNy))
|
||||
return false ;
|
||||
int nPos = nPos1 + nPos2 * m_nNx ;
|
||||
if ( nPos < 0 || nPos >= int( m_nDim))
|
||||
return false ;
|
||||
|
||||
// calcolo coordinate punto
|
||||
double dX = m_dStep * nPos1 ;
|
||||
double dY = m_dStep * nPos2 ;
|
||||
Point3d ptP1 = m_LocalFrame.Orig() + dX * m_LocalFrame.VersX() + dY * m_LocalFrame.VersY() ;
|
||||
Point3d ptP2 = ptP1 + m_dStep * m_LocalFrame.VersX() ;
|
||||
Point3d ptP3 = ptP2 + m_dStep * m_LocalFrame.VersY() ;
|
||||
Point3d ptP4 = ptP1 + m_dStep * m_LocalFrame.VersY() ;
|
||||
|
||||
// creo le facce sopra e sotto di ogni intervallo (sempre visibili)
|
||||
for ( int i = 1 ; i < int( m_ZValues[nPos].size()) ; i += 2) {
|
||||
Vector3d vtDZt = m_ZValues[nPos][i] * m_LocalFrame.VersZ() ;
|
||||
Vector3d vtDZb = m_ZValues[nPos][i-1] * m_LocalFrame.VersZ() ;
|
||||
// faccia superiore P1t->P2t->P3t->P4t : sempre visibile
|
||||
lstTria.emplace_back() ;
|
||||
lstTria.back().Set( ptP1 + vtDZt, ptP2 + vtDZt, ptP3 + vtDZt, m_LocalFrame.VersZ()) ;
|
||||
lstTria.emplace_back() ;
|
||||
lstTria.back().Set( ptP3 + vtDZt, ptP4 + vtDZt, ptP1 + vtDZt, m_LocalFrame.VersZ()) ;
|
||||
// faccia inferiore P1b->P4b->P3b->P2b : sempre visibile
|
||||
lstTria.emplace_back() ;
|
||||
lstTria.back().Set( ptP1 + vtDZb, ptP4 + vtDZb, ptP3 + vtDZb, - m_LocalFrame.VersZ()) ;
|
||||
lstTria.emplace_back() ;
|
||||
lstTria.back().Set( ptP3 + vtDZb, ptP2 + vtDZb, ptP1 + vtDZb, - m_LocalFrame.VersZ()) ;
|
||||
}
|
||||
|
||||
// creo le facce laterali
|
||||
int nPosEst = ( nPos1 < int( m_nNx - 1) ? nPos + 1 : - 1) ;
|
||||
AddDexelSideFace( nPos, nPosEst, ptP2, ptP3, m_LocalFrame.VersZ(), m_LocalFrame.VersX(), lstTria) ;
|
||||
int nPosNord = ( nPos2 < int( m_nNy - 1) ? nPos + m_nNx : - 1) ;
|
||||
AddDexelSideFace( nPos, nPosNord, ptP3, ptP4, m_LocalFrame.VersZ(), m_LocalFrame.VersY(), lstTria) ;
|
||||
int nPosWest = ( nPos1 > 0 ? nPos - 1 : - 1) ;
|
||||
AddDexelSideFace( nPos, nPosWest, ptP4, ptP1, m_LocalFrame.VersZ(), - m_LocalFrame.VersX(), lstTria) ;
|
||||
int nPosSud = ( nPos2 > 0 ? nPos - m_nNx : - 1) ;
|
||||
AddDexelSideFace( nPos, nPosSud, ptP1, ptP2, m_LocalFrame.VersZ(), - m_LocalFrame.VersY(), lstTria) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::AddDexelSideFace( int nPos, int nPosAdj, const Point3d& ptP, const Point3d& ptQ,
|
||||
const Vector3d& vtZ, const Vector3d& vtNorm, TRIA3DLIST& lstTria) const
|
||||
{
|
||||
Intervals intFace ;
|
||||
for ( int i = 1 ; i < int( m_ZValues[nPos].size()) ; i += 2)
|
||||
intFace.Add( m_ZValues[nPos][i-1], m_ZValues[nPos][i]) ;
|
||||
if ( nPosAdj > 0) {
|
||||
for ( int i = 1 ; i < int( m_ZValues[nPosAdj].size()) ; i += 2)
|
||||
intFace.Subtract( m_ZValues[nPosAdj][i-1], m_ZValues[nPosAdj][i]) ;
|
||||
}
|
||||
double dMin, dMax ;
|
||||
bool bFound = intFace.GetFirst( dMin, dMax) ;
|
||||
while ( bFound) {
|
||||
Vector3d vtDZt = dMax * vtZ ;
|
||||
Vector3d vtDZb = dMin * vtZ ;
|
||||
lstTria.emplace_back() ;
|
||||
lstTria.back().Set( ptP + vtDZb, ptQ + vtDZb, ptQ + vtDZt, vtNorm) ;
|
||||
lstTria.emplace_back() ;
|
||||
lstTria.back().Set( ptQ + vtDZt, ptP + vtDZt, ptP + vtDZb, vtNorm) ;
|
||||
bFound = intFace.GetNext( dMin, dMax) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
-8524
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user