diff --git a/EGkCurveComposite.h b/EGkCurveComposite.h index a8d55b3..b0b47d7 100644 --- a/EGkCurveComposite.h +++ b/EGkCurveComposite.h @@ -70,6 +70,8 @@ class __declspec( novtable) ICurveComposite : public ICurve virtual bool GetCurveTempProp( int nCrv, int& nProp, int nPropInd = 0) const = 0 ; virtual bool SetCurveTempParam( int nCrv, double dParam, int nParamInd = 0) = 0 ; virtual bool GetCurveTempParam( int nCrv, double& dParam, int nParamInd = 0) const = 0 ; + virtual bool FromPoint( Point3d& ptStart) = 0 ; + virtual bool GetOnlyPoint( Point3d& ptStart) const = 0 ; } ; //----------------------------------------------------------------------------- diff --git a/EGkSurfBezier.h b/EGkSurfBezier.h index 6ebf797..eaffd02 100644 --- a/EGkSurfBezier.h +++ b/EGkSurfBezier.h @@ -14,6 +14,7 @@ #pragma once #include "/EgtDev/Include/EGkSurf.h" +#include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EgtPointerOwner.h" class PolyLine ; @@ -36,7 +37,7 @@ class __declspec( novtable) ISurfBezier : public ISurf 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( const ISurfFlatRegion& sfrTrimReg) = 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 ; @@ -59,6 +60,19 @@ class __declspec( novtable) ISurfBezier : public ISurf virtual bool GetControlCurveOnV( int nIndU, PolyLine& plCtrlV) const = 0 ; virtual const ISurfTriMesh* GetAuxSurf( void) const = 0 ; virtual bool GetLeaves ( std::vector>& vLeaves) const = 0 ; + virtual bool GetTriangles2D( std::vector>& vTria2D) const = 0 ; + virtual bool UnprojectPointFromStm( int nT, const Point3d& ptI, Point3d& ptSP, int nIL) 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 ; + // funzione da chiamare per calcolare i poli della superficie. NECESSARIO se si vuole tagliare la superficie con un piano + virtual bool CalcPoles( void) ; + 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, int nEdge = -1) const = 0 ; } ; //----------------------------------------------------------------------------- diff --git a/EXeExecutor.h b/EXeExecutor.h index dda8f53..f49ea22 100644 --- a/EXeExecutor.h +++ b/EXeExecutor.h @@ -367,6 +367,8 @@ EXE_EXPORT int ExeCreateSurfTmByVolZmap( int nParentId, int nZmapId, int nPart) EXE_EXPORT int ExeCreateSurfBezier( int nParentId, int nDegU, int nDegV, int nSpanU, int nSpanV, const PNTVECTOR& vPnt, int nRefType) ; EXE_EXPORT int ExeCreateSurfBezierRational( int nParentId, int nDegU, int nDegV, int nSpanU, int nSpanV, const PNTUVECTOR& vPntW, int nRefType) ; EXE_EXPORT int ExeCreateSurfBezierLeaves( int nParentId, int nSurfBzId, int nTextHeight = 50, bool bShowTrim = false, int* pnCount = nullptr) ; +EXE_EXPORT int ExeCreateBezierSphere( int nParentId, const Point3d& ptCenter, double dR, int nRefType) ; +EXE_EXPORT int ExeCreateSurfBezierTria2D( int nParentId, int nSurfBzId, int nTextHeight, bool bShowTrim, int* pnCount) ; // GeomDB Create Volume EXE_EXPORT int ExeCreateVolZmap( int nParentId, const Point3d& ptIni, double dDimX, @@ -620,6 +622,7 @@ EXE_EXPORT bool ExeSurfTmRemoveFacet( int nId, int nFacet) ; EXE_EXPORT bool ExeSurfTmSwapFacets( int nId, int nFacet1, int nFacet2) ; EXE_EXPORT bool ExeSurfTmRemovePart( int nId, int nPart) ; EXE_EXPORT bool ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSaveOnEq, int nRefType) ; +EXE_EXPORT bool ExeCutSurfBzPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSaveOnEq, int nRefType) ; EXE_EXPORT bool ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq) ; EXE_EXPORT bool ExeSurfTmAdd( int nId1, int nId2, bool bTwoColors = false) ; EXE_EXPORT bool ExeSurfTmSubtract( int nId1, int nId2, bool bTwoColors = false) ; @@ -815,6 +818,8 @@ EXE_EXPORT bool ExeLineBoxInters( const Point3d& ptP, const Vector3d& vtDir, con INTDBLVECTOR& vInters) ; EXE_EXPORT bool ExeLineSurfTmInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType, INTDBLVECTOR& vInters) ; +EXE_EXPORT bool ExeLineSurfBzInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType, + INTDBLVECTOR& vInters) ; EXE_EXPORT bool ExeLineVolZmapInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType, INTDBLVECTOR& vInters) ; EXE_EXPORT int ExePlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, const int nDestGrpId, const int nRefType, diff --git a/EgkIntersLineSurfBez.h b/EgkIntersLineSurfBez.h new file mode 100644 index 0000000..a6322d0 --- /dev/null +++ b/EgkIntersLineSurfBez.h @@ -0,0 +1,79 @@ +//---------------------------------------------------------------------------- +// EgalTech 2024 +//---------------------------------------------------------------------------- +// File : EGkIntersLineSurfBez.h Data : 06.02.24 Versione : 2.6b1 +// Contenuto : Dichiarazione della classe intersezione Linea/SurfTriMesh. +// +// +// +// Modifiche : 06.02.24 DB Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "/EgtDev/Include/EGkSurfTriMesh.h" +#include "/EgtDev/Include/EGkIntersLineTria.h" +#include "/EgtDev/Include/EGkHashGrids2d.h" +#include "/EgtDev/Include/EGkSurfBezier.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 + +//----------------------------------------------------------------------------- +//! dati di intersezione linea - superficie trimesh +struct IntLinSbzInfo { + int nILTT ; //!< tipo di intersezione linea-triangolo + double dU ; //!< parametro sulla linea + double dU2 ; //!< secondo parametro sulla linea + int nT ; //!< indice del triangolo della superficie trimesh + double dCosDN ; //!< coseno dell'angolo tra la direzione della linea e la normale del triangolo + Point3d ptI ; //!< punto di intersezione + Point3d ptI2 ; //!< secondo punto di intersezione (termine di tratto sovrapposto) + Point3d ptUV ; //!< coordinate del punto nello spazio parametrico + Point3d ptUV2 ; //!< coordinate del secondo punto nello spazio parametrico + // costruttori + IntLinSbzInfo( void) : nILTT( ILTT_NO), dU( 0), dU2( 0), nT(0), dCosDN(0), ptI(), ptI2(), ptUV(), ptUV2(){} + IntLinSbzInfo( int nIL, double dUU, int nTT, double dCos, const Point3d& ptP, const Point3d ptSP) + : nILTT( nIL), dU( dUU), dU2( 0), nT( nTT), dCosDN( dCos), ptI( ptP), ptI2(), ptUV( ptSP), ptUV2() {} + IntLinSbzInfo( int nIL, double dUU, double dUU2, int nTT, double dCos, const Point3d& ptP, const Point3d& ptP2, const Point3d& ptSP, const Point3d& ptSP2) + : nILTT( nIL), dU( dUU), dU2( dUU2), nT( nTT), dCosDN( dCos), ptI( ptP), ptI2( ptP2), ptUV( ptSP), ptUV2( ptSP2) {} +} ; +//! vettore di IntLinSbzInfo +typedef std::vector ILSBIVECTOR ; + +//----------------------------------------------------------------------------- +// Costanti tipo intersezione Linea SurfTriMesh dopo filtraggio +enum LSBiType { LSBT_NONE = 0, + LSBT_IN = 1, + LSBT_OUT = 2, + LSBT_TG_INI = 3, + LSBT_TG_FIN = 4, + LSBT_TOUCH = 5} ; + +//----------------------------------------------------------------------------- +EGK_EXPORT bool IntersLineSurfBz( const Point3d& ptL, const Vector3d& vtL, double dLen, const ISurfBezier* pSBz, + ILSBIVECTOR& vInfo, bool bFinite = true) ; + +//----------------------------------------------------------------------------- +class IntersParLinesSurfBz +{ +public : + EGK_EXPORT IntersParLinesSurfBz( const Frame3d& frLines, const ISurfBezier& SBz) ; + EGK_EXPORT bool GetInters( const Point3d& ptL, double dLen, ILSBIVECTOR& vInfo, bool bFinite = true) const ; + +private : + bool m_bOk ; + const Frame3d m_frLines ; + const ISurfBezier* m_pSBz ; + HashGrids2d m_HGrids ; +} ; + +//----------------------------------------------------------------------------- +EGK_EXPORT bool FilterLineSurfBzInters( const ILSBIVECTOR& vInfo, INTDBLVECTOR& vInters) ; \ No newline at end of file diff --git a/EgkSbzStandard.h b/EgkSbzStandard.h new file mode 100644 index 0000000..1192156 --- /dev/null +++ b/EgkSbzStandard.h @@ -0,0 +1,27 @@ +//---------------------------------------------------------------------------- +// EgalTech 2024 +//---------------------------------------------------------------------------- +// File : EGkSbzStandard.h Data : 14.02.24 Versione : 2.6b2 +// Contenuto : Dichiarazione funzioni per creazione superfici Sbz +// standard : Box, Pyramid, Cylinder, Sphere, Cone. +// +// +// Modifiche : 14.02.24 DB Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "/EgtDev/Include/EGkSurfBezier.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 + +//---------------------------------------------------------------------------- +EGK_EXPORT ISurfBezier* CreateBezierSphere( const Point3d& ptCenter, double dR) ; \ No newline at end of file