From 11eb3ae854797389c8d4cb0822252ee15800744b Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 11 Feb 2015 11:47:14 +0000 Subject: [PATCH] Include : - aggiornamento. --- EGkCurveLocal.h | 55 +++++++++++++++++++++++++++++++++----------- EGkPointGrid3d.h | 2 ++ EGkPolyLine.h | 5 ++-- EGkStmFromCurves.h | 13 +++++++---- EGkTriangle3d.h | 21 +++++++++++++---- EGkVector3d.h | 2 +- EGnStringConverter.h | 4 +++- EGrScene.h | 3 ++- EInAPI.h | 17 +++++++++----- EgkSurfTriMesh.h | 4 ++-- EgnGetModuleVer.h | 1 + EgtLogger.h | 1 + EgtNumCollection.h | 5 ++++ EgtPerfCounter.h | 1 + EgtTrace.h | 2 +- 15 files changed, 99 insertions(+), 37 deletions(-) diff --git a/EGkCurveLocal.h b/EGkCurveLocal.h index be57b6d..76afcc8 100644 --- a/EGkCurveLocal.h +++ b/EGkCurveLocal.h @@ -21,7 +21,7 @@ class CurveLocal { public : CurveLocal( IGeomDB* pGeomDB, int nCrvId, const Frame3d& frLoc) - : pCrv( nullptr), pCopy( nullptr) + : m_pCrv( nullptr), m_pCopy( nullptr) { // verifica dei parametri if ( pGeomDB == nullptr || &frLoc == nullptr) return ; @@ -30,30 +30,57 @@ class CurveLocal if ( ! pGeomDB->GetGlobFrame( nCrvId, frCrv)) return ; // recupero la curva - pCrv = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ; + m_pCrv = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ; // se i riferimenti coincidono non devo fare altro if ( AreSameFrame( frCrv, frLoc)) return ; // copio la curva e la porto in locale - pCopy = pCrv->Clone() ; - if ( pCopy == nullptr) { - pCrv = nullptr ; + m_pCopy = m_pCrv->Clone() ; + if ( m_pCopy == nullptr) { + m_pCrv = nullptr ; return ; } - pCopy->LocToLoc( frCrv, frLoc) ; - pCrv = pCopy ; + m_pCopy->LocToLoc( frCrv, frLoc) ; + m_pCrv = m_pCopy ; + } + CurveLocal( const CurveLocal& Other) + : m_pCrv( nullptr), m_pCopy( nullptr) + { // se non devo clonare + if ( Other.m_pCopy == nullptr) { + m_pCrv = Other.m_pCrv ; + return ; + } + m_pCopy = Other.m_pCopy->Clone() ; + if ( m_pCopy == nullptr) + return ; + m_pCrv = m_pCopy ; + } + CurveLocal( CurveLocal&& Other) _NOEXCEPT + : m_pCrv( Other.m_pCrv), m_pCopy( Other.m_pCopy) + { // annullo gli originali + Other.m_pCrv = nullptr ; + Other.m_pCopy = nullptr ; } ~CurveLocal( void) { // se necessario libero la memoria - if ( pCopy != nullptr) - delete pCopy ; - pCopy = nullptr ; - pCrv = nullptr ; + if ( m_pCopy != nullptr) + delete m_pCopy ; + m_pCopy = nullptr ; + m_pCrv = nullptr ; } const ICurve* Get( void) - { return pCrv ; } + { return m_pCrv ; } private : - const ICurve* pCrv ; - ICurve* pCopy ; + CurveLocal& operator =( const CurveLocal& other) ; // intenzionalmente senza implementazione + CurveLocal& operator =( CurveLocal&& other) ; // intenzionalmente senza implementazione + + private : + const ICurve* m_pCrv ; + ICurve* m_pCopy ; } ; + +//---------------------------------------------------------------------------- +// Raccolte di CurveLocal +typedef std::vector CURVELOCALVECTOR ; // vettore di CurveLocal +typedef std::list CURVELOCALLIST ; // lista di CurveLocal diff --git a/EGkPointGrid3d.h b/EGkPointGrid3d.h index 9eab69f..e97f1cd 100644 --- a/EGkPointGrid3d.h +++ b/EGkPointGrid3d.h @@ -35,6 +35,7 @@ class PointGrid3d EGK_EXPORT bool Init( int nBuckets, double dCellDim = 100 * EPS_SMALL) ; EGK_EXPORT bool InsertPoint( const Point3d& ptP, int nId) ; EGK_EXPORT bool RemovePoint( const Point3d& ptP, int nId) ; + EGK_EXPORT bool Find( const BBox3d& b3Test, INTVECTOR& vnIds) ; EGK_EXPORT bool Find( const Point3d& ptTest, double dTol, INTVECTOR& vnIds) ; EGK_EXPORT bool Find( const Point3d& ptTest, double dTol, int& nId) ; EGK_EXPORT bool FindNearest( const Point3d& ptTest, INTVECTOR& vnIds) ; @@ -42,6 +43,7 @@ class PointGrid3d private : inline int Get1dCellNbr( double dCoord) ; + inline bool Get3dRangeNbr( const BBox3d& b3Test, IBox& iBox) ; inline bool Get3dRangeNbr( const Point3d& ptTest, double dTol, IBox& iBox) ; inline int PointHash( int nX, int nY, int nZ) ; diff --git a/EGkPolyLine.h b/EGkPolyLine.h index 766b740..172810a 100644 --- a/EGkPolyLine.h +++ b/EGkPolyLine.h @@ -14,10 +14,10 @@ #pragma once #include "/EgtDev/Include/EGkPoint3d.h" +#include "/EgtDev/Include/EGkBBox3d.h" +#include "/EgtDev/Include/EGkPlane3d.h" #include "/EgtDev/Include/EGkGeoCollection.h" -class Plane3d ; - //----------------------- Macro per import/export ---------------------------- #undef EGK_EXPORT #if defined( I_AM_EGK) // da definirsi solo nella DLL @@ -51,6 +51,7 @@ class PolyLine EGK_EXPORT bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest) ; EGK_EXPORT bool Join( PolyLine& PL, double dOffsetPar = 0) ; EGK_EXPORT bool Split( double dU, PolyLine& PL) ; + EGK_EXPORT bool GetLocalBBox( BBox3d& b3Loc) const ; EGK_EXPORT bool IsClosed( void) const ; EGK_EXPORT int GetRejectedNbr( void) const { return m_nRejected ; } diff --git a/EGkStmFromCurves.h b/EGkStmFromCurves.h index 3389b8a..911b8bf 100644 --- a/EGkStmFromCurves.h +++ b/EGkStmFromCurves.h @@ -25,11 +25,14 @@ #endif //---------------------------------------------------------------------------- -EGK_EXPORT ISurfTriMesh* GetSurfTriMeshByContour( const ICurve& Curve, double dLinTol) ; -EGK_EXPORT ISurfTriMesh* GetSurfTriMeshByExtrusion( const ICurve& Curve, const Vector3d& vtExtr, +EGK_EXPORT ISurfTriMesh* GetSurfTriMeshByFlatContour( const ICurve* pCurve, double dLinTol = 10 * EPS_SMALL) ; +EGK_EXPORT ISurfTriMesh* GetSurfTriMeshByRegion( const ICURVEPVECTOR& vpCurve, double dLinTol = 10 * EPS_SMALL) ; +EGK_EXPORT ISurfTriMesh* GetSurfTriMeshByExtrusion( const ICurve* pCurve, const Vector3d& vtExtr, bool bCapEnds, double dLinTol = 10 * EPS_SMALL) ; -EGK_EXPORT ISurfTriMesh* GetSurfTriMeshByRevolve( const ICurve& Curve, const Point3d& ptAx, +EGK_EXPORT ISurfTriMesh* GetSurfTriMeshByRegionExtrusion( const ICURVEPVECTOR& vpCurve, const Vector3d& vtExtr, + double dLinTol = 10 * EPS_SMALL) ; +EGK_EXPORT ISurfTriMesh* GetSurfTriMeshByRevolve( const ICurve* pCurve, const Point3d& ptAx, const Vector3d& vtAx, bool bCapEnds, double dLinTol = 10 * EPS_SMALL) ; -EGK_EXPORT ISurfTriMesh* GetSurfTriMeshByScrewing( const ICurve& Curve, const Point3d& ptAx, const Vector3d& vtAx, +EGK_EXPORT ISurfTriMesh* GetSurfTriMeshByScrewing( const ICurve* pCurve, const Point3d& ptAx, const Vector3d& vtAx, double dAngRotDeg, double dMove, double dLinTol = 10 * EPS_SMALL) ; -EGK_EXPORT ISurfTriMesh* GetSurfTriMeshRuled( const ICurve& Curve1, const ICurve& Curve2, double dLinTol = 10 * EPS_SMALL) ; +EGK_EXPORT ISurfTriMesh* GetSurfTriMeshRuled( const ICurve* pCurve1, const ICurve* pCurve2, double dLinTol = 10 * EPS_SMALL) ; diff --git a/EGkTriangle3d.h b/EGkTriangle3d.h index e524bb2..1cd4e6d 100644 --- a/EGkTriangle3d.h +++ b/EGkTriangle3d.h @@ -1,19 +1,20 @@ //---------------------------------------------------------------------------- -// EgalTech 2014-2014 +// EgalTech 2014-2015 //---------------------------------------------------------------------------- -// File : EGkTria3d.h Data : 30.03.14 Versione : 1.5c9 +// File : EGkTria3d.h Data : 07.02.15 Versione : 1.6b2 // Contenuto : Dichiarazione classe triangolo Triangle3d. // // // // Modifiche : 30.03.14 DS Creazione modulo. -// +// 07.02.15 DS Agg. GetArea e GetAspectRatio. // //---------------------------------------------------------------------------- #pragma once #include "/EgtDev/Include/EGkPoint3d.h" +#include //----------------------------------------------------------------------------- class Triangle3d @@ -21,7 +22,7 @@ class Triangle3d public : Triangle3d( void) {} - void Set( const Point3d& ptP0, const Point3d& ptP1, const Point3d& ptP2) + void Set( const Point3d& ptP0, const Point3d& ptP1, const Point3d& ptP2) { ptP[0] = ptP0 ; ptP[1] = ptP1 ; ptP[2] = ptP2 ; vtN.Set( 0, 0, 0) ; } void Set( const Point3d& ptP0, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV) { ptP[0] = ptP0 ; ptP[1] = ptP1 ; ptP[2] = ptP2 ; vtN = vtV ; } @@ -59,6 +60,18 @@ class Triangle3d } const Vector3d& GetN( void) const { return vtN ; } + double GetArea( void) const + { return (( ptP[1] - ptP[0]) ^ ( ptP[2] - ptP[0])).Len() / 2 ; } + double GetAspectRatio( void) const + { double dSqDistA = SqDist( ptP[0], ptP[1]) ; + double dSqDistB = SqDist( ptP[1], ptP[2]) ; + double dSqDistC = SqDist( ptP[2], ptP[0]) ; + double dTwoArea = (( ptP[1] - ptP[0]) ^ ( ptP[2] - ptP[0])).Len() ; + if ( dTwoArea < EPS_SMALL * EPS_SMALL) + return INFINITO ; + else + return ( std::max( dSqDistA, std::max( dSqDistB, dSqDistC)) / dTwoArea) ; + } private : Point3d ptP[3] ; diff --git a/EGkVector3d.h b/EGkVector3d.h index e882b6a..8de620e 100644 --- a/EGkVector3d.h +++ b/EGkVector3d.h @@ -304,7 +304,7 @@ AreOppositeVectorExact( const Vector3d& vtV1, const Vector3d& vtV2) } //---------------------------------------------------------------------------- -//! Verifica se due vettori sono quasi coincidenti o opposti (Zero error -> Exact) +//! Verifica se due vettori sono quasi coincidenti o opposti (Small error -> Approx) //---------------------------------------------------------------------------- inline bool AreSameOrOppositeVectorApprox( const Vector3d& vtV1, const Vector3d& vtV2) diff --git a/EGnStringConverter.h b/EGnStringConverter.h index 7a85cad..e261d64 100644 --- a/EGnStringConverter.h +++ b/EGnStringConverter.h @@ -16,7 +16,9 @@ //----------------------------------------------------------------------------- +#define NOMINMAX #include +#include #include //----------------------------------------------------------------------------- @@ -273,7 +275,7 @@ class wcharBuffer wchar_t* data( void) { return m_wBuffer.data() ; } void terminate( size_t nLen) - { nLen = min( nLen, m_wBuffer.size() - 1) ; + { nLen = std::min( nLen, m_wBuffer.size() - 1) ; m_wBuffer[nLen] = '\0' ; } private : diff --git a/EGrScene.h b/EGrScene.h index 0d09b34..10ef61f 100644 --- a/EGrScene.h +++ b/EGrScene.h @@ -18,8 +18,9 @@ #include "/EgtDev/Include/EGkBBox3d.h" #include "/EgtDev/Include/EGkColor.h" #include "/EgtDev/Include/EgtNumCollection.h" -#include +#define NOMINMAX #include +#include class IGeomDB ; class ILogger ; diff --git a/EInAPI.h b/EInAPI.h index a758e81..fb7c7a6 100644 --- a/EInAPI.h +++ b/EInAPI.h @@ -13,6 +13,7 @@ #pragma once +#define NOMINMAX #include //----------------------- Macro per import/export ---------------------------- @@ -31,7 +32,7 @@ extern "C" { // API // General -EIN_EXPORT BOOL __stdcall EgtInit( int nDebug, const wchar_t* sLogFile) ; +EIN_EXPORT BOOL __stdcall EgtInit( int nDebug, const wchar_t* sLogFile, const wchar_t* sLogMsg) ; EIN_EXPORT BOOL __stdcall EgtExit( void) ; EIN_EXPORT BOOL __stdcall EgtSetKey( const wchar_t* sKey) ; EIN_EXPORT BOOL __stdcall EgtSetFont( const wchar_t* sNfeFontDir, const wchar_t* sDefaultFont) ; @@ -142,15 +143,18 @@ EIN_EXPORT int __stdcall EgtCreatePolygonFromSide( int nParentId, int nNumSides const double ptFin[3], const double vtN[3], int nRefType) ; // GeomDB Create Surf -EIN_EXPORT int __stdcall EgtCreateSurfTriMeshByContour( int nParentId, int nCrvId, double dLinTol) ; -EIN_EXPORT int __stdcall EgtCreateSurfTriMeshByExtrusion( int nParentId, int nCrvId, const double vtExtr[3], - BOOL bCapEnds, double dLinTol, int nRefType) ; +EIN_EXPORT int __stdcall EgtCreateSurfTriMeshByFlatContour( int nParentId, int nCrvId, double dLinTol) ; +EIN_EXPORT int __stdcall EgtCreateSurfTriMeshByRegion( int nParentId, int nNumId, const int nCrvIds[], double dLinTol) ; +EIN_EXPORT int __stdcall EgtCreateSurfTriMeshByExtrusion( int nParentId, int nNumId, const int nCrvIds[], + const double vtExtr[3], double dLinTol, int nRefType) ; +EIN_EXPORT int __stdcall EgtCreateSurfTriMeshByRegionExtrusion( int nParentId, int nNumId, const int nCrvIds[], + const double vtExtr[3], double dLinTol, int nRefType) ; EIN_EXPORT int __stdcall EgtCreateSurfTriMeshByRevolve( int nParentId, int nCrvId, const double ptAx[3], const double vtAx[3], BOOL bCapEnds, double dLinTol, int nRefType) ; EIN_EXPORT int __stdcall EgtCreateSurfTriMeshByScrewing( int nParentId, int nCrvId, - const double ptAx[3], const double vtAx[3], - double dAngRotDeg, double dMove, double dLinTol, int nRefType) ; + const double ptAx[3], const double vtAx[3], + double dAngRotDeg, double dMove, double dLinTol, int nRefType) ; EIN_EXPORT int __stdcall EgtCreateSurfTriMeshRuled( int nParentId, int nCrvId1, int nCrvId2, double dLinTol) ; // GeomDB PartLayer @@ -267,6 +271,7 @@ EIN_EXPORT BOOL __stdcall EgtTrimCurveStartEndAtParam( int nId, double dParS, do EIN_EXPORT BOOL __stdcall EgtExtendCurveStartByLen( int nId, double dLen) ; EIN_EXPORT BOOL __stdcall EgtExtendCurveEndByLen( int nId, double dLen) ; EIN_EXPORT BOOL __stdcall EgtTrimExtendCurveByLen( int nId, double dLen, const double ptNear[3], int nRefType) ; +EIN_EXPORT BOOL __stdcall EgtSplitCurve( int nId, int nParts) ; EIN_EXPORT BOOL __stdcall EgtSplitCurveAtPoint( int nId, double ptOn[3], int nRefType) ; EIN_EXPORT BOOL __stdcall EgtOffsetCurve( int nId, double dDist, int nType) ; EIN_EXPORT BOOL __stdcall EgtModifyCurveCircleCPN( int nId, const double ptOn[3], int nRefType) ; diff --git a/EgkSurfTriMesh.h b/EgkSurfTriMesh.h index b40144f..d380d0e 100644 --- a/EgkSurfTriMesh.h +++ b/EgkSurfTriMesh.h @@ -15,8 +15,7 @@ #include "/EgtDev/Include/EGkSurf.h" #include "/EgtDev/Include/EGkTriangle3d.h" - -class PolyLine ; +#include "/EgtDev/Include/EGkPolyLine.h" //---------------------------------------------------------------------------- const int SVT_NULL = - 1 ; // vertice o triangolo nullo @@ -34,6 +33,7 @@ class __declspec( novtable) ISurfTriMesh : public ISurf virtual int AddTriangle( const int nIdVert[3]) = 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 CreateByTwoCurves( const PolyLine& PL1, const PolyLine& PL2) = 0 ; virtual bool CreateByRevolution( const PolyLine& PL, const Point3d& ptAx, const Vector3d& vtAx, diff --git a/EgnGetModuleVer.h b/EgnGetModuleVer.h index e36d144..8dc6f71 100644 --- a/EgnGetModuleVer.h +++ b/EgnGetModuleVer.h @@ -13,6 +13,7 @@ #pragma once +#define NOMINMAX #include #include diff --git a/EgtLogger.h b/EgtLogger.h index cdc8cec..24a52a7 100644 --- a/EgtLogger.h +++ b/EgtLogger.h @@ -16,6 +16,7 @@ #include "/EgtDev/Include/EgtILogger.h" #include #include +#define NOMINMAX #include #include diff --git a/EgtNumCollection.h b/EgtNumCollection.h index 8436925..89e41b3 100644 --- a/EgtNumCollection.h +++ b/EgtNumCollection.h @@ -16,6 +16,11 @@ #include #include +//---------------------------------------------------------------------------- +// Raccolte di booleani +typedef std::vector BOOLVECTOR ; // vettore di bool +typedef std::list BOOLLIST ; // lista di bool + //---------------------------------------------------------------------------- // Raccolte di interi typedef std::vector INTVECTOR ; // vettore di interi diff --git a/EgtPerfCounter.h b/EgtPerfCounter.h index 8b0085b..e0b159e 100644 --- a/EgtPerfCounter.h +++ b/EgtPerfCounter.h @@ -13,6 +13,7 @@ #pragma once +#define NOMINMAX #include //---------------------------------------------------------------------------- diff --git a/EgtTrace.h b/EgtTrace.h index 0794cad..2bdb821 100644 --- a/EgtTrace.h +++ b/EgtTrace.h @@ -13,7 +13,7 @@ #pragma once - +#define NOMINMAX #include #if defined( _DEBUG)