fc00d6273a
- generalizzato l'uso di override (ovviamente dove va messo).
408 lines
26 KiB
C++
408 lines
26 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2015
|
|
//----------------------------------------------------------------------------
|
|
// File : VolZmap.h Data : 22.01.15 Versione : 1.6a4
|
|
// Contenuto : Dichiarazione della classe Volume Zmap.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 22.01.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "ObjGraphicsMgr.h"
|
|
#include "GeoObjRW.h"
|
|
#include "CurveComposite.h"
|
|
#include "SurfFlatRegion.h"
|
|
#include "CurveLine.h"
|
|
#include "Tool.h"
|
|
#include "/EgtDev/Include/EGkVolZmap.h"
|
|
#include "/EgtDev/Include/EGkPoint3d.h"
|
|
#include "/EgtDev/Include/EGkVector3d.h"
|
|
#include "/EgtDev/Include/ENkPolynomialRoots.h"
|
|
#include "/EgtDev/Include/EgkIntersLinesurfTm.h"
|
|
#include <unordered_map>
|
|
#include <stack>
|
|
|
|
// ------------------------- STRUTTURE -----------------------------------------------------------
|
|
struct AppliedVector {
|
|
Point3d ptPApp ;
|
|
Vector3d vtVec ;
|
|
int nPropIndex ;
|
|
} ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
class VolZmap : public IVolZmap, public IGeoObjRW
|
|
{
|
|
public : // IGeoObj
|
|
~VolZmap( void) override ;
|
|
VolZmap* Clone( void) const override ;
|
|
GeoObjType GetType( void) const override ;
|
|
bool IsValid( void) const override
|
|
{ return ( m_nStatus == OK) ; }
|
|
const std::string& GetTitle( void) const override ;
|
|
bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
|
|
bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const override ;
|
|
bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const override ;
|
|
bool Translate( const Vector3d& vtMove) override ;
|
|
bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg) override
|
|
{ double dAngRad = dAngDeg * DEGTORAD ;
|
|
return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
|
|
bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) override ;
|
|
bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) override ;
|
|
bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) override ;
|
|
bool Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) override ;
|
|
bool ToGlob( const Frame3d& frRef) override ;
|
|
bool ToLoc( const Frame3d& frRef) override ;
|
|
bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest) override ;
|
|
void SetObjGraphics( IObjGraphics* pOGr) override
|
|
{ m_OGrMgr.SetObjGraphics( pOGr) ; }
|
|
IObjGraphics* GetObjGraphics( void) override
|
|
{ return m_OGrMgr.GetObjGraphics() ; }
|
|
const IObjGraphics* GetObjGraphics( void) const override
|
|
{ return m_OGrMgr.GetObjGraphics() ; }
|
|
void SetTempProp( int nProp) override
|
|
{ m_nTempProp = nProp ; }
|
|
int GetTempProp( void) override
|
|
{ return m_nTempProp ; }
|
|
|
|
public : // IVolZmap
|
|
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
|
bool Clear( void) override ;
|
|
bool Create( const Point3d& ptO, double dDimX, double dDimY, double dDimZ, double dStep, bool bTriDex) override ;
|
|
bool CreateFromFlatRegion( const ISurfFlatRegion& Surf, double dDimZ, double dStep, bool bTriDex) override ;
|
|
bool CreateFromTriMesh( const ISurfTriMesh& Surf, double dStep, bool bTriDex) override ;
|
|
bool GetAllTriangles( TRIA3DEXLIST& lstTria) const override ;
|
|
int GetBlockCount( void) const override ;
|
|
bool GetVolume( double& dVol) const override ;
|
|
int GetPartCount( void) const override ;
|
|
bool GetPartVolume( int nPart, double& dVol) const override ;
|
|
bool GetTriangles( bool bAllBlocks, INTVECTOR& nModifiedBlocks, TRIA3DEXLISTVECTOR& vLstTria) const override ;
|
|
bool GetDexelLines( int nDir, int nPos1, int nPos2, POLYLINELIST& lstPL) const override ;
|
|
bool SetTolerances( double dLinTol, double dAngTolDeg = 90) override ;
|
|
bool SetStdTool( const std::string& sToolName, double dH, double dR, double dCornR, int nFlag) override ;
|
|
bool SetAdvTool( const std::string& sToolName,
|
|
double dH, double dR, double dTipH, double dTipR, double dCornR, int nFlag) override ;
|
|
bool SetSawTool( const std::string& sToolName,
|
|
double dH, double dR, double dThick, double dStemR, double dCornR, int nFlag) override ;
|
|
bool SetGenTool( const std::string& sToolName, const ICurveComposite* pToolOutline, int nFlag) override ;
|
|
bool SetMortiserTool( const std::string& sToolName, double dH, double dW, double dTh, double dRc, int nFlag) override ;
|
|
bool SetChiselTool( const std::string& sToolName, double dH, double dW, double dTh, int nFlag) override ;
|
|
bool MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Point3d& ptPe, const Vector3d& vtDe) override ;
|
|
bool MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d& vtAs,
|
|
const Point3d& ptPe, const Vector3d& vtDe, const Vector3d& vtAe) override ;
|
|
bool GetDepth( const Point3d& ptP, const Vector3d& vtD, double& dInLength, double& dOutLength, bool bExact) const override ;
|
|
bool GetDepthWithDexel( const Point3d& ptP, const Vector3d& vtDir, double& dInLength, double& dOutLength) const ;
|
|
bool GetDepthWithVoxel( const Point3d& ptP, const Vector3d& vtDir, double& dInLength, double& dOutLength, bool bEnh) const ;
|
|
bool GetPlaneIntersection( const Plane3d& plPlane, ICURVEPOVECTOR& vpLoop) const override ;
|
|
bool AvoidBox( const Frame3d& frBox, const Vector3d& vtDiag) const override ;
|
|
bool AvoidSphere( const Point3d& ptCenter, double dRad) const override ;
|
|
bool AvoidCylinder( const Frame3d& frCyl, double dL, double dR) const override ;
|
|
VolZmap* ClonePart( int nPart) const override ;
|
|
bool RemovePart( int nPart) override ;
|
|
|
|
public : // IGeoObjRW
|
|
int GetNgeId( void) const override ;
|
|
bool Save( NgeWriter& ngeOut) const override ;
|
|
bool Load( NgeReader& ngeIn) override ;
|
|
|
|
public :
|
|
VolZmap( void) ;
|
|
VolZmap( const VolZmap& stSrc)
|
|
{ if ( ! CopyFrom( stSrc))
|
|
LOG_ERROR( GetEGkLogger(), "VolZmap : copy constructor error") }
|
|
VolZmap& operator =( const VolZmap& stSrc)
|
|
{ if ( ! CopyFrom( stSrc))
|
|
LOG_ERROR( GetEGkLogger(), "VolZmap : copy error")
|
|
return *this ; }
|
|
|
|
private :
|
|
enum CubeType { VOX_EXTERN = 1,
|
|
VOX_ON_BOUNDARY = 0,
|
|
VOX_INNER = -1} ;
|
|
// Per la creazione dei rettangoli grandi
|
|
struct HeigthAndColor {
|
|
int nTool ;
|
|
double dHeigth ;
|
|
HeigthAndColor( void) : nTool( 0), dHeigth( 0) {}
|
|
HeigthAndColor( int nT, double dH) : nTool( nT), dHeigth( dH) {}
|
|
} ;
|
|
typedef std::unordered_map <int, HeigthAndColor> FlatVoxelContainer ;
|
|
// Struttura indici di voxel
|
|
struct VoxelIndexes {
|
|
int nI, nJ, nK ;
|
|
} ;
|
|
// Struttura per componenti connesse
|
|
struct ConComp {
|
|
Point3d ptVert ;
|
|
AppliedVector CompVecField[7] ;
|
|
int nVertNum ;
|
|
bool bInside ;
|
|
bool bCorner ;
|
|
} ;
|
|
// Struttura per Voxel
|
|
struct Voxel {
|
|
int i, j, k ;
|
|
int nNumComp ;
|
|
ConComp Compo[4] ;
|
|
} ;
|
|
// Triangoli
|
|
struct TriaStruct {
|
|
int i, j, k ;
|
|
PNTVECTOR ptCompoVert ;
|
|
std::vector<TRIA3DEXVECTOR> vCompoTria ;
|
|
std::vector<BOOLVECTOR> vbFlipped ;
|
|
} ;
|
|
// Vettore di TriaStruct con sharp feature interni a un blocco
|
|
typedef std::vector<TriaStruct> TriHolder ;
|
|
// Vettore di TriHolder con sharp feature di frontiera: il primo indice individua il blocco, il secondo il voxel
|
|
typedef std::vector<TriHolder> TriaMatrix ;
|
|
// Tavola hash di Voxel
|
|
typedef std::unordered_map <int, Voxel> VoxelContainer ;
|
|
// Unordered map per la coerenza topologica
|
|
typedef std::unordered_map <int, bool> InterVoxMatter ;
|
|
|
|
private :
|
|
bool CopyFrom( const VolZmap& clSrc) ;
|
|
bool ResetGraphics( void) ;
|
|
bool GetChunkPrisms( int nPos1, int nPos2, int nDim1, int nDim2, int nDimChk, TRIA3DEXLIST& lstTria) const ;
|
|
bool CalcChunkPrisms( int nPos1, int nPos2, int nDim1, int nDim2, TRIA3DEXLIST& lstTria) const ;
|
|
bool CalcDexelPrisms( int nPos1, int nPos2, TRIA3DEXLIST& lstTria) const ;
|
|
bool AddDexelSideFace( int nPos, int nPosAdj, const Point3d& ptP, const Point3d& ptQ,
|
|
const Vector3d& vtZ, const Vector3d& vtNorm, TRIA3DEXLIST& lstTria) const ;
|
|
bool ProcessCube( int nVoxI, int nVoxJ, int nVoxK, TRIA3DEXLIST& lstTria, VoxelContainer& VoxCont, bool bEnh) const ;
|
|
bool ProcessCell( int nGrid, int nCellI, int nCellJ, const Plane3d& plPlane, std::vector<CurveLine>& vLine) const ;
|
|
bool ExtMarchingCubes( int nBlock, TRIA3DEXLIST& lstTria, VoxelContainer& vVox) const ;
|
|
bool ExtMarchingCubes( std::vector<VoxelIndexes>& vVox, TRIA3DEXLIST& lstTria, bool bEnh) const ;
|
|
bool RegulateFeaturesChain( std::vector<VoxelContainer>& vVecVox) const ;
|
|
bool CreateSharpFeatureTriangle( int nBlock, const VoxelContainer& vVox, TriHolder& triHold) const ;
|
|
bool CreateSharpFeatureTriangle( const VoxelContainer& vVox, TriHolder& triHold) const ;
|
|
bool FlipEdgesII( TriHolder& TriHold) const ;
|
|
bool FlipEdgesBB( TriaMatrix& InterTria) const ;
|
|
bool IsThereMat( int nI, int nJ, int nK) const ;
|
|
bool InOut( const Plane3d& plPlane, int nGrid, int nI, int nJ) const ;
|
|
int CalcIndex( int nI, int nJ, int nK) const ;
|
|
int CalcIndexForPlaneCells( const Plane3d& plPlane, int nGrid, int nCellI, int nCellJ) const ;
|
|
bool IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, AppliedVector& vfField) const ;
|
|
bool IsPointInsideVoxelApprox( int nI, int nJ, int nK, const Point3d& ptP, double dPrec = EPS_SMALL) const ;
|
|
bool GetPointVoxel( const Point3d& ptP, int& nVoxI, int& nVoxJ, int& nVoxK) const ;
|
|
bool IsZInsideInterval( int nGrid, int nDex, double dZ) const ;
|
|
// Per regolarizzazione della catena di feature
|
|
bool FindAdjComp( const std::vector<VoxelContainer>& vVecVox, int nCurBlock, int nCurVox, int nCurComp,
|
|
INTVECTOR& vAdjBlockVoxComp, INTVECTOR& vAdjBordBlockVoxComp) const ;
|
|
// OPERAZIONI SU INTERVALLI
|
|
bool SubtractIntervals( unsigned int nGrid, unsigned int nI, unsigned int nJ,
|
|
double dMin, double dMax, const Vector3d& vtNMin, const Vector3d& vtNMax) ;
|
|
bool AddIntervals( unsigned int nGrid, unsigned int nI, unsigned int nJ,
|
|
double dMin, double dMax, const Vector3d& vtNMin, const Vector3d& vtNMax) ;
|
|
// 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 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) ;
|
|
bool Mrt_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ;
|
|
bool Mrt_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ;
|
|
bool Chs_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ;
|
|
bool Chs_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ;
|
|
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) ;
|
|
// 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) ;
|
|
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) ;
|
|
// 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) ;
|
|
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) ;
|
|
bool Mrt_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ;
|
|
bool Mrt_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ; // E' in realtà un Perp
|
|
bool Chs_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ;
|
|
bool Chs_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ; // E' in realtà un Perp
|
|
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
|
|
// Asse di simmetria diretto come l'asse Z
|
|
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) ;
|
|
bool CompPar_ZDrilling( unsigned int nGrid, double dLenX, double dLenY, double dLenZ,
|
|
const Point3d& ptS, const Point3d& ptE,
|
|
const Vector3d& vtToolDir, const Vector3d& vtAux) ;
|
|
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) ;
|
|
bool CompPar_ZMilling( unsigned int nGrid, double dLenX, double dLenY, double dLenZ,
|
|
const Point3d& ptS, const Point3d& ptE,
|
|
const Vector3d& vtToolDir, const Vector3d& vtAux) ; // E' in realtà MillingPerp
|
|
// Asse di simmetria con orientazione generica
|
|
bool CompCyl_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
|
|
double dHei, double dRad, bool bTapB, bool bTapT) ;
|
|
bool CompConus_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
|
|
double dHei, double dMaxRad, double dMinRad, bool bTapB, bool bTapT) ;
|
|
bool CompPar_Drilling( unsigned int nGrid, double dLenX, double dLenY, double dLenZ,
|
|
const Point3d& ptS, const Point3d& ptE,
|
|
const Vector3d& vtToolDir, const Vector3d& vtAux) ;
|
|
bool CompCyl_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
|
|
double dHei, double dRad, bool bTapB, bool bTapT) ;
|
|
bool CompConus_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
|
|
double dHei, double dMaxRad, double dMinRad, bool bTapB, bool bTapT) ;
|
|
bool CompPar_Milling( unsigned int nGrid, double dLenX, double dLenY, double dLenZ,
|
|
const Point3d& ptS, const Point3d& ptE,
|
|
const Vector3d& vtToolDir, const Vector3d& vtAux) ; // E' in realtà MillingPerp
|
|
// Generica traslazione sfera
|
|
bool CompBall_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, double dRad) ;
|
|
// BBox per utensili e solidi semplici in movimenti di traslazione pura; in futuro si dovrà implementare le routine che prevedono rotazioni
|
|
inline bool BoundingBox( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV,
|
|
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& vtV,
|
|
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ,
|
|
double dRad, double dTipRad, double dHei) ;
|
|
inline bool BBoxParaComp( unsigned int nGrid, double dLenX, double dLenY, double dLenZ,
|
|
const Point3d& ptS, const Point3d& ptE, const Vector3d& vtD, const Vector3d& vtA,
|
|
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ) ;
|
|
// Intersezioni
|
|
bool IntersLineBox( const Point3d& ptP, const Vector3d& vtV, const Point3d& ptMin, const Point3d& ptMax) const ;
|
|
bool IntersLineBox( const Point3d& ptP, const Vector3d& vtV, const Point3d& ptMin, const Point3d& ptMax,
|
|
double& dU1, double& dU2) const ;
|
|
bool IntersLineZMapLattice( const Point3d& ptP, const Vector3d& vtV, double& dU1, double& dU2) const ;
|
|
bool IntersLineZMapBBox( const Point3d& ptP, const Vector3d& vtV, double& dU1, double& dU2) const ;
|
|
bool IntersLineDexel( const Point3d& ptP, const Vector3d& vtV, unsigned int nGrid, unsigned int nI, unsigned int nJ,
|
|
double& dU1, double& dU2) const ;
|
|
bool IntersRayDexel( const Point3d& ptP, const Vector3d& vtV, unsigned int nGrid, unsigned int nI, unsigned int nJ,
|
|
double& dU1, double& dU2) const ;
|
|
bool IntersLineCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
|
const Frame3d& CylFrame, double dL, double dR, bool bTapO, bool bTapL,
|
|
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2) ;
|
|
bool IntersLineEllipticalCylinder( const Vector3d& vtLineDir, const Point3d& ptLineSt,
|
|
const Frame3d& CircFrame, double dRad, double dLongMvLen, double dOrtMvLen,
|
|
bool bTapLow, bool bTapUp,
|
|
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2) ;
|
|
bool IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
|
const Frame3d& ConusFrame, double dTan, double dl, double dL, bool bTapLow, bool bTapUp,
|
|
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2) ;
|
|
bool IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
|
const Frame3d& PolyFrame, double dLenX, double dLenY, double dLenZ, double dDeltaX,
|
|
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2) ;
|
|
bool TestIntersPlaneZmapBBox( const Plane3d& plPlane) const ;
|
|
// Voxel: esistenza e passaggio da N a ijk per i voxel
|
|
bool IsValidVoxel( int nN) const ;
|
|
bool IsValidVoxel( int nI, int nJ, int nK) const ;
|
|
bool GetVoxIJKFromN( int nN, int& nI, int& nJ, int& nK) const ;
|
|
bool GetVoxNFromIJK( int nI, int nJ, int nK, int& nN) const ;
|
|
// Funzioni di gestione dei blocchi
|
|
bool GetBlockIJKFromN( int nBlock, int nIJK[]) const ;
|
|
bool GetBlockNFromIJK( int nIJK[], int& nBlock) const ;
|
|
bool GetBlockLimitsIJK( const int nIJK[], int nLimits[]) const ;
|
|
bool GetVoxelBlockIJK( const int nVoxIJK[], int nBlockIJK[]) const ;
|
|
bool SetToModifyDexelBlocks( int nGrid, int nDex, int nInt) ;
|
|
bool GetAdjBlockToBlock( int nBlockN, int nDeltaI, int nDeltaJ, int nDeltaK, int& nAdjBlockN) const ;
|
|
bool IsAVoxelOnBoundary( const int nLimits[], const int nIJK[], bool bType) const ;
|
|
bool IsAVoxelOnBoundary( const int nLimits[], const int nIJK[], int nDeltaIndex[]) const ;
|
|
bool GetFirstVoxIJK( int& i, int& j, int& k) const ;
|
|
bool GetLastVoxIJK( int& i, int& j, int& k) const ;
|
|
bool IsVoxelOnBoxEdge( int i, int j, int k) const ;
|
|
bool IsTriangleOnBorder( const Triangle3dEx& trTria, const int nBlockLimits[], const int nVoxIJK[]) const ;
|
|
// Funzioni per facce canoniche con grandi triangoli
|
|
bool ProcessVoxContXY( FlatVoxelContainer& VoxContXY, bool bPlus, TRIA3DEXLIST& lstTria) const ;
|
|
bool ProcessVoxContYZ( FlatVoxelContainer& VoxContYZ, bool bPlus, TRIA3DEXLIST& lstTria) const ;
|
|
bool ProcessVoxContXZ( FlatVoxelContainer& VoxContXZ, bool bPlus, TRIA3DEXLIST& lstTria) const ;
|
|
bool Find( const FlatVoxelContainer& VoxCont, int nI, int nJ, int nK, double dPos, int nTool) const ;
|
|
bool Remove( FlatVoxelContainer& VoxCont, int nI, int nJ, int nK) const ;
|
|
// Connessione Zmap
|
|
struct IntervalIndexes {
|
|
size_t tMap ;
|
|
size_t tDex ;
|
|
size_t tInt ;
|
|
} ;
|
|
typedef std::stack <IntervalIndexes> IntContaier ;
|
|
bool CheckMapConnection( void) ;
|
|
bool ExpandFromXInterval( IntContaier& IntCont) ;
|
|
bool ExpandFromYInterval( IntContaier& IntCont) ;
|
|
bool ExpandFromZInterval( IntContaier& IntCont) ;
|
|
bool IsBox( void) ;
|
|
|
|
private :
|
|
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
|
enum Shape { GENERIC = 0, BOX = 1, EXTRUSION = 2} ;
|
|
static const int N_MAPS = 3 ;
|
|
static const int N_VOXBLOCK = 32 ;
|
|
static const int N_DEXVOXRATIO = 1 ;
|
|
|
|
private :
|
|
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
|
Status m_nStatus ; // stato
|
|
int m_nTempProp ; // proprietà temporanea
|
|
double m_dStep ; // passo delle griglie
|
|
unsigned int m_nMapNum ; // numero di griglie ( 1 o 3)
|
|
Frame3d m_MapFrame ; // riferimento intrinseco dello Zmap
|
|
unsigned int m_nNx[N_MAPS] ; // dimensione di ciascuna griglia in X
|
|
unsigned int m_nNy[N_MAPS] ; // dimensione di ciascuna griglia in Y
|
|
unsigned int m_nDim[N_MAPS] ; // dimensione di ciascuna griglia ( X * Y)
|
|
double m_dMinZ[N_MAPS] ; // minimo in Zlocale di ciascuna griglia
|
|
double m_dMaxZ[N_MAPS] ; // massimo in Zlocale di ciascuna griglia
|
|
|
|
struct Data { // Tratto di dexel : dati estremi, versori normali e corpo di appartenenza
|
|
double dMin ;
|
|
int nToolMin ;
|
|
Vector3d vtMinN ;
|
|
double dMax ;
|
|
int nToolMax ;
|
|
Vector3d vtMaxN ;
|
|
int nCompo ;
|
|
} ;
|
|
std::vector<std::vector<Data>> m_Values[N_MAPS] ; // dexel delle 3 griglie
|
|
|
|
int m_nShape ; // Forma : 0 generica, 1 box, 2 estrusione
|
|
|
|
unsigned int m_nVoxNumPerBlock ; // Numero di voxel per blocco
|
|
unsigned int m_nFracLin[3] ; // Numero di blocchi per ogni asse
|
|
unsigned int m_nNumBlock ; // Numero totale di blocchi
|
|
|
|
mutable BOOLVECTOR m_BlockToUpdate ;
|
|
|
|
int m_nConnectedCompoCount ; // Se == - 1 il numero di componenti non è noto
|
|
// Se >= 0 è il numero di componenti connesse
|
|
|
|
mutable std::vector<VoxelContainer> m_InterBlockVox ;
|
|
mutable TriaMatrix m_InterBlockTria ;
|
|
|
|
mutable std::vector<InterVoxMatter> m_SliceXY ;
|
|
mutable std::vector<InterVoxMatter> m_SliceXZ ;
|
|
mutable std::vector<InterVoxMatter> m_SliceYZ ;
|
|
|
|
Tool m_Tool ;
|
|
} ;
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
inline VolZmap* CreateBasicVolZmap( void)
|
|
{ return (static_cast<VolZmap*>( CreateGeoObj( VOL_ZMAP))) ; }
|
|
inline VolZmap* CloneBasicVolZmap( const IGeoObj* pGObj)
|
|
{ if ( pGObj == nullptr || pGObj->GetType() != VOL_ZMAP)
|
|
return nullptr ;
|
|
return (static_cast<VolZmap*>(pGObj->Clone())) ; }
|
|
inline const VolZmap* GetBasicVolZmap( const IGeoObj* pGObj)
|
|
{ if ( pGObj == nullptr || pGObj->GetType() != VOL_ZMAP)
|
|
return nullptr ;
|
|
return (static_cast<const VolZmap*>(pGObj)) ; }
|
|
inline VolZmap* GetBasicVolZmap( IGeoObj* pGObj)
|
|
{ if ( pGObj == nullptr || pGObj->GetType() != VOL_ZMAP)
|
|
return nullptr ;
|
|
return (static_cast<VolZmap*>(pGObj)) ; }
|
|
|
|
|