From 3ff5af88723c8a79a3755a735fc75e272e1c72ef Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 21 May 2018 07:24:19 +0000 Subject: [PATCH] EgtGeomKernel : - piccole modifiche a Collision Avoding. --- CAvToolSurfTm.cpp | 4 ++-- CAvToolSurfTm.h | 4 ++++ SurfTriMeshFaceting.cpp | 3 +-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CAvToolSurfTm.cpp b/CAvToolSurfTm.cpp index da9b55a..9c4752e 100644 --- a/CAvToolSurfTm.cpp +++ b/CAvToolSurfTm.cpp @@ -127,7 +127,7 @@ CAvToolSurfTm::MyTestMidPointHG( PNTULIST& lPntM, const PNTULIST::iterator& itPn return false ; // se oltre tolleranza dalla linea tra i punti includenti, devo aggiungerlo double dSqDist ; - if ( DistPointLine( ptNewMid, itPntMPrev->first, itPntMCurr->first).GetSqDist( dSqDist) && dSqDist > dLinTol * dLinTol) { + if ( DistPointLine( ptNewMid, itPntMPrev->first, itPntMCurr->first).GetSqDist( dSqDist) && dSqDist > 0.25 * dLinTol * dLinTol) { // aggiungo lPntM.emplace( itPntMCurr, ptNewMid, - dMidMove) ; auto itPntMMid = itPntMCurr ; @@ -225,7 +225,7 @@ CAvToolSurfTm::PrepareHashGrid( void) if ( m_pSTm == nullptr || ! m_pSTm->IsValid()) return false ; // creo HashGrid 2d - const int LIM_HG_TRIA = 128 ; + const int LIM_HG_TRIA = 256 ; m_HGrids.SetActivationGrid( m_pSTm->GetTriangleCount() > LIM_HG_TRIA) ; // riempio HashGrid Triangle3d Tria ; diff --git a/CAvToolSurfTm.h b/CAvToolSurfTm.h index b4d04cc..04243bd 100644 --- a/CAvToolSurfTm.h +++ b/CAvToolSurfTm.h @@ -27,6 +27,10 @@ class CAvToolSurfTm : public ICAvToolSurfTm bool SetMoveDir( const Vector3d& vtrMove) override ; bool SetStdTool( double dH, double dR, double dCornR) override ; bool SetAdvTool( double dH, double dR, double dTipH, double dTipR, double dCornR) override ; + double GetToolRadius( void) override + { return m_Tool.GetRadius() ; } + double GetToolHeight( void) override + { return m_Tool.GetHeigth() ; } bool TestPosition( const Point3d& ptT, const Vector3d& vtDir, double& dTotDist) override ; bool TestPath( PNTULIST& lPntM, const Vector3d& vtDir, double dLinTol) override ; diff --git a/SurfTriMeshFaceting.cpp b/SurfTriMeshFaceting.cpp index 36f7e8b..81810a4 100644 --- a/SurfTriMeshFaceting.cpp +++ b/SurfTriMeshFaceting.cpp @@ -654,8 +654,7 @@ SurfTriMesh::CloneFacet( int nF) const return nullptr ; // tabella hash per indici vertici (vecchi e nuovi indici) typedef unordered_map VVMAP ; - VVMAP PntMap ; - PntMap.rehash( nTria + 2) ; + VVMAP PntMap( nTria + 2) ; // inserisco i triangoli nella nuova superficie for ( int i = 0 ; i < nTria ; ++ i) { // indice del triangolo