From d3c44f22413e2bed89709713077d65a579dbd930 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Fri, 7 Jun 2024 19:04:05 +0200 Subject: [PATCH 1/6] Include : - negli oggetti HashGridsNd vietati costruttore di copia e assegnazione con copia di default. --- EGkHashGrids1d.h | 6 +++--- EGkHashGrids2d.h | 6 +++--- EGkHashGrids3d.h | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/EGkHashGrids1d.h b/EGkHashGrids1d.h index cbdfb49..991517c 100644 --- a/EGkHashGrids1d.h +++ b/EGkHashGrids1d.h @@ -56,11 +56,11 @@ private : typedef std::list ObjList ; typedef std::vector PtrObjVector ; typedef std::unordered_map IntPObjUmap ; + typedef std::list GridList ; private : - typedef std::list GridList ; // Tipo per lista di hash grid - -private : + HashGrids1d( const HashGrids1d&) = delete ; + HashGrids1d& operator=( const HashGrids1d&) = delete ; void addGrid( ObjData& obj) ; void addList( ObjData& obj) ; diff --git a/EGkHashGrids2d.h b/EGkHashGrids2d.h index 2f18b3e..7de1f1a 100644 --- a/EGkHashGrids2d.h +++ b/EGkHashGrids2d.h @@ -56,11 +56,11 @@ class HashGrids2d typedef std::list ObjList ; typedef std::vector PtrObjVector ; typedef std::unordered_map IntPObjUmap ; + typedef std::list GridList ; private : - typedef std::list GridList ; // Tipo per lista di hash grid - - private : + HashGrids2d( const HashGrids2d&) = delete ; + HashGrids2d& operator=( const HashGrids2d&) = delete ; void addGrid( ObjData& obj) ; void addList( ObjData& obj) ; diff --git a/EGkHashGrids3d.h b/EGkHashGrids3d.h index 6195abd..8795ae1 100644 --- a/EGkHashGrids3d.h +++ b/EGkHashGrids3d.h @@ -56,11 +56,11 @@ class HashGrids3d typedef std::list ObjList ; typedef std::vector PtrObjVector ; typedef std::unordered_map IntPObjUmap ; + typedef std::list GridList ; private : - typedef std::list GridList ; // Tipo per lista di hash grid - - private : + HashGrids3d( const HashGrids3d&) = delete ; + HashGrids3d& operator=( const HashGrids3d&) = delete ; void addGrid( ObjData& obj) ; void addList( ObjData& obj) ; From 9dbb6fac605dbf7d0eb2ad1139647db088008d24 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 11 Jun 2024 09:32:30 +0200 Subject: [PATCH 2/6] Include : - aggiornamento prototipi. --- EGkCAvSilhouetteSurfTm.h | 48 ++++++++++++++++++++++++++++++++++++++++ EGkCAvToolSurfTm.h | 1 + EGkFrame3d.h | 13 ++++++++++- EXeExecutor.h | 4 ++-- 4 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 EGkCAvSilhouetteSurfTm.h diff --git a/EGkCAvSilhouetteSurfTm.h b/EGkCAvSilhouetteSurfTm.h new file mode 100644 index 0000000..6b8b894 --- /dev/null +++ b/EGkCAvSilhouetteSurfTm.h @@ -0,0 +1,48 @@ +//---------------------------------------------------------------------------- +// EgalTech 2024-2024 +//---------------------------------------------------------------------------- +// File : EGkCAvSilhouetteSurfTm.h Data : 08.06.24 Versione : 2.6f2 +// Contenuto : Dichiarazione della funzione calcolo silhouette. +// +// +// +// Modifiche : 08.06.24 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "/EgtDev/Include/EGkSurfTriMesh.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 bool CAvSilhouetteSurfTm( const ISurfTriMesh& Stm, const Plane3d& plPlane, double dTol, POLYLINEVECTOR& vPL) ; + +//----------------------------------------------------------------------------- +class CAvParSilhouettesSurfTm +{ + public : + EGK_EXPORT CAvParSilhouettesSurfTm( const CISURFTMPVECTOR& vpStm, const Frame3d& frPlanes, double dTol) ; + EGK_EXPORT bool GetSilhouette( double dLevel, POLYLINEVECTOR& vPL) ; + + private : + bool Prepare( void) ; + + private : + CISURFTMPVECTOR m_vpStm ; + Frame3d m_frPlanes ; + Vector3d m_vtMove ; + double m_dTol ; + int m_nStepX ; + int m_nStepY ; + DBLVECTOR m_vdGrid ; + bool m_bGridOk ; +} ; diff --git a/EGkCAvToolSurfTm.h b/EGkCAvToolSurfTm.h index d782334..d6f11ea 100644 --- a/EGkCAvToolSurfTm.h +++ b/EGkCAvToolSurfTm.h @@ -37,6 +37,7 @@ class __declspec( novtable) ICAvToolSurfTm { virtual double GetToolHeight( void) const = 0 ; virtual const ICurveComposite& GetToolOutline( bool bApprox = false) const = 0 ; virtual bool TestPosition( const Point3d& ptT, const Vector3d& vtDir, const Vector3d& vtMove, double& dTotDist) = 0 ; + virtual bool TestSeries( PNTUVECTOR& vPntM, const Vector3d& vtDir, const Vector3d& vtMove, double dProgCoeff = 1) = 0 ; virtual bool TestPath( PNTULIST& lPntM, const Vector3d& vtDir, const Vector3d& vtMove, double dLinTol, double dProgCoeff = 1) = 0 ; } ; diff --git a/EGkFrame3d.h b/EGkFrame3d.h index 5fb7f16..05ee1f8 100644 --- a/EGkFrame3d.h +++ b/EGkFrame3d.h @@ -116,11 +116,22 @@ operator/( const Frame3d& frRef, const Frame3d& frDest) return frNew ; } +//---------------------------------------------------------------------------- +//! Restituisce il frame inverso di quello passato +//---------------------------------------------------------------------------- +inline const Frame3d +GetInvert( const Frame3d& frRef) +{ + Frame3d frNew = GLOB_FRM ; + frNew.ToLoc( frRef) ; + return frNew ; +} + //---------------------------------------------------------------------------- //! Restituisce una copia in locale del frame passato //---------------------------------------------------------------------------- inline const Frame3d -GetToLoc ( const Frame3d& frRef, const Frame3d& frDest) +GetToLoc( const Frame3d& frRef, const Frame3d& frDest) { Frame3d frNew = frRef ; frNew.ToLoc( frDest) ; diff --git a/EXeExecutor.h b/EXeExecutor.h index fe3920b..df8ac11 100644 --- a/EXeExecutor.h +++ b/EXeExecutor.h @@ -761,8 +761,8 @@ EXE_EXPORT bool ExeSurfTmFacetOppositeSideEx( int nId, int nFacet, const Vector3 EXE_EXPORT bool ExeSurfTmFacetsContact( int nId, int nF1, int nF2, int nRefId, bool& bAdjac, Point3d& ptP1, Point3d& ptP2, double& dAng) ; EXE_EXPORT int ExeExtractSurfTmLoops( int nId, int nDestGrpId, int* pnCount) ; EXE_EXPORT int ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDestGrpId, int nRefType, int* pnCount, bool bAllTria = false) ; -EXE_EXPORT int ExeGetSurfTmSilhouetteEx( int nId, const Point3d& ptOn, const Vector3d& vtN, double dToler, int nDestGrpId, int nRefType, - int* pnCount, bool bAllTria) ; +EXE_EXPORT int ExeGetSurfTmParSilhouettes( const INTVECTOR& vIds, const Point3d& ptOn, const Vector3d& vtN, const DBLVECTOR& vdDist, + double dToler, int nDestGrpId, int nRefType, int* pnCount) ; EXE_EXPORT int ExeExtractSurfTmFacetLoops( int nId, int nFacet, int nDestGrpId, int* pnCount) ; EXE_EXPORT int ExeCopySurfTmFacet( int nId, int nFacet, int nDestGrpId) ; EXE_EXPORT bool ExeSurfTmGetAllVertInFacet( int nId, int nFacet, INTVECTOR& vVert) ; From a933bea8363a769c692bd5d3e24289768df9fd74 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 13 Jun 2024 07:58:47 +0200 Subject: [PATCH 3/6] Include : - aggiornamento prototipi. --- EGkSurfFlatRegion.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/EGkSurfFlatRegion.h b/EGkSurfFlatRegion.h index b076359..eee5e43 100644 --- a/EGkSurfFlatRegion.h +++ b/EGkSurfFlatRegion.h @@ -52,6 +52,10 @@ class __declspec( novtable) ISurfFlatRegion : public ISurf virtual bool CalcVoronoiDiagram( ICURVEPOVECTOR& vCrvs, int nBound = 3) const = 0 ; virtual bool CalcMedialAxis( ICURVEPOVECTOR& vCrvs, int nSide = 1) const = 0 ; virtual void ResetVoronoiObject( void) const = 0 ; + virtual bool SetCurveTempProp( int nChunk, int nLoop, int nCrv, int nProp, int nPropInd = 0) = 0 ; + virtual bool GetCurveTempProp( int nChunk, int nLoop, int nCrv, int& nProp, int nPropInd = 0) const = 0 ; + virtual bool SetCurveTempParam( int nChunk, int nLoop, int nCrv, double dParam, int nParamInd = 0) = 0 ; + virtual bool GetCurveTempParam( int nChunk, int nLoop, int nCrv, double& dParam, int nParamInd = 0) const = 0 ; } ; //----------------------------------------------------------------------------- From d2880b5167e01f23693f6ef4053715c704a7c0a8 Mon Sep 17 00:00:00 2001 From: Riccardo Elitropi Date: Fri, 14 Jun 2024 16:49:09 +0200 Subject: [PATCH 4/6] Include : - aggiunta funzioni in GeoObjSave. --- EGkGeoObjSave.h | 106 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 2 deletions(-) diff --git a/EGkGeoObjSave.h b/EGkGeoObjSave.h index 7f2b170..c6ca6fd 100644 --- a/EGkGeoObjSave.h +++ b/EGkGeoObjSave.h @@ -21,7 +21,7 @@ bool SaveGeoObj( IGeoObj* pGObj, const std::string& sFile, int nFlag = GDB_SV_BIN) { - // verifico validità oggetto + // verifico validità oggetto if ( pGObj == nullptr || ! pGObj->IsValid()) return false ; // creo GeomDB temporaneo @@ -47,7 +47,7 @@ bool SaveGeoObj( std::vector vpGObj, const std::string& sFile, int nFlag = GDB_SV_BIN) { for ( int i = 0 ; i < int( vpGObj.size()); ++i) { - // verifico validità oggetto + // verifico validità oggetto if ( vpGObj[i] == nullptr || ! vpGObj[i]->IsValid() ) return false ; } @@ -75,4 +75,106 @@ SaveGeoObj( std::vector vpGObj, const std::string& sFile, int nFlag = bOk = ( pGeomDB->RemoveGeoObjAndErase( vIds[i]) != nullptr ) && bOk ; return bOk ; +} + +//---------------------------------------------------------------------------- +bool +SaveGeoObj( std::vector> vvpGObj, std::vector vCol, + const std::string& sFile, int nFlag = GDB_SV_BIN) +{ + // verifico validità oggetti + for ( int i = 0 ; i < int( vvpGObj.size()) ; ++ i) { + for ( int j = 0 ; j < int( vvpGObj[i].size()) ; ++ j) { + if ( vvpGObj[i][j] == nullptr || ! vvpGObj[i][j]->IsValid()) + return false ; + } + } + if ( int( vCol.size()) <= int( vvpGObj.size())) { + for ( int i = int( vCol.size()) ; i < int( vvpGObj.size()) ; ++ i) + vCol.push_back( BLACK) ; + } + else + return false ; + + // creo GeomDB temporaneo + PtrOwner pGeomDB( CreateGeomDB()) ; + if ( IsNull( pGeomDB)) + return false ; + INTVECTOR vIds ; + int nLayId = 0 ; + + // creo il part + int nPartId = pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ; + + // per ogni elemento i-esimo, creo un layer + for ( int i = 0 ; i < int( vvpGObj.size()) ; ++i) { + // creo il layer + nLayId = pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ; + pGeomDB->SetMaterial( nLayId, vCol[i]) ; + + for ( int j = 0 ; j < int( vvpGObj.size()) ; ++ j) { + // inserisco gli oggetti corrispondenti + int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nLayId, vvpGObj[i][j]) ; + vIds.push_back( nId) ; + if ( nId == GDB_ID_NULL) + return false ; + } + } + + // eseguo il salvataggio + bool bOk = pGeomDB->Save( vIds, sFile, nFlag) ; + // rimuovo l'oggetto dal GeomDB + for ( int i = 0 ; i < int( vIds.size()) ; ++i) + bOk = ( pGeomDB->RemoveGeoObjAndErase( vIds[i]) != nullptr) && bOk ; + + return bOk ; +} + +//---------------------------------------------------------------------------- +bool +SaveCurveCompo( ICRVCOMPOPOVECTOR& vCompo, bool bUniform, const std::string& sFile, int nFlag = GDB_SV_BIN) +{ + // controllo validità delle curve + std::vector vpGObj ; + for ( int i = 0 ; i < int( vCompo.size()) ; ++ i) { + if ( vCompo[i] == nullptr || ! vCompo[i]->IsValid()) + return false ; + vpGObj.emplace_back( static_cast( vCompo[i]->Clone())) ; + } + // creo GeomDB temporaneo + PtrOwner pGeomDB( CreateGeomDB()) ; + if ( IsNull( pGeomDB)) + return false ; + INTVECTOR vIds ; + + // se curve con colore uniforme + if ( bUniform) + return SaveGeoObj( vpGObj, sFile, nFlag) ; + + // altrimenti scorro le sottocurve e le coloro in base alle temp prop + int nPartId = pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ; + int nLayId = 0 ; + for ( int i = 0 ; i < int( vCompo.size()) ; ++i) { + // inserisco l'oggetto nel GeomDB (sotto pezzo/layer) + nLayId = pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ; + for ( int u = 0 ; u < vCompo[i]->GetCurveCount() ; ++ u) { + const ICurve* pCrv = vCompo[i]->GetCurve( u) ; + if ( pCrv == nullptr) + return false ; + int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nLayId, pCrv->Clone()) ; + pGeomDB->SetMaterial( nId, ( pCrv->GetTempProp( 0) == 1 ? RED : + ( pCrv->GetTempProp( 0)) == 0 ? BLUE : WHITE)) ; + vIds.push_back( nId) ; + if ( nId == GDB_ID_NULL) + return false ; + } + } + // eseguo il salvataggio + bool bOk = pGeomDB->Save( vIds, sFile, nFlag) ; + // rimuovo l'oggetto dal GeomDB + for ( int i = 0 ; i < int( vIds.size()); ++i) + bOk = ( pGeomDB->RemoveGeoObjAndErase( vIds[i]) != nullptr) && bOk ; + + return bOk ; + } \ No newline at end of file From e5873f66ce7f3562f0a3f45207bbf2b4672aba18 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 17 Jun 2024 07:10:50 +0200 Subject: [PATCH 5/6] Include : - aggiornamento prototipi. --- EGkCAvSilhouetteSurfTm.h | 23 +++++++---------------- EGkCAvToolSurfTm.h | 2 ++ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/EGkCAvSilhouetteSurfTm.h b/EGkCAvSilhouetteSurfTm.h index 6b8b894..48381ee 100644 --- a/EGkCAvSilhouetteSurfTm.h +++ b/EGkCAvSilhouetteSurfTm.h @@ -27,22 +27,13 @@ EGK_EXPORT bool CAvSilhouetteSurfTm( const ISurfTriMesh& Stm, const Plane3d& plPlane, double dTol, POLYLINEVECTOR& vPL) ; //----------------------------------------------------------------------------- -class CAvParSilhouettesSurfTm +class __declspec( novtable) ICAvParSilhouettesSurfTm { public : - EGK_EXPORT CAvParSilhouettesSurfTm( const CISURFTMPVECTOR& vpStm, const Frame3d& frPlanes, double dTol) ; - EGK_EXPORT bool GetSilhouette( double dLevel, POLYLINEVECTOR& vPL) ; - - private : - bool Prepare( void) ; - - private : - CISURFTMPVECTOR m_vpStm ; - Frame3d m_frPlanes ; - Vector3d m_vtMove ; - double m_dTol ; - int m_nStepX ; - int m_nStepY ; - DBLVECTOR m_vdGrid ; - bool m_bGridOk ; + virtual ~ICAvParSilhouettesSurfTm( void) {} + virtual bool SetData( const CISURFTMPVECTOR& vpStm, const Frame3d& frPlanes, double dTol) = 0 ; + virtual bool GetSilhouette( double dLevel, POLYLINEVECTOR& vPL) = 0 ; } ; + +//----------------------------------------------------------------------------- +EGK_EXPORT ICAvParSilhouettesSurfTm* CreateCAvParSilhouettesSurfTm( void) ; diff --git a/EGkCAvToolSurfTm.h b/EGkCAvToolSurfTm.h index d6f11ea..176ea05 100644 --- a/EGkCAvToolSurfTm.h +++ b/EGkCAvToolSurfTm.h @@ -23,6 +23,8 @@ #define EGK_EXPORT __declspec( dllimport) #endif +class ICurveComposite ; + //----------------------------------------------------------------------------- class __declspec( novtable) ICAvToolSurfTm { public : From 675c09e36b8870d7def06bc88a53083447bf7ee2 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 18 Jun 2024 07:33:33 +0200 Subject: [PATCH 6/6] Include : - aggiornamento prototipi. --- EXeExecutor.h | 1 + 1 file changed, 1 insertion(+) diff --git a/EXeExecutor.h b/EXeExecutor.h index df8ac11..e42db12 100644 --- a/EXeExecutor.h +++ b/EXeExecutor.h @@ -743,6 +743,7 @@ EXE_EXPORT int ExeSurfTmFacetCount( int nId) ; EXE_EXPORT int ExeSurfTmPartCount( int nId) ; EXE_EXPORT bool ExeSurfTmGetVertex( int nId, int nVert, int nRefId, Point3d& ptVert) ; EXE_EXPORT bool ExeSurfTmGetNearestVertex( int nId, const Point3d& ptNear, int nRefId, int& nVert, Point3d& ptVert) ; +EXE_EXPORT bool ExeSurfTmTriangleNormVersor( int nId, int nTria, int nRefId, Vector3d& vtNorm) ; EXE_EXPORT int ExeSurfTmFacetFromTria( int nId, int nT) ; EXE_EXPORT bool ExeSurfTmFacetAdjacencies( int nId, int nFacet, INTMATRIX& vAdj) ; EXE_EXPORT bool ExeSurfTmFacetNearestEndPoint( int nId, int nFacet, const Point3d& ptNear, int nRefId,