//---------------------------------------------------------------------------- // EgalTech 2014-2023 //---------------------------------------------------------------------------- // File : EGkSurfTriMesh.h Data : 10.12.23 Versione : 2.5l2 // Contenuto : Dichiarazione della interfaccia ISurfTriMesh. // // // // Modifiche : 26.03.14 DS Creazione modulo. // // //---------------------------------------------------------------------------- #pragma once #include "/EgtDev/Include/EGkSurf.h" #include "/EgtDev/Include/EGkTriangle3d.h" #include "/EgtDev/Include/EGkPolyLine.h" #include "/EgtDev/Include/EGkCurve.h" #include "/EgtDev/Include/EgtPointerOwner.h" //---------------------------------------------------------------------------- const int SVT_NULL = - 1 ; // vertice o triangolo nullo const int SVT_DEL = - 2 ; // vertice o triangolo cancellato inline bool IsValidSvt( int nSvt) { return ( nSvt != SVT_NULL && nSvt != SVT_DEL) ; } //---------------------------------------------------------------------------- const double MAX_EDGE_LEN_STD = 5000.0 ; //---------------------------------------------------------------------------- class __declspec( novtable) ISurfTriMesh : public ISurf { public : enum RuledType { RLT_ISOPAR = 0, // con parametrizzazione simile tra le due curve RLT_MINDIST = 1, // con distanza minima tra le due curve RLT_ISOPAR_SMOOTH = 2} ; // con parametrizzazione simile tra le due curve e lisciatura delle parti torte public : // IGeoObj ISurfTriMesh* Clone( void) const override = 0 ; public : virtual bool CopyFrom( const IGeoObj* pGObjSrc) = 0 ; virtual bool Init( int nNumVert, int nNumTria, int nNumFacet = 0) = 0 ; virtual void SetLinearTolerance( double dLinTol) = 0 ; virtual void SetBoundaryAngle( double dBoundaryAngDeg) = 0 ; virtual void SetSmoothAngle( double dSmoothAngDeg) = 0 ; virtual int AddVertex( const Point3d& ptVert, double dU = -1, double dV = -1) = 0 ; virtual bool MoveVertex( int nInd, const Point3d& ptNewVert) = 0 ; virtual int AddTriangle( const int nIdVert[3], int nTFlag = 0) = 0 ; virtual bool RemoveTriangle( int nId) = 0 ; virtual bool AdjustTopology( void) = 0 ; virtual bool CreateByFlatContour( const PolyLine& PL) = 0 ; virtual bool CreateByRegion( const POLYLINEVECTOR& vPL) = 0 ; virtual bool CreateByExtrusion( const PolyLine& PL, const Vector3d& vtExtr) = 0 ; virtual bool CreateByPointCurve( const Point3d& ptP, const PolyLine& PL) = 0 ; virtual bool CreateByTwoCurves( const PolyLine& PL1, const PolyLine& PL2, int nRuledType) = 0 ; virtual bool CreateByRevolution( const PolyLine& PL, const Point3d& ptAx, const Vector3d& vtAx, double dAngRot, double dStepRot) = 0 ; virtual bool CreateByScrewing( const PolyLine& PL, const Point3d& ptAx, const Vector3d& vtAx, double dAngRot, double dStepRot, double dMove) = 0 ; virtual bool DoCompacting( double dTol = EPS_SMALL) = 0 ; virtual bool DoSewing( const ISurfTriMesh& stmOther, const Frame3d& frOther = GLOB_FRM, double dTol = 2 * EPS_SMALL) = 0 ; virtual bool IsEmpty( void) const = 0 ; virtual int GetVertexCount( void) const = 0 ; virtual int GetTriangleCount( void) const = 0 ; virtual int GetTriangleCount( int nTFlag) const = 0 ; virtual int GetVertexSize( void) const = 0 ; virtual int GetTriangleSize( void) const = 0 ; virtual double GetLinearTolerance( void) const = 0 ; virtual double GetSmoothAngle( void) const = 0 ; virtual bool GetVertex( int nId, Point3d& ptP) const = 0 ; virtual bool GetVertexParam( int nId, double& dU, double& dV) const = 0 ; virtual int GetFirstVertex( Point3d& ptP) const = 0 ; virtual int GetNextVertex( int nId, Point3d& ptP) const = 0 ; virtual bool GetTriangle( int nId, int nIdVert[3]) const = 0 ; virtual int GetFirstTriangle( int nIdVert[3]) const = 0 ; virtual int GetNextTriangle( int nId, int nIdVert[3]) const = 0 ; virtual bool GetTriangle( int nId, Triangle3d& Tria) const = 0 ; virtual int GetFirstTriangle( Triangle3d& Tria) const = 0 ; virtual int GetNextTriangle( int nId, Triangle3d& Tria) const = 0 ; virtual bool GetTriangle( int nId, Triangle3dEx& Tria) const = 0 ; virtual int GetFirstTriangle( Triangle3dEx& Tria) const = 0 ; virtual int GetNextTriangle( int nId, Triangle3dEx& Tria) const = 0 ; virtual int GetAllTriaAroundVertex( int nV, INTVECTOR& vT, bool& bCirc) const = 0 ; virtual bool GetVertexSmoothNormal( int nV, int nT, Vector3d& vtN) const = 0 ; virtual bool GetTriangleBoundaryEdges( int nId, TriFlags3d& TFlags) const = 0 ; virtual bool GetTriangleSmoothNormals( int nId, TriNormals3d& TNrms) const = 0 ; virtual ISurfTriMesh* CloneTriangle( int nTria) const = 0 ; virtual bool GetLoops( POLYLINEVECTOR& vPL) const = 0 ; virtual bool GetSilhouette( const Vector3d& vtDir, double dTol, POLYLINEVECTOR& vPL, bool bAllTria = false) const = 0 ; virtual int GetFacetCount( void) const = 0 ; virtual int GetFacetSize( void) const = 0 ; virtual int GetFacetFromTria( int nT) const = 0 ; virtual bool GetAllTriaInFacet( int nF, INTVECTOR& vT) const = 0 ; virtual bool GetAllVertInFacet( int nF, INTVECTOR& vVert) const = 0 ; virtual bool GetFacetLoops( int nF, POLYLINEVECTOR& vPL) const = 0 ; virtual bool GetFacetAdjacencies( int nF, INTMATRIX& vAdj) const = 0 ; virtual bool GetFacetNearestEndPoint( int nF, const Point3d& ptNear, Point3d& ptEnd, Vector3d& vtN) const = 0 ; virtual bool GetFacetNearestMidPoint( int nF, const Point3d& ptNear, Point3d& ptMid, Vector3d& vtN) const = 0 ; virtual bool GetFacetCenter( int nF, Point3d& ptCen, Vector3d& vtN) const = 0 ; virtual bool GetFacetNormal( int nF, Vector3d& vtN) const = 0 ; virtual bool GetFacetArea( int nF, double& dArea) const = 0 ; virtual bool GetFacetsContact( int nF1, int nF2, bool& bAdjac, Point3d& ptP1, Point3d& ptP2, double& dAng) const = 0 ; virtual bool RemoveFacet( int nF) = 0 ; virtual ISurfTriMesh* CloneFacet( int nF) const = 0 ; virtual bool SwapFacets( int nF1, int nF2) = 0 ; virtual bool GetFacetLocalBBox( int nF, BBox3d& b3Loc, int nFlag = BBF_STANDARD) const = 0 ; virtual bool GetFacetBBox( int nF, const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const = 0 ; virtual int GetEdgeCount( void) const = 0 ; virtual int GetEdgeSize( void) const = 0 ; virtual bool GetEdge( int nInd, int& nV1, int& nV2, int& nFl, int& nFr, double& dAng) const = 0 ; virtual bool GetEdge( int nInd, Point3d& ptP1, Point3d& ptP2, double& dAng) const = 0 ; virtual bool GetEdges( ICURVEPOVECTOR& vpCurve) const = 0 ; virtual bool Cut( const Plane3d& plPlane, bool bSaveOnEq) = 0 ; virtual bool GeneralizedCut( const ICurve& cvCurve, bool bSaveOnEq) = 0 ; virtual bool Add( const ISurfTriMesh& Other) = 0 ; virtual bool Intersect( const ISurfTriMesh& Other) = 0 ; virtual bool Subtract( const ISurfTriMesh& Other) = 0 ; virtual bool GetSurfClassification( const ISurfTriMesh& ClassifierSurf, INTVECTOR& vTriaIn, INTVECTOR& vTriaOut, INTVECTOR& vTriaOnP, INTVECTOR& vTriaOnM, INTVECTOR& vTriaIndef) = 0 ; virtual bool CutWithOtherSurf( const ISurfTriMesh& CutterSurf, bool bInVsOut, bool bSaveOnEq) = 0 ; virtual bool Repair( double dMaxEdgeLen = MAX_EDGE_LEN_STD) = 0 ; virtual bool GetAllTriaOverlapBox( const BBox3d& b3Box, INTVECTOR& vT) const = 0 ; virtual const BBox3d& GetAllTriaBox( void) const = 0 ; virtual int GetPartCount( void) const = 0 ; virtual bool RemovePart( int nPart) = 0 ; virtual ISurfTriMesh* ClonePart( int nPart) const = 0 ; virtual int GetMaxTFlag( void) const = 0 ; virtual bool ResetTFlags( void) = 0 ; } ; //----------------------------------------------------------------------------- inline ISurfTriMesh* CreateSurfTriMesh( void) { return (static_cast( CreateGeoObj( SRF_TRIMESH))) ; } inline ISurfTriMesh* CloneSurfTriMesh( const IGeoObj* pGObj) { if ( pGObj == nullptr || pGObj->GetType() != SRF_TRIMESH) return nullptr ; return (static_cast(pGObj->Clone())) ; } inline const ISurfTriMesh* GetSurfTriMesh( const IGeoObj* pGObj) { if ( pGObj == nullptr || pGObj->GetType() != SRF_TRIMESH) return nullptr ; return (static_cast(pGObj)) ; } inline ISurfTriMesh* GetSurfTriMesh( IGeoObj* pGObj) { if ( pGObj == nullptr || pGObj->GetType() != SRF_TRIMESH) return nullptr ; return (static_cast(pGObj)) ; } //---------------------------------------------------------------------------- // Raccolte di puntatori a ISurfTriMesh typedef std::vector CISURFTMPVECTOR ; // vettore di puntatori a const ISurfTriMesh typedef std::vector ISURFTMPVECTOR ; // vettore di puntatori a ISurfTriMesh typedef std::list ISURFTMPLIST ; // lista di puntatori a ISurfTriMesh typedef std::vector> ISURFTMPOVECTOR ; // vettore di puntatori esclusivi a ISurfTriMesh