abd033342b
- aggiunte funzioni per la regolarizzazione dei bordi di una surf di trimming. -
142 lines
9.4 KiB
C++
142 lines
9.4 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2020-2025
|
|
//----------------------------------------------------------------------------
|
|
// File : EGkSurfBezier.h Data : 22.08.25 Versione : 2.7h1
|
|
// Contenuto : Dichiarazione della interfaccia ISurfBezier.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 22.03.20 DS Creazione modulo.
|
|
// 22.08.25 DS Aggiunte funzioni globali di impostazione tolleranze.
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "/EgtDev/Include/EGkSurf.h"
|
|
#include "/EgtDev/Include/EGkCurveComposite.h"
|
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
|
|
|
//----------------------- Macro per import/export ----------------------------
|
|
#undef EGK_EXPORT
|
|
#if defined( I_AM_EGK) // da definirsi solo nella DLL
|
|
#define EGK_EXPORT __declspec( dllexport)
|
|
#else
|
|
#define EGK_EXPORT __declspec( dllimport)
|
|
#endif
|
|
|
|
//----------------------- Forward --------------------------------------------
|
|
class PolyLine ;
|
|
class ICurveComposite ;
|
|
class ISurfFlatRegion ;
|
|
class ISurfTriMesh ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
class __declspec( novtable) ISurfBezier : public ISurf
|
|
{
|
|
public :
|
|
enum Side { FROM_MINUS = -1, // da valori inferiori del parametro
|
|
FROM_PLUS = 1} ; // da valori superiori del parametro
|
|
public :
|
|
enum RuledType { RLT_B_ISOPAR = 0, // con parametrizzazione simile tra le due curve
|
|
RLT_B_MINDIST = 1, // con distanza minima tra le due curve, usando start e end delle curve presenti
|
|
RLT_B_MINDIST_PLUS = 2, // con distanza minima tra le due curve, aggiungendo punti lungo le curve dove necessario
|
|
RLT_B_LENPAR = 3} ; // aggiungo punti alla curve in modo da matchare meglio le sottocurve, inoltre parametrizzo le curve in base alla lunghezza e non al numero di curve
|
|
enum Is_Planar { NOT_CALCULATED = -1,
|
|
NOT_PLANAR_SURF = 0 ,
|
|
PLANAR_SURF = 1} ;
|
|
|
|
public : // IGeoObj
|
|
ISurfBezier* Clone( void) const override = 0 ;
|
|
public :
|
|
virtual bool CopyFrom( const IGeoObj* pGObjSrc) = 0 ;
|
|
virtual bool Init( int nDegU, int nDegV, int nSpanU, int nSpanV, bool bIsRational) = 0 ;
|
|
virtual bool SetControlPoint( int nIndU, int nIndV, const Point3d& ptCtrl) = 0 ;
|
|
virtual bool SetControlPoint( int nInd, const Point3d& ptCtrl) = 0 ;
|
|
virtual bool SetControlPoint( int nIndU, int nIndV, const Point3d& ptCtrl, double dW) = 0 ;
|
|
virtual bool SetControlPoint( int nInd, const Point3d& ptCtrl, double dW) = 0 ;
|
|
virtual bool SetTrimRegion( ISurfFlatRegion& sfrTrimReg, bool bIntersectOrSubtrct = true) = 0 ;
|
|
virtual ISurfFlatRegion* GetTrimRegion( void) const = 0 ;
|
|
virtual bool GetInfo( int& nDegU, int& nDegV, int& nSpanU, int& nSpanV, bool& bIsRat, bool& bTrimmed) const = 0 ;
|
|
virtual const Point3d& GetControlPoint( int nIndU, int nIndV, bool* pbOk) const = 0 ;
|
|
virtual const Point3d& GetControlPoint( int nInd, bool* pbOk) const = 0 ;
|
|
virtual double GetControlWeight( int nIndU, int nIndV, bool* pbOk) const = 0 ;
|
|
virtual double GetControlWeight( int nInd, bool* pbOk) const = 0 ;
|
|
virtual bool IsAPoint( void) const = 0 ;
|
|
virtual bool GetPoint( double dU, double dV, Side nUs, Side nVs, Point3d& ptPos) const = 0;
|
|
virtual bool GetPointD1D2( double dU, double dV, Side nUs, Side nVs,
|
|
Point3d& ptPos,
|
|
Vector3d* pvtDerU = nullptr, Vector3d* pvtDerV = nullptr,
|
|
Vector3d* pvtDerUU = nullptr, Vector3d* pvtDerVV = nullptr, Vector3d* pvtDerUV = nullptr) const = 0 ;
|
|
virtual bool GetPointNrmD1D2( double dU, double dV, Side nUs, Side nVs,
|
|
Point3d& ptPos, Vector3d& vtN,
|
|
Vector3d* pvtDerU = nullptr, Vector3d* pvtDerV = nullptr,
|
|
Vector3d* pvtDerUU = nullptr, Vector3d* pvtDerVV = nullptr, Vector3d* pvtDerUV = nullptr) const = 0 ;
|
|
virtual ICurveComposite* GetCurveOnU( double dV) const = 0 ;
|
|
virtual ICurveComposite* GetCurveOnV( double dU) const = 0 ;
|
|
virtual ICurveComposite* GetLoop( int nLoop) const = 0 ; // nLoop 0-based (1°esterno, successivi interni)
|
|
virtual bool GetControlCurveOnU( int nIndV, PolyLine& plCtrlU) const = 0 ;
|
|
virtual bool GetControlCurveOnV( int nIndU, PolyLine& plCtrlV) const = 0 ;
|
|
virtual const ISurfTriMesh* GetAuxSurf( void) const = 0 ;
|
|
virtual const ISurfTriMesh* GetAuxSurfRefined( void) const = 0 ;
|
|
virtual ISurfTriMesh* GetApproxSurf( double dTol, double dSideMin = 10 * EPS_SMALL, bool bUpdateEdges = false) const = 0 ;
|
|
virtual bool GetLeaves( std::vector<std::tuple<int, Point3d, Point3d>>& vLeaves, bool bRefined = false) const = 0 ;
|
|
virtual bool GetTriangles2D( std::vector<std::tuple<int,Point3d, Point3d, Point3d>>& vTria2D) const = 0 ;
|
|
virtual bool UnprojectPointFromStm( int nT, const Point3d& ptI, Point3d& ptSP, int nIL = 5) const = 0 ;
|
|
virtual bool UnprojectPointFromStm( int nT, const Point3d& ptI, Point3d& ptSP, int nIL, const Point3d& ptIPrev, bool* bTroughEdge = nullptr) const = 0 ;
|
|
virtual bool UnprojectPoint( const Point3d& pt3D, Point3d& ptParam, const Point3d& ptIPrev, bool* bTroughEdge = nullptr, const Plane3d* plCut = nullptr) const = 0 ;
|
|
virtual bool UnprojectCurveFromStm( const ICurveComposite* pCC, ICRVCOMPOPVECTOR& vpCC, const Plane3d* pPlCut) const = 0 ;
|
|
// taglio la parte della superficie dalla parte positiva del versore del piano.
|
|
// Il booleano indica se tenere eventuali triangoli della trimesh ausiliaria che sono coplanari ed equiversi al piano di taglio
|
|
virtual bool Cut( const Plane3d& plPlane, bool bSaveOnEq) = 0 ;
|
|
virtual bool IncreaseUV( double& dU, double dx, bool bUOrV, double* dUVCopy = nullptr, bool bModifyOrig = true) const = 0 ;
|
|
virtual bool IncreaseUV( Point3d& ptUV, Vector3d vtH , Point3d* ptUVCopy, bool bModifyOrig) const = 0 ;
|
|
virtual bool GetLoops( ICRVCOMPOPOVECTOR& vCC, bool bLineOrBezier) const = 0 ;
|
|
virtual ICurveComposite* GetSingleEdge3D( bool bLineOrBezier, int nEdge) const = 0 ;
|
|
virtual bool IsPlanar( void) const = 0 ;
|
|
virtual bool CreateByFlatContour( const PolyLine& PL) = 0 ;
|
|
virtual bool CreateByRegion( const POLYLINEVECTOR& vPL) = 0 ;
|
|
virtual bool CreateByExtrusion( const ICurve* pCrv, const Vector3d& vtExtr) = 0 ;
|
|
virtual bool CreateByScrewing( const ICurve* pCurve, const Point3d& ptAx, const Vector3d& vtAx, double dAngRotDeg, double dMove) = 0 ;
|
|
virtual bool CreateByPointCurve( const Point3d& pt, const ICurve* pCurve) = 0 ;
|
|
virtual bool CreateByTwoCurves( const ICurve* pCurve1, const ICurve* pCurve2, int nType) = 0 ;
|
|
virtual bool CreateBySetOfCurves( const ICURVEPOVECTOR& vCrvBez, bool bReduceToDeg3 = true) = 0 ;
|
|
virtual bool RemoveCollapsedSpans() = 0 ;
|
|
virtual PNTVECTOR GetAllControlPoints( void) const = 0 ;
|
|
virtual bool LimitSurfToTrimmedRegion( void) = 0 ;
|
|
virtual bool CreateSmoothRuledByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, double dSampleLen) = 0 ;
|
|
virtual bool CreateSmoothRuledByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, double dSampleLen, BIPNTVECTOR& vSyncLines) = 0 ;
|
|
} ;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
static const double SBZ_TREG_COEFF = PREC_SCALE_COEFF ;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
inline ISurfBezier* CreateSurfBezier( void)
|
|
{ return (static_cast<ISurfBezier*>( CreateGeoObj( SRF_BEZIER))) ; }
|
|
inline ISurfBezier* CloneSurfBezier( const IGeoObj* pGObj)
|
|
{ if ( pGObj == nullptr || pGObj->GetType() != SRF_BEZIER)
|
|
return nullptr ;
|
|
return (static_cast<ISurfBezier*>(pGObj->Clone())) ; }
|
|
inline const ISurfBezier* GetSurfBezier( const IGeoObj* pGObj)
|
|
{ if ( pGObj == nullptr || pGObj->GetType() != SRF_BEZIER)
|
|
return nullptr ;
|
|
return (static_cast<const ISurfBezier*>(pGObj)) ; }
|
|
inline ISurfBezier* GetSurfBezier( IGeoObj* pGObj)
|
|
{ if ( pGObj == nullptr || pGObj->GetType() != SRF_BEZIER)
|
|
return nullptr ;
|
|
return (static_cast<ISurfBezier*>(pGObj)) ; }
|
|
|
|
//----------------------------------------------------------------------------
|
|
EGK_EXPORT void SetSurfBezierAuxSurfTol( double dTol) ;
|
|
EGK_EXPORT double GetSurfBezierAuxSurfTol( void) ;
|
|
EGK_EXPORT void SetSurfBezierAuxSurfRefinedTol( double dTol) ;
|
|
EGK_EXPORT double GetSurfBezierAuxSurfRefinedTol( void) ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
// Raccolte di puntatori a ISurfBezier
|
|
typedef std::vector<const ISurfBezier*> CISURFBEZPVECTOR ; // vettore di puntatori a const ISurfBezier
|
|
typedef std::vector<ISurfBezier*> ISURFBEZPVECTOR ; // vettore di puntatori a ISurfBezier
|
|
typedef std::list<ISurfBezier*> ISURFBEZPLIST ; // lista di puntatori a ISurfBezier
|
|
typedef std::vector<PtrOwner<ISurfBezier>> ISURFBEZPOVECTOR ; // vettore di puntatori esclusivi a ISurfBezier
|