c668a261d9
- aggiunta enum e funzione per gestione spigoli.
117 lines
4.1 KiB
C++
117 lines
4.1 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2026
|
|
//----------------------------------------------------------------------------
|
|
// File : EGkOffsetCurve3d.h Data : 10.06.26 Versione : 3.1f1
|
|
// Contenuto : Dichiarazione classe per offset di ICurve, per curve 3d.
|
|
//
|
|
//
|
|
// Modifiche : 10.06.26 DB Creazione modulo.
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "/EgtDev/Include/EGkFrame3d.h"
|
|
#include "/EgtDev/Include/EGkPoint3d.h"
|
|
#include "/EgtDev/Include/EGkVector3d.h"
|
|
#include "/EgtDev/Include/EGkPolyLine.h"
|
|
#include "/EgtDev/Include/EGkCurve.h"
|
|
#include "/EgtDev/Include/EGkCurveComposite.h"
|
|
#include "/EgtDev/Include/EGkProjectCurveSurf.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
|
|
|
|
//----------------------------------------------------------------------------
|
|
struct OffsetSegm {
|
|
PtrOwner<ICurve> pCrv ;
|
|
int nFlag ; // OffsetCurve3d::AngType
|
|
int nParent ;
|
|
OffsetSegm( ICurve* _pCrv, int _nFlag, int _nParent) :
|
|
nFlag( _nFlag), nParent( _nParent) { pCrv.Set( _pCrv); } ;
|
|
} ;
|
|
|
|
typedef std::vector<OffsetSegm> OFFSETSEGVEC ;
|
|
|
|
enum OFFTYPE {
|
|
GEOM = 0,
|
|
PLANECUT = 1,
|
|
};
|
|
|
|
struct EditCrvInfo {
|
|
enum EditFlag {
|
|
NOEDIT = 0,
|
|
DEL = 1,
|
|
EDIT = 2
|
|
};
|
|
int nId = -1 ;
|
|
int nFlag = 0 ;
|
|
Point3d ptStart = P_INVALID ;
|
|
Point3d ptEnd = P_INVALID ;
|
|
EditCrvInfo( int _nId, int _nFlag) : nId( _nId), nFlag( _nFlag) { ;}
|
|
EditCrvInfo( int _nId, int _nFlag, const Point3d& _ptStart, const Point3d& _ptEnd) :
|
|
nId( _nId), nFlag( _nFlag), ptStart( _ptStart), ptEnd( _ptEnd) { ;}
|
|
};
|
|
|
|
typedef std::vector<EditCrvInfo> EDITCRVINFOVEC ;
|
|
|
|
struct Cyl {
|
|
Cyl( void): frCyl( GLOB_FRM), dH( 0.), dRad( 0.) {;} ;
|
|
Cyl( const Frame3d& _frCyl, double _dH, double _dRad, double _dLinTol) :
|
|
frCyl( _frCyl), dH( _dH), dRad( _dRad) { ;}
|
|
Cyl( const Point3d& _ptBase, const Vector3d& vtZ, double _dH, double _dRad, double _dLinTol) :
|
|
dH( _dH), dRad( _dRad){
|
|
frCyl.Set( _ptBase, vtZ); }
|
|
public :
|
|
Frame3d frCyl ;
|
|
public:
|
|
double dH ;
|
|
double dRad ;
|
|
};
|
|
|
|
typedef std::vector<Cyl> CYLVECT ;
|
|
|
|
|
|
EGK_EXPORT bool CalcAdjustConcavePartsInPath( const ICurveComposite* pCrv, const OFFSETSEGVEC& vOffsetCrvs, double dRad, EDITCRVINFOVEC& vEditInfo) ;
|
|
EGK_EXPORT bool CalcAdjustConcavePartsPlaneCut( const ICurveComposite* pCrv, const PNT5AXVECTOR& vPnt5Ax, const OFFSETSEGVEC& vOffsetCrvs,
|
|
double dRad, EDITCRVINFOVEC& vEditInfo) ;
|
|
EGK_EXPORT bool IsPointInsideCylinder( const Point3d& ptTest, const Cyl& offCyl, double dLinTol) ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
class OffsetCurve3d
|
|
{
|
|
public :
|
|
enum AngType { ANG_STR = 1 , // angolo piatto ( quindi tratto in continuità col precedente)
|
|
ANG_CVEX = 2 , // su angolo convesso
|
|
ANG_CONC = 3 , // in angolo concavo
|
|
ANG_BEFORE_CONC = 4 , // adiacente ad angolo concavo
|
|
ANG_AFTER_CONC = 5 , // adiacente ad angolo concavo
|
|
ANG_SMOOTH_CONC = 6 // zona concava curva, senza spigolo netto
|
|
};
|
|
|
|
public :
|
|
EGK_EXPORT OffsetCurve3d(): m_dLinTol( 10 * EPS_SMALL) {} ;
|
|
EGK_EXPORT OffsetCurve3d( double dLinTol) : m_dLinTol( dLinTol) {} ;
|
|
EGK_EXPORT ~OffsetCurve3d( void) ;
|
|
|
|
public :
|
|
EGK_EXPORT bool Reset( void) ;
|
|
EGK_EXPORT bool Make( const PNT5AXVECTOR& vPnt5Ax, double dDist, int nType) ;
|
|
EGK_EXPORT int GetCurveCount( void) { return int( m_CrvLst.size()) ; }
|
|
EGK_EXPORT ICurve* GetCurve( void) ;
|
|
EGK_EXPORT ICurve* GetLongerCurve( void) ;
|
|
EGK_EXPORT ICurve* GetShorterCurve( void) ;
|
|
EGK_EXPORT double GetLinTol( void) const { return m_dLinTol ; }
|
|
EGK_EXPORT void SetLinTol( double dTol) { m_dLinTol = dTol ; }
|
|
|
|
private :
|
|
ICURVEPLIST m_CrvLst ;
|
|
double m_dLinTol ;
|
|
} ; |