Include :
- aggiornamento prototipi - aggiunti HashGrids2d e 3d.
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2018
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EGkHashGrids2d.h Data : 07.12.18 Versione : 1.9l1
|
||||
// Contenuto : Dichiarazione della classe HashGrids2d.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 04.07.15 DS Creazione modulo.
|
||||
// 09.12.18 DS Spostato in Include.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "EgtDev/Include/EGkBBox3d.h"
|
||||
#include "EgtDev/Include/EgtNumCollection.h"
|
||||
#include <unordered_map>
|
||||
|
||||
//----------------------- 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
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class HashGrids2d
|
||||
{
|
||||
public :
|
||||
EGK_EXPORT HashGrids2d( void) ;
|
||||
EGK_EXPORT ~HashGrids2d( void) ;
|
||||
EGK_EXPORT void SetActivationGrid( bool bActivate) ;
|
||||
EGK_EXPORT bool Add( int nObjId, const BBox3d& box) ;
|
||||
EGK_EXPORT bool Modify( int nObjId, const BBox3d& box) ;
|
||||
EGK_EXPORT bool Remove( int nObjId) ;
|
||||
EGK_EXPORT bool Update( void) ;
|
||||
EGK_EXPORT bool Find( const BBox3d& b3Test, INTVECTOR& vnIds) const ;
|
||||
EGK_EXPORT void Clear( void) ;
|
||||
|
||||
friend class HashGrid2d ;
|
||||
|
||||
private :
|
||||
struct ObjData {
|
||||
int nId ;
|
||||
BBox3d box ;
|
||||
HashGrid2d* pHGrid ;
|
||||
size_t nHash ;
|
||||
size_t nCellId ;
|
||||
ObjData( void)
|
||||
: nId( -1), box(), pHGrid( nullptr), nHash( 0), nCellId( 0) {}
|
||||
ObjData( int nI, const BBox3d& bb, HashGrid2d* pHG, size_t nH, size_t nCI)
|
||||
: nId( nI), box( bb), pHGrid( pHG), nHash( nH), nCellId( nCI) {}
|
||||
} ;
|
||||
typedef std::list<ObjData> ObjList ;
|
||||
typedef std::vector<ObjData*> PtrObjVector ;
|
||||
typedef std::unordered_map<int,ObjData*> IntPObjUmap ;
|
||||
|
||||
private :
|
||||
typedef std::list<HashGrid2d*> GridList ; // Tipo per lista di hash grid
|
||||
|
||||
private :
|
||||
void addGrid( ObjData& obj) ;
|
||||
void addList( ObjData& obj) ;
|
||||
|
||||
private :
|
||||
ObjList m_ObjsList ; // Lista degli oggetti
|
||||
IntPObjUmap m_ObjsMap ; // Map da Id a PtrObj
|
||||
PtrObjVector m_objsToAdd ; // Vettore di puntatori agli oggetti da inserire
|
||||
PtrObjVector m_nonGridObjs ; // Vettore di puntatori agli oggetti non assegnati alle griglie (per dimensioni o perchè pochi)
|
||||
GridList m_GridList ; // Lista delle griglie di dimensione fissa ( in ordine crescente di dimensione di cella)
|
||||
bool m_bActivate ; // Flag che abilita l'attivazione delle griglie
|
||||
bool m_bGridActive ; // Flag di attivazione delle griglie
|
||||
BBox3d m_b3Objs ; // Box totale di tutti gli oggetti inseriti
|
||||
} ;
|
||||
@@ -0,0 +1,76 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2018
|
||||
//----------------------------------------------------------------------------
|
||||
// File : HashGrids3d.h Data : 07.12.18 Versione : 1.9l1
|
||||
// Contenuto : Dichiarazione della classe HashGrids3d.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 02.07.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "EgtDev/Include/EGkBBox3d.h"
|
||||
#include "EgtDev/Include/EgtNumCollection.h"
|
||||
#include <unordered_map>
|
||||
|
||||
//----------------------- 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
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class HashGrids3d
|
||||
{
|
||||
public :
|
||||
EGK_EXPORT HashGrids3d( void) ;
|
||||
EGK_EXPORT ~HashGrids3d( void) ;
|
||||
EGK_EXPORT void SetActivationGrid( bool bActivate) ;
|
||||
EGK_EXPORT bool Add( int nObjId, const BBox3d& box) ;
|
||||
EGK_EXPORT bool Modify( int nObjId, const BBox3d& box) ;
|
||||
EGK_EXPORT bool Remove( int nObjId) ;
|
||||
EGK_EXPORT bool Update( void) ;
|
||||
EGK_EXPORT bool Find( const BBox3d& b3Test, INTVECTOR& vnIds) const ;
|
||||
EGK_EXPORT void Clear( void) ;
|
||||
|
||||
friend class HashGrid3d ;
|
||||
|
||||
private :
|
||||
struct ObjData {
|
||||
int nId ;
|
||||
BBox3d box ;
|
||||
HashGrid3d* pHGrid ;
|
||||
size_t nHash ;
|
||||
size_t nCellId ;
|
||||
ObjData( void)
|
||||
: nId( -1), box(), pHGrid( nullptr), nHash( 0), nCellId( 0) {}
|
||||
ObjData( int nI, const BBox3d& bb, HashGrid3d* pHG, size_t nH, size_t nCI)
|
||||
: nId( nI), box( bb), pHGrid( pHG), nHash( nH), nCellId( nCI) {}
|
||||
} ;
|
||||
typedef std::list<ObjData> ObjList ;
|
||||
typedef std::vector<ObjData*> PtrObjVector ;
|
||||
typedef std::unordered_map<int,ObjData*> IntPObjUmap ;
|
||||
|
||||
private :
|
||||
typedef std::list<HashGrid3d*> GridList ; // Tipo per lista di hash grid
|
||||
|
||||
private :
|
||||
void addGrid( ObjData& obj) ;
|
||||
void addList( ObjData& obj) ;
|
||||
|
||||
private :
|
||||
ObjList m_ObjsList ; // Lista degli oggetti
|
||||
IntPObjUmap m_ObjsMap ; // Map da Id a PtrObj
|
||||
PtrObjVector m_objsToAdd ; // Vettore di puntatori agli oggetti da inserire
|
||||
PtrObjVector m_nonGridObjs ; // Vettore di puntatori agli oggetti non assegnati alle griglie (per dimensioni o perchè pochi)
|
||||
GridList m_GridList ; // Lista delle griglie di dimensione fissa ( in ordine crescente di dimensione di cella)
|
||||
bool m_bActivate ; // Flag che abilita l'attivazione delle griglie
|
||||
bool m_bGridActive ; // Flag di attivazione delle griglie
|
||||
BBox3d m_b3Objs ; // Box totale di tutti gli oggetti inseriti
|
||||
} ;
|
||||
+16
-1
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkIntersLineTria.h"
|
||||
#include "/EgtDev/Include/EGkHashGrids2d.h"
|
||||
|
||||
//----------------------- Macro per import/export ----------------------------
|
||||
#undef EGK_EXPORT
|
||||
@@ -43,7 +44,21 @@ struct IntLinStmInfo {
|
||||
} ;
|
||||
//! vettore di IntLinStmInfo
|
||||
typedef std::vector<IntLinStmInfo> ILSIVECTOR ;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
EGK_EXPORT bool IntersLineSurfTm( const Point3d& ptL, const Vector3d& vtL, double dLen, const ISurfTriMesh& Stm,
|
||||
ILSIVECTOR& vInfo, bool bFinite = true) ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
class IntersParLinesSurfTm
|
||||
{
|
||||
public :
|
||||
EGK_EXPORT IntersParLinesSurfTm( const Frame3d& frLines, const ISurfTriMesh& Stm) ;
|
||||
EGK_EXPORT bool GetInters( const Point3d& ptL, double dLen, ILSIVECTOR& vInfo, bool bFinite = true) ;
|
||||
|
||||
private :
|
||||
bool m_bOk ;
|
||||
const Frame3d m_frLines ;
|
||||
const ISurfTriMesh* m_pSTm ;
|
||||
HashGrids2d m_HGrids ;
|
||||
} ;
|
||||
|
||||
+10
-10
@@ -35,18 +35,18 @@ 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) ;
|
||||
EGK_EXPORT bool FindNearest( const Point3d& ptTest, double dTol, int& nId) ;
|
||||
EGK_EXPORT bool First( int& nId) ;
|
||||
EGK_EXPORT bool Find( const BBox3d& b3Test, INTVECTOR& vnIds) const ;
|
||||
EGK_EXPORT bool Find( const Point3d& ptTest, double dTol, INTVECTOR& vnIds) const ;
|
||||
EGK_EXPORT bool Find( const Point3d& ptTest, double dTol, int& nId) const ;
|
||||
EGK_EXPORT bool FindNearest( const Point3d& ptTest, INTVECTOR& vnIds) const ;
|
||||
EGK_EXPORT bool FindNearest( const Point3d& ptTest, double dTol, int& nId) const ;
|
||||
EGK_EXPORT bool First( int& nId) const ;
|
||||
|
||||
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) ;
|
||||
inline int Get1dCellNbr( double dCoord) const ;
|
||||
inline bool Get3dRangeNbr( const BBox3d& b3Test, IBox& iBox) const ;
|
||||
inline bool Get3dRangeNbr( const Point3d& ptTest, double dTol, IBox& iBox) const ;
|
||||
inline int PointHash( int nX, int nY, int nZ) const ;
|
||||
|
||||
private :
|
||||
typedef std::unordered_multimap<int,std::pair<Point3d,int>> IPNTI_UMMAP ;
|
||||
|
||||
@@ -84,6 +84,8 @@ class __declspec( novtable) ISurfTriMesh : public ISurf
|
||||
virtual bool GetFacetsContact( int nF1, int nF2, bool& bAdjac, Point3d& ptP1, Point3d& ptP2, double& dAng) const = 0 ;
|
||||
virtual ISurfTriMesh* CloneFacet( int nF) const = 0 ;
|
||||
virtual bool Cut( const Plane3d& plPlane, bool bSaveOnEq) = 0 ;
|
||||
virtual bool GetAllTriaOverlapBox( const BBox3d& b3Box, INTVECTOR& vT) const = 0 ;
|
||||
virtual const BBox3d& GetAllTriaBox( void) const = 0 ;
|
||||
} ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user