//---------------------------------------------------------------------------- // EgalTech 2014-2025 //---------------------------------------------------------------------------- // File : SurfTriMesh.h Data : 28.03.25 Versione : 2.7c4 // Contenuto : Dichiarazione della classe Superficie TriMesh. // // // // Modifiche : 26.03.14 DS Creazione modulo. // // //---------------------------------------------------------------------------- #pragma once #include "ObjGraphicsMgr.h" #include "DllMain.h" #include "GeoObjRW.h" #include "/EgtDev/Include/EGkSurfTriMesh.h" #include "/EgtDev/Include/EGkHashGrids3d.h" #include "/EgtDev/Include/EGkPointGrid3d.h" #include #include class SurfFlatRegion ; //---------------------------------------------------------------------------- // Classe Vertice class StmVert { public : StmVert( void) : ptP(), dU( SVT_NULL), dV( SVT_NULL), nIdTria( SVT_NULL), nFlag( 0), nTemp( 0) {} StmVert( const Point3d& ptQ) : ptP( ptQ), dU( SVT_NULL), dV( SVT_NULL), nIdTria( SVT_NULL), nFlag( 0), nTemp( 0) {} StmVert( const Point3d& ptQ, int nIdT, int nF) : ptP( ptQ), dU( SVT_NULL), dV( SVT_NULL), nIdTria( nIdT), nFlag( nF), nTemp( 0) {} public : Point3d ptP ; double dU ; // parametro riferito alle coordinate del punto nello spazio parametrico ( nSpanU x 1000) ( nSpanV x 1000) // della sup di Bezier // -1 se non definito double dV ; // parametro riferito alle coordinate del punto nello spazio parametrico ( nSpanU x 1000) ( nSpanV x 1000) // della sup di Bezier // -1 se non definito int nIdTria ; int nFlag ; mutable int nTemp ; } ; //---------------------------------------------------------------------------- // Classe Triangolo class StmTria { public : StmTria( void) : nIdVert{ SVT_NULL, SVT_NULL, SVT_NULL}, nIdAdjac{ SVT_NULL, SVT_NULL, SVT_NULL}, nETempFlag{ 0, 0, 0}, vtN(), nIdFacet( SVT_NULL), nTFlag( 0), nEFlag( 0), nShell( SVT_NULL), nTemp( 0), nTempShell{ 0} {} StmTria( const int nIdV[3]) : nIdVert{ nIdV[0], nIdV[1], nIdV[2]}, nIdAdjac{ SVT_NULL, SVT_NULL, SVT_NULL}, nETempFlag{ 0, 0, 0}, vtN(), nIdFacet( SVT_NULL), nTFlag( 0), nEFlag( 0), nShell( SVT_NULL), nTemp( 0), nTempShell{ 0} {} StmTria( const int nIdV[3], int nTF) : nIdVert{ nIdV[0], nIdV[1], nIdV[2]}, nIdAdjac{ SVT_NULL, SVT_NULL, SVT_NULL}, nETempFlag{ 0, 0, 0}, vtN(), nIdFacet( SVT_NULL), nTFlag( nTF), nEFlag( 0), nShell( SVT_NULL), nTemp( 0), nTempShell{ 0} {} StmTria( const int nIdV[3], const int nIdA[3], const Vector3d& vtV, int nTF, int nEF) : nIdVert{ nIdV[0], nIdV[1], nIdV[2]}, nIdAdjac{ nIdA[0], nIdA[1], nIdA[2]}, nETempFlag{ 0, 0, 0}, vtN( vtV), nIdFacet( SVT_NULL), nTFlag( nTF), nEFlag( nEF), nShell( SVT_NULL), nTemp( 0), nTempShell{ 0} {} public : int nIdVert[3] ; int nIdAdjac[3] ; int nETempFlag[3] ; Vector3d vtN ; int nIdFacet ; int nTFlag ; int nEFlag ; mutable int nShell ; mutable int nTemp ; mutable int nTempShell ; } ; //---------------------------------------------------------------------------- // Classe Part class StmPart { public : StmPart( void) : bClosed( false) {} StmPart( bool bClo, const INTVECTOR& vSh) : bClosed( bClo), vShell( vSh) {} int GetShellCount( void) { return ( vShell.empty() ? 0 : int( vShell.size()) - ( vShell[0] == -1 ? 1 : 0)) ; } public : bool bClosed ; INTVECTOR vShell ; } ; //---------------------------------------------------------------------------- // Classe Facet Edge class StmFacEdge { public : StmFacEdge( void) : nIdVert{ SVT_NULL, SVT_NULL}, nIdFacAdj{ SVT_NULL, SVT_NULL}, dIntAng{ 0} {} StmFacEdge( int nV1, int nV2, int nFl, int nFr, double dA) : nIdVert{ nV1, nV2}, nIdFacAdj{ nFl, nFr}, dIntAng{ dA} {} public : int nIdVert[2] ; int nIdFacAdj[2] ; double dIntAng ; } ; //---------------------------------------------------------------------------- // Classe di tre interi per code di elaborazione sui triangoli (senza iterazioni) struct Stm3Int { int nI1 ; int nI2 ; int nI3 ; Stm3Int( int nI, int nJ, int nK) : nI1( nI), nI2( nJ), nI3( nK) {} } ; //---------------------------------------------------------------------------- // Struttura segmento di intersezione struct IntSegment { Point3d ptSt ; Point3d ptEn ; Vector3d vtOuter ; bool bDegenerate ; } ; // Tipo chain typedef std::vector Chain ; // Tipo vettore di Chain typedef std::vector CHAINVECTOR ; // Tipo unordered map di Chain typedef std::unordered_map< int, Chain> CHAINMAP ; // Tipo unordered map di TRIA3DVECTOR typedef std::unordered_map< int, TRIA3DVECTOR> TRIA3DVECTORMAP ; //---------------------------------------------------------------------------- // Struttura intersezione linea-faccia struct LineFacetClass { Point3d ptSt, ptEn ; int nTypeA, nTypeB ; LineFacetClass( void) : nTypeA{ 0}, nTypeB{ 0} {} LineFacetClass( const Point3d& ptS, const Point3d& ptE, int nTpA, int nTpB) : ptSt{ ptS}, ptEn{ ptE}, nTypeA{ nTpA}, nTypeB{ nTpB} {} } ; typedef std::vector LineFacetClassVector ; //---------------------------------------------------------------------------- enum FacetPlaneIntersType { FPI_ERROR = 0, FPI_CUT = 1, FPI_IN = 2, FPI_OUT = 3, FPI_ON = 4 } ; //---------------------------------------------------------------------------- // Strutture e contenitori contatti interno-interno struct IntersInnSeg { Point3d ptSt ; Point3d ptEn ; Vector3d vtOuter ; IntersInnSeg( void) {} IntersInnSeg( const Point3d& ptS, const Point3d& ptE) : ptSt{ ptS}, ptEn{ ptE} {} IntersInnSeg( const Point3d& ptS, const Point3d& ptE, const Vector3d& vtO) : ptSt{ ptS}, ptEn{ ptE}, vtOuter{ vtO} {} } ; typedef std::vector IntersInnChain ; typedef std::vector INNCHAINVECTOR ; typedef std::unordered_map INTERSCHAINMAP ; // Contatti con spigolo struct IntersEdge { Point3d ptSt ; Point3d ptEn ; INTVECTOR vOthFacetIndex ; IntersEdge( const Point3d& ptS, const Point3d& ptE, const INTVECTOR& vOFI) : ptSt{ ptS}, ptEn{ ptE}, vOthFacetIndex{ vOFI} {} } ; typedef std::vector IntersEdgeVec ; typedef std::unordered_map INTERSEDGEMAP ; // Parte di faccia struct FacetPiece { POLYLINEVECTOR vPieceLoop ; int nPiecePart ; } ; typedef std::unordered_map> PieceMap ; //---------------------------------------------------------------------------- class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW { public : // IGeoObj ~SurfTriMesh( void) override ; SurfTriMesh* 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, int nPropInd = 0) override { if ( nPropInd >= 0 && nPropInd < 2) m_nTempProp[nPropInd] = nProp ; } int GetTempProp( int nPropInd = 0) const override { return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; } void SetTempParam( double dParam, int nParamInd = 0) override { if ( nParamInd >= 0 && nParamInd < 2) m_dTempParam[nParamInd] = dParam ; } double GetTempParam( int nParamInd = 0) const override { return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; } public : // ISurf bool IsSimple( void) const override { return true ; } bool IsClosed( void) const override { return m_bClosed ; } bool GetArea( double& dArea) const override ; bool GetVolume( double& dVolume) const override ; bool GetCentroid( Point3d& ptCen) const override ; bool Invert( void) override ; public : // ISurfTriMesh bool CopyFrom( const IGeoObj* pGObjSrc) override ; bool Init( int nNumVert, int nNumTria, int nNumFacet = 0) override ; void SetLinearTolerance( double dLinTol) override { m_dLinTol = std::max( dLinTol, EPS_SMALL) ; } void SetBoundaryAngle( double dBoundaryAngDeg) override { m_dBoundaryAng = std::max( dBoundaryAngDeg, EPS_ANG_SMALL) ; m_dCosBndAng = cos( m_dBoundaryAng * DEGTORAD) ; m_OGrMgr.Reset() ; } void SetSmoothAngle( double dSmoothAngDeg) override { m_dSmoothAng = std::max( dSmoothAngDeg, EPS_ANG_SMALL) ; m_dCosSmAng = cos( m_dSmoothAng * DEGTORAD) ; m_OGrMgr.Reset() ; } void SetShowEdges( bool bShow) override { m_bShowEdges = bShow ; // qui è necessario far ricreare la grafica m_OGrMgr.Clear() ; } int AddVertex( const Point3d& ptVert, double dU = -1, double dV = -1) override ; bool MoveVertex( int nInd, const Point3d& ptNewVert) override ; int AddTriangle( const int nIdVert[3], int nTFlag = 0) override ; bool RemoveTriangle( int nId) override ; bool AdjustTopology( void) override ; bool CreateByFlatContour( const PolyLine& PL) override ; bool CreateByPolygonWithHoles( const POLYLINEVECTOR& vPL) override ; bool CreateByExtrusion( const PolyLine& PL, const Vector3d& vtExtr) override ; bool CreateByPointCurve( const Point3d& ptP, const PolyLine& PL) override ; bool CreateByTwoCurves( const PolyLine& PL1, const PolyLine& PL2, int nRuledType) override ; bool CreateByRevolution( const PolyLine& PL, const Point3d& ptAx, const Vector3d& vtAx, double dAngRot, double dStepRot) override ; bool CreateByScrewing( const PolyLine& PL, const Point3d& ptAx, const Vector3d& vtAx, double dAngRot, double dStepRot, double dMove) override ; bool DoCompacting( double dTol = EPS_SMALL) override ; bool DoSewing( const ISurfTriMesh& stmOther, const Frame3d& frOther = GLOB_FRM, double dTol = 2 * EPS_SMALL) override ; bool IsEmpty( void) const override ; int GetVertexCount( void) const override ; int GetTriangleCount( void) const override ; int GetTriangleCount( int nTFlag) const override ; int GetVertexSize( void) const override { return int( m_vVert.size()) ; } int GetTriangleSize( void) const override { return int( m_vTria.size()) ; } double GetLinearTolerance( void) const override { return m_dLinTol ; } double GetSmoothAngle( void) const override { return m_dSmoothAng ; } bool GetShowEdges( void) const override { return m_bShowEdges ; } bool GetVertex( int nId, Point3d& ptP) const override ; bool GetVertexParam( int nId, double& dU, double& dV) const override ; int GetFirstVertex( Point3d& ptP) const override ; int GetNextVertex( int nId, Point3d& ptP) const override ; bool GetTriangle( int nId, int nIdVert[3]) const override ; int GetFirstTriangle( int nIdVert[3]) const override ; int GetNextTriangle( int nId, int nIdVert[3]) const override ; bool GetTriangle( int nId, Triangle3d& Tria) const override ; int GetFirstTriangle( Triangle3d& Tria) const override ; int GetNextTriangle( int nId, Triangle3d& Tria) const override ; bool GetTriangle( int nId, Triangle3dEx& Tria) const override ; int GetFirstTriangle( Triangle3dEx& Tria) const override ; int GetNextTriangle( int nId, Triangle3dEx& Tria) const override ; int GetAllTriaAroundVertex( int nV, INTVECTOR& vT, bool& bCirc) const override ; bool GetVertexSmoothNormal( int nV, int nT, Vector3d& vtN) const override ; bool GetTriangleBoundaryEdges( int nId, TriFlags3d& TFlags) const override ; bool GetTriangleSmoothNormals( int nId, TriNormals3d& TNrms) const override ; SurfTriMesh* CloneTriangle( int nT) const override ; bool GetLoops( POLYLINEVECTOR& vPL) const override ; bool GetSilhouette( const Vector3d& vtDir, double dTol, POLYLINEVECTOR& vPL, bool bAllTria = false) const override ; bool GetSilhouette( const Plane3d& plPlane, double dTol, POLYLINEVECTOR& vPL, bool bAllTria = false) const override ; int GetFacetCount( void) const override ; int GetFacetSize( void) const override { return int( m_vFacet.size()) ; } int GetFacetFromTria( int nT) const override ; bool GetAllTriaInFacet( int nF, INTVECTOR& vT) const override ; bool GetAllVertInFacet( int nF, INTVECTOR& vVert) const override ; bool GetFacetLoops( int nF, POLYLINEVECTOR& vPL) const override ; bool GetFacetAdjacencies( int nF, INTMATRIX& vAdj) const override ; bool GetFacetNearestEndPoint( int nF, const Point3d& ptNear, Point3d& ptEnd, Vector3d& vtN) const override ; bool GetFacetNearestMidPoint( int nF, const Point3d& ptNear, Point3d& ptMid, Vector3d& vtN) const override ; bool GetFacetCenter( int nF, Point3d& ptCen, Vector3d& vtN) const override ; bool GetFacetNormal( int nF, Vector3d& vtN) const override ; bool GetFacetArea( int nF, double& dArea) const override ; bool GetFacetsContact( int nF1, int nF2, bool& bAdjac, Point3d& ptP1, Point3d& ptP2, double& dAng) const override ; bool RemoveFacet( int nF) override ; SurfTriMesh* CloneFacet( int nF) const override ; bool SwapFacets( int nF1, int nF2) override ; bool GetFacetLocalBBox( int nF, BBox3d& b3Loc, int nFlag = BBF_STANDARD) const override ; bool GetFacetBBox( int nF, const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const override ; int GetEdgeCount( void) const override ; int GetEdgeSize( void) const override { return int( m_vFacEdge.size()) ; } bool GetEdge( int nInd, int& nV1, int& nV2, int& nFl, int& nFr, double& dAng) const override ; bool GetEdge( int nInd, Point3d& ptP1, Point3d& ptP2, double& dAng) const override ; bool GetEdges( ICURVEPOVECTOR& vpCurve) const override ; bool GetCurvature( int nV, double& dMinK, Vector3d& vtMinK, double& dMaxK, Vector3d& vtMaxK, bool& bPlanar, Vector3d& vtNorm) const override ; bool Cut( const Plane3d& plPlane, bool bSaveOnEq) override ; bool GeneralizedCut( const ICurve& cvCurve, bool bSaveOnEq) override ; bool Add( const ISurfTriMesh& Other) override ; bool Intersect( const ISurfTriMesh& Other) override ; bool Subtract( const ISurfTriMesh& Other) override ; bool GetSurfClassification( const ISurfTriMesh& ClassifierSurf, INTVECTOR& vTriaIn, INTVECTOR& vTriaOut, INTVECTOR& vTriaOnP, INTVECTOR& vTriaOnM, INTVECTOR& vTriaIndef) override ; bool CutWithOtherSurf( const ISurfTriMesh& CutterSurf, bool bInVsOut, bool bSaveOnEq) override ; bool Repair( double dMaxEdgeLen = MAX_EDGE_LEN_STD) override ; bool GetAllTriaOverlapBox( const BBox3d& b3Box, INTVECTOR& vT) const override ; const BBox3d& GetAllTriaBox( void) const override ; int GetShellCount( void) const override ; bool GetShellArea( int nShell, double& dArea) const override ; bool RemoveShell( int nShell) override ; SurfTriMesh* CloneShell( int nShell) const override ; bool GetPartLocalBBox( int nP, BBox3d& b3Loc) const override ; bool GetPartBBox( int nP, const Frame3d& frRef, BBox3d& b3Ref) const override ; int GetPartCount( void) const override ; bool RemovePart( int nPart) override ; bool GetPartArea( int nPart, double& dArea) const override ; bool GetPartVolume( int nPart, double& dVolume) const override ; bool GetPartLoops( int nPart, POLYLINEVECTOR& vPL) const override ; SurfTriMesh* ClonePart( int nPart) const override ; bool GetPartAndShellFromFacet( int nFacet, int& nPart, int& nShell) const override ; bool SetTFlag( int nId, int nTFlag) override ; bool GetTFlag( int nId, int& nFlag) const override ; int GetMaxTFlag( void) const override { return m_nMaxTFlag ; } bool ResetTFlags( void) override ; public : // IGeoObjRW int GetNgeId( void) const override ; bool Save( NgeWriter& ngeOut) const override ; bool PreSave( GdbGeo& Wrapper) const override ; bool PostSave( GdbGeo& Wrapper) const override ; bool Load( NgeReader& ngeIn) override ; bool PostLoad( GdbGeo& Wrapper) override ; public : SurfTriMesh( void) ; SurfTriMesh( const SurfTriMesh& stSrc) : m_pHGrd3d( nullptr) { if ( ! CopyFrom( stSrc)) LOG_ERROR( GetEGkLogger(), "SurfTriMesh : copy constructor error") } SurfTriMesh& operator =( const SurfTriMesh& stSrc) { if ( ! CopyFrom( stSrc)) LOG_ERROR( GetEGkLogger(), "SurfTriMesh : copy error") return *this ; } bool Clear( void) ; bool CreateByRegion( const POLYLINEVECTOR& vPL, const INTMATRIX& vnPLIndMat) ; bool ExistsTriangle( int nT) const { return ( nT >= 0 && nT < GetTriangleSize() && m_vTria[nT].nIdVert[0] != SVT_DEL) ; } bool GetTriangleAdjacencies( int nId, int nIdAdjTriaId[3]) const ; bool GetTempInt( int nId, int& nTempInt) const ; bool ResetTempInts( void) const ; bool SetTempInt( int nId, int nTempInt) const ; bool AddTriaFromZMap( const TRIA3DEXVECTOR& vTria, PointGrid3d& VertGrid, double dVertexTol = 2 * EPS_SMALL) ; bool AdjustTopologyFromZMap( void) ; bool GetTriaFromFace( int nF, int& nT) const ; private : typedef std::vector VERTVECTOR ; typedef std::vector TRIAVECTOR ; typedef std::vector PARTVECTOR ; typedef std::vector FACEDGEVECTOR ; typedef std::deque TRINTDEQUE ; private : enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ; private : bool CopyFrom( const SurfTriMesh& clSrc) ; bool Validate( bool bCorrect = false) ; bool AdjustVertices( void) ; bool AdjustAdjacencies( bool AdjustVert = true) ; bool AdjustOrientations( void) ; bool AdjustTriaOrientation( TRINTDEQUE& S3iQ) ; bool TestSealing( void) ; bool PackVertices( void) ; bool PackTriangles( void) ; bool SetVertex( int nInd, const StmVert& vV) ; bool SetTriangle( int nInd, const StmTria& tT) ; bool CalcTriangleNormal( int nT) ; bool InvertTriangle( int nT) ; int Next( int i) const { return (( i + 1) % 3) ; } int Prev( int i) const { return (( i + 2) % 3) ; } bool FindVertexInTria( int nV, int nT, int& nK) const ; int NextIndAroundVertex( int nInd, int nSize, bool bCirc) const ; int PrevIndAroundVertex( int nInd, int nSize, bool bCirc) const ; bool GetTriangleSmoothNormal( int nT, int nV, Vector3d& vtN) const ; bool GetTriangleVertexAngle( int nT, int nV, double& dAng) const ; bool MarchAlongLoop( int nT, int nV, int nTimeStamp, PolyLine& PL) const ; bool MarchOneTria( int& nT, int& nV, int nTimeStamp, PolyLine& PL, bool& bEnd) const ; bool VerifyPolylinesForTwoCurves( const PolyLine& PL1, const PolyLine& PL2) const ; bool AddBiTriangle( const int nIdVert[4]) ; bool VerifyFaceting( void) const ; bool UpdateFaceting( void) ; bool UpdateOneFace( int nFacet, int nT) ; bool UpdateTriaFaceting( int nRefT, int nFacet, const Plane3d& plPlane, int nT) ; bool SetFacet( int nInd, int nT) ; bool VerifyAdjacTriaFacet( INTVECTOR& vT) const ; bool MarchAlongFacetLoop( int nF, int nT, int nV, int nTimeStamp, PolyLine& PL) const ; bool MarchOneFacetTria( int nF, int& nT, int& nV, int nTimeStamp, PolyLine& PL, bool& bEnd) const ; bool VerifyFacetEdging( void) const ; bool UpdateFacetEdging( void) ; void ResetHashGrids3d( void) const ; bool VerifyHashGrids3d( void) const ; bool VerifyConnection( bool bShellsAndParts = true) const ; bool IsShellClosed( int nShell) const ; bool IsPartClosed( int nPart) const ; bool CutTriangleByPlane( int nTriaId, const Plane3d& plPlane, bool bSaveOnEq, bool& bModif) ; bool CutByTriangles( const Plane3d& plPlane, bool bSaveOnEq, bool& bModif) ; bool DecomposeLoop( CHAINVECTOR& cvOpenChain, INTVECTOR& vnDegVec, PNTMATRIX& cvBoundClosedLoopVec, BOOLVECTOR& vbInOut) ; bool RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECTORMAP& Ambiguos, SurfTriMesh& Surf, bool& bModif) ; bool AmbiguosTriangleManager( TRIA3DVECTORMAP& Ambiguos, SurfTriMesh& Surf) ; bool IntersectTriMeshTriangle( SurfTriMesh& Other) ; bool IdentifyShells( void) const ; bool RemoveDoubleTriangles( bool& bModified) ; bool RemoveTJunctions( bool& bModified, double dMinSqDist = SQ_EPS_TRIA_H) ; bool FlipTriangles( int nTA, int nTB) ; bool SimplifyFacets( double dMaxEdgeLen = MAX_EDGE_LEN_STD, bool bForced = true, double dTolAlign = 50 * EPS_SMALL) ; bool AddChainToChain( const Chain& ChainToAdd, PNTVECTOR& OrigChain) ; bool DistPointFacet( const Point3d& ptP, const POLYLINEVECTOR& vPolyVec, double& dPointFacetDist) ; bool ChangeStart( const Point3d& ptNewStart, PNTVECTOR& Loop) ; bool SplitAtPoint( const Point3d& ptStop, const PNTVECTOR& Loop, PNTVECTOR& Loop1, PNTVECTOR& Loop2) ; bool AdjustLoop( PNTULIST& PointList, double dMaxEdgeLen, double dTolAlign, bool& bModif) const ; bool RemoveInvalidTriangles( const INTVECTOR& vIds) ; bool FindAdjacentOnLongerEdge( int nT, int& nEdge, int& nAdjTrg) const ; private : ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto Status m_nStatus ; // stato double m_dLinTol ; // tolleranza lineare di costruzione double m_dBoundaryAng ; // angolo limite per considerare un lato un contorno (in gradi) double m_dCosBndAng ; // coseno dell'angolo limite per considerare un lato un contorno double m_dSmoothAng ; // angolo limite per mediare le normali (in gradi) double m_dCosSmAng ; // coseno dell'angolo limite per mediare le normali bool m_bShowEdges ; // flag di visualizzazione spigoli vivi bool m_bOriented ; // la superficie è orientata consistentemente in tutte le sue parti bool m_bClosed ; // la superficie racchiude un volume bool m_bFaceted ; // flag di validità della sfaccettatura bool m_bFacEdged ; // flag di validità dei bordi della sfaccettatura VERTVECTOR m_vVert ; // vettore dei vertici TRIAVECTOR m_vTria ; // vettore dei triangoli INTVECTOR m_vFacet ; // vettore delle sfaccettature FACEDGEVECTOR m_vFacEdge ; // vettore degli edge delle sfaccettature mutable int m_nTimeStamp ; // orologio locale int m_nTempProp[2] ; // vettore proprietà temporanee double m_dTempParam[2] ; // vettore parametri temporanei int m_nMaxTFlag ; // massimo valore dei TFlag dei triangoli mutable int m_nShells ; // numero di gusci connessi (-1 se da calcolare) mutable PARTVECTOR m_vPart ; // vettore delle parti (flag chiusura e elenco shell, prima sempre esterna o infinita) mutable HashGrids3d* m_pHGrd3d ; // Hash Grid 3d nel suo riferimento mutable BBox3d m_b3HGrd3d ; // Box3d collegato a Hash Grid 3d } ; //----------------------------------------------------------------------------- inline SurfTriMesh* CreateBasicSurfTriMesh( void) { return ( static_cast( CreateGeoObj( SRF_TRIMESH))) ; } inline SurfTriMesh* CloneBasicSurfTriMesh( const IGeoObj* pGObj) { if ( pGObj == nullptr || pGObj->GetType() != SRF_TRIMESH) return nullptr ; return ( static_cast( pGObj->Clone())) ; } inline const SurfTriMesh* GetBasicSurfTriMesh( const IGeoObj* pGObj) { if ( pGObj == nullptr || pGObj->GetType() != SRF_TRIMESH) return nullptr ; return ( static_cast( pGObj)) ; } inline SurfTriMesh* GetBasicSurfTriMesh( IGeoObj* pGObj) { if ( pGObj == nullptr || pGObj->GetType() != SRF_TRIMESH) return nullptr ; return ( static_cast( pGObj)) ; } //---------------------------------------------------------------------------- // Raccolte di puntatori a SurfTriMesh typedef std::vector CISRFTMPVECTOR ; // vettore di puntatori a const SurfTriMesh typedef std::vector ISRFTMPVECTOR ; // vettore di puntatori a SurfTriMesh typedef std::list ISRFTMPLIST ; // lista di puntatori a SurfTriMesh typedef std::vector> ISRFTMPOVECTOR ; // vettore di puntatori esclusivi a SurfTriMesh