From 349c515e3e8515cf1b7a38974ad0fa2ad036660d Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 11 Sep 2023 10:38:44 +0200 Subject: [PATCH] EgtGeomKernel 2.5i1 : - corretta SetSawTool di Tool per caso con raggio corner uguale a raggio - aggiunta prima versione di proiezione curva su superficie trimesh. --- EgtGeomKernel.rc | Bin 11710 -> 11710 bytes EgtGeomKernel.vcxproj | 1 + EgtGeomKernel.vcxproj.filters | 6 ++++ GeoVector3d.cpp | 2 +- IntersLineSurfTm.cpp | 6 ++-- ProjectCurveSurfTm.cpp | 66 ++++++++++++++++++++++++++++++++++ Tool.cpp | 17 ++++----- 7 files changed, 86 insertions(+), 12 deletions(-) create mode 100644 ProjectCurveSurfTm.cpp diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index 919251ac8ca1faebee79b4a026fe88b2a68b17f9..fa4a6cfbee99c70d7b37b030dde0966d0bedb146 100644 GIT binary patch delta 110 zcmdlNy)SyhH#SDg&FAHmnVB;g3@0mc>u&bq>R|zkU1plRN-zgW+>LQ_kFXmvPRR~w Ps3eMM9*mo_ltZ`xv~nRZ delta 110 zcmdlNy)SyhH#SC#&FAHmnVB;f3@0mc>u&bq>R|zkU1plRN-zgW+>LQ_kFXmvPRR~w Ps3eMM9*mo_ltZ`xvWy`p diff --git a/EgtGeomKernel.vcxproj b/EgtGeomKernel.vcxproj index 6feb619..89db29d 100644 --- a/EgtGeomKernel.vcxproj +++ b/EgtGeomKernel.vcxproj @@ -397,6 +397,7 @@ copy $(TargetPath) \EgtProg\Dll64 + diff --git a/EgtGeomKernel.vcxproj.filters b/EgtGeomKernel.vcxproj.filters index d9b5749..6f8b271 100644 --- a/EgtGeomKernel.vcxproj.filters +++ b/EgtGeomKernel.vcxproj.filters @@ -46,6 +46,9 @@ {865b76ee-b10d-41fc-861c-b48ce52fa277} + + {d96752da-1884-4a73-ba1b-5b20b606e469} + @@ -480,6 +483,9 @@ File di origine\GeoInters + + File di origine\GeoProject + diff --git a/GeoVector3d.cpp b/GeoVector3d.cpp index b93875a..2a9d94d 100644 --- a/GeoVector3d.cpp +++ b/GeoVector3d.cpp @@ -29,7 +29,7 @@ GEOOBJ_REGISTER( GEO_VECT3D, NGE_G_VEC, GeoVector3d) ; //---------------------------------------------------------------------------- GeoVector3d::GeoVector3d( void) - : m_vtV() + : m_vtV(), m_ptBase() { m_nTempProp[0] = 0 ; m_nTempProp[1] = 0 ; diff --git a/IntersLineSurfTm.cpp b/IntersLineSurfTm.cpp index 1031d5a..959071a 100644 --- a/IntersLineSurfTm.cpp +++ b/IntersLineSurfTm.cpp @@ -156,13 +156,13 @@ IntersParLinesSurfTm::IntersParLinesSurfTm( const Frame3d& frLines, const ISurfT bool IntersParLinesSurfTm::GetInters( const Point3d& ptL, double dLen, ILSIVECTOR& vInfo, bool bFinite) const { - // verifico validità - if ( ! m_bOk) - return false ; // verifico parametro di ritorno if ( &vInfo == nullptr) return false ; vInfo.clear() ; + // verifico validità + if ( ! m_bOk) + return false ; // calcolo box linea (nel riferimento) BBox3d b3Line ; diff --git a/ProjectCurveSurfTm.cpp b/ProjectCurveSurfTm.cpp new file mode 100644 index 0000000..8eed4df --- /dev/null +++ b/ProjectCurveSurfTm.cpp @@ -0,0 +1,66 @@ +//---------------------------------------------------------------------------- +// EgalTech 2023-2023 +//---------------------------------------------------------------------------- +// File : ProjectCurveSurfTm.cpp Data : 31.08.23 Versione : 2.5h3 +// Contenuto : Implementazione funzioni proiezione curve su superficie Trimesh. +// +// +// +// Modifiche : 31.08.23 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +//--------------------------- Include ---------------------------------------- +#include "stdafx.h" +#include "GeoConst.h" +#include "/EgtDev/Include/EGkIntersLineSurfTm.h" +#include "/EgtDev/Include/EGkProjectCurveSurfTm.h" + +//---------------------------------------------------------------------------- +bool +ProjectCurveOnSurfTm( const ICurve& crCrv, const ISurfTriMesh& tmSurf, const Vector3d& vtDir, double dLinTol, + PNT5AXVECTOR& vPt5ax) +{ + // approssimo la curva con una polilinea entro la metà della tolleranza + PolyLine PL ; + if ( ! crCrv.ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, ICurve::APL_STD, PL)) + return false ; + const double MAX_SEG_LEN = 10 ; + if ( ! PL.AdjustForMaxSegmentLen( MAX_SEG_LEN)) + return false ; + + // Oggetto per calcolo massivo intersezioni tra linee di proiezione e superficie + Frame3d frRefLine ; + if ( ! frRefLine.Set( ORIG, vtDir)) + return false ; + IntersParLinesSurfTm intPLSTM( frRefLine, tmSurf) ; + + // Riservo spazio nel vettore risultato + vPt5ax.reserve( PL.GetPointNbr()) ; + + // proietto i punti della polilinea sulla superficie + double dU ; + Point3d ptP ; + bool bFound = PL.GetFirstUPoint( &dU, &ptP) ; + while ( bFound) { + Point3d ptL = GetToLoc( ptP, frRefLine) ; + ILSIVECTOR vIntRes ; + intPLSTM.GetInters( ptL, 1, vIntRes, false) ; + if ( vIntRes.size() > 0) { + int nI = int( vIntRes.size()) - 1 ; + Point3d ptInt ; + if ( vIntRes[nI].nILTT == ILTT_SEGM || vIntRes[nI].nILTT == ILTT_SEGM_ON_EDGE) + ptInt = vIntRes[nI].ptI2 ; + else + ptInt = vIntRes[nI].ptI ; + Triangle3d trTria ; + if ( ! tmSurf.GetTriangle( vIntRes[nI].nT, trTria)) + return false ; + vPt5ax.emplace_back( ptInt, trTria.GetN(), dU, 1) ; + } + bFound = PL.GetNextUPoint( &dU, &ptP) ; + } + + return true ; +} diff --git a/Tool.cpp b/Tool.cpp index eac5034..46b5756 100644 --- a/Tool.cpp +++ b/Tool.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2022 +// EgalTech 2015-2023 //---------------------------------------------------------------------------- -// File : Tool.cpp Data : 04.07.18 Versione : 2.4f3 +// File : Tool.cpp Data : 08.09.23 Versione : 2.5i1 // Contenuto : Implementazione della classe Tool // // @@ -87,6 +87,8 @@ Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR, if ( dH < EPS_SMALL || dR < EPS_SMALL || dCornR < - EPS_SMALL) return false ; + bool bApproxWithLines = false ; + // utensile cilindrico if ( dCornR < EPS_SMALL) { m_nType = CYLMILL ; @@ -126,9 +128,8 @@ Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR, m_Outline.AddLine( pt2); m_Outline.AddArcTg( pt3) ; m_Outline.AddLine( pt4) ; - // se da approosimare - if ( m_bApproxWithLines) - return SetGenTool( sToolName, &m_Outline, nToolNum) ; + // se da approssimare + bApproxWithLines = m_bApproxWithLines ; } // utensile sferico else { @@ -151,7 +152,7 @@ Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR, } // eventuali sistemazioni per altezza tagliente - if ( ModifyForCutterHeight()) + if ( ModifyForCutterHeight() || bApproxWithLines) return SetGenTool( sToolName, &m_Outline, nToolNum) ; else return true ; @@ -381,7 +382,7 @@ Tool::SetSawTool( const string& sToolName, double dH, double dR, } // altrimenti con raggio corner else { - double dCR = Clamp( dCornR, 0., dThick / 2) ; + double dCR = Clamp( dCornR, 0., min( dThick / 2, dR - 10 * EPS_SMALL)) ; // creazione profilo m_Outline.AddPoint( pt0) ; m_Outline.AddLine( pt1) ; @@ -410,7 +411,7 @@ Tool::SetSawTool( const string& sToolName, double dH, double dR, } // altrimenti con raggio corner else { - double dCR = Clamp( dCornR, 0., dThick / 2) ; + double dCR = Clamp( dCornR, 0., min( dThick / 2, dR - 10 * EPS_SMALL)) ; // creazione profilo m_Outline.AddPoint( pt0) ; m_Outline.AddLine( pt3 - X_AX * dCR) ;