From 1c49379ee1c1a2b5db73d40c1c591584c374fb3d Mon Sep 17 00:00:00 2001 From: Daniele Bariletti Date: Tue, 9 Jun 2026 12:28:39 +0200 Subject: [PATCH] =?UTF-8?q?EgtGeomKernel=203.1f2=20:=20-=20aggiunta=20moda?= =?UTF-8?q?lit=C3=A0=20per=20IntersLineCyl=20-=20spostate=20funzioni=20rel?= =?UTF-8?q?ative=20-=20cambiuo=20versione.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EgtGeomKernel.rc | Bin 11710 -> 11710 bytes IntersLineCyl.cpp | 223 +++++++++++++++++++++++++++++++++----------- IntersLineCyl.h | 27 +++++- VolZmap.h | 3 - VolZmapCalculus.cpp | 121 ------------------------ VolZmapOffset.cpp | 6 +- VolZmapVolume.cpp | 36 ++++--- 7 files changed, 217 insertions(+), 199 deletions(-) diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index efbb721ba3be7f046a8bcc5143cef5966af23e89..2e1f88f10a8310c00edef3c805e6eb0f07b7c675 100644 GIT binary patch delta 81 zcmdlNy)SyhH#SD2&FAG5nSs EPS_ZERO) { + if ( abs( vtV.z) > EPS_ZERO) { // le linee tangenti al cilindro non sono considerate intersecanti - double EpsRad = ( vtL.IsZeroXY() ? - EPS_SMALL : EPS_SMALL) ; - Point3d ptInt1 = ptL + ( ( 0 - ptL.z) / vtL.z) * vtL ; - if ( ptInt1.x * ptInt1.x + ptInt1.y * ptInt1.y < dRad * dRad + 2 * dRad * EpsRad) { - dU1 = ( ptInt1 - ptL) * vtL ; + ptInt1 = ptP + ( ( 0 - ptP.z) / vtV.z) * vtV ; + if ( ptInt1.x * ptInt1.x + ptInt1.y * ptInt1.y < dRad * dRad) { nBasInt += 1 ; + vtN1 = - Z_AX ; + dU1 = ( ( 0 - ptP.z) / vtV.z) ; } - Point3d ptInt2 = ptL + ( ( dHeight - ptL.z) / vtL.z) * vtL ; - if ( ptInt2.x * ptInt2.x + ptInt2.y * ptInt2.y < dRad * dRad + 2 * dRad * EpsRad) { - dU2 = ( ptInt2 - ptL) * vtL ; + ptInt2 = ptP + ( ( dH - ptP.z) / vtV.z) * vtV ; + if ( ptInt2.x * ptInt2.x + ptInt2.y * ptInt2.y < dRad * dRad) { nBasInt += 2 ; + vtN2 = Z_AX ; + dU2 = ( ( dH - ptP.z) / vtV.z) ; } } - // Se la linea interseca entrambe le basi, si sono trovate le due intersezioni + // Se la linea interseca entrambe le basi, si sono trovate le due intersezioni if ( nBasInt == 3) { - if ( dU1 > dU2) + if ( isfinite( dU1) && isfinite(dU2) && dU1 > dU2) { swap( dU1, dU2) ; - // Trovate intersezioni + swap( ptInt1, ptInt2) ; + swap( vtN1, vtN2) ; + if ( bInvertNormals) { + vtN1 *= - 1 ; + vtN2 *= - 1 ; + } + } + // Trovate intersezioni return true ; } - - // Determino le intersezioni con la superficie laterale del cilindro - DBLVECTOR vdCoeff{ ptL.x * ptL.x + ptL.y * ptL.y - dRad * dRad, - 2 * ( ptL.x * vtL.x + ptL.y * vtL.y), - vtL.x * vtL.x + vtL.y * vtL.y} ; + + // Determino le intersezioni con la superficie laterale del cilindro + DBLVECTOR vdCoeff{ ptP.x * ptP.x + ptP.y * ptP.y - dRad * dRad, + 2 * ( ptP.x * vtV.x + ptP.y * vtV.y), + vtV.x * vtV.x + vtV.y * vtV.y} ; DBLVECTOR vdRoots ; int nRoot = PolynomialRoots( 2, vdCoeff, vdRoots) ; - // Elimino le soluzioni cha danno intersezioni fuori dai limiti in Z del cilindro + // Epsilon per piani di tappo + double dEpsLow = ( bTapLow ? - EPS_SMALL : EPS_SMALL) ; + double dEpsUp = ( bTapUp ? EPS_SMALL : - EPS_SMALL) ; + if ( bIgnoreTap) { + dEpsLow = 0. ; + dEpsUp = 0. ; + } + + // Elimino le soluzioni cha danno intersezioni fuori dai limiti in Z del cilindro if ( nRoot == 2) { - double dIntZ2 = ptL.z + vdRoots[1] * vtL.z ; - if ( dIntZ2 < 0 - EPS_SMALL || dIntZ2 > dHeight + EPS_SMALL) + double dIntZ2 = ptP.z + vdRoots[1] * vtV.z ; + if ( dIntZ2 < 0 + dEpsLow || dIntZ2 > dH + dEpsUp) -- nRoot ; } if ( nRoot >= 1) { - double dIntZ1 = ptL.z + vdRoots[0] * vtL.z ; - if ( dIntZ1 < 0 - EPS_SMALL || dIntZ1 > dHeight + EPS_SMALL) { + double dIntZ1 = ptP.z + vdRoots[0] * vtV.z ; + if ( dIntZ1 < 0 + dEpsLow || dIntZ1 > dH + dEpsUp) { if ( nRoot == 2) vdRoots[0] = vdRoots[1] ; -- nRoot ; } } - // Due soluzioni: la retta interseca due volte la superficie laterale + // Due soluzioni: la retta interseca due volte la superficie laterale if ( nRoot == 2) { + // Punti di intersezione con la superficie del cilindro + ptInt1 = ptP + vdRoots[0] * vtV ; + ptInt2 = ptP + vdRoots[1] * vtV ; dU1 = vdRoots[0] ; dU2 = vdRoots[1] ; - if ( dU1 > dU2) + // Determino le normali + vtN1.Set( ptInt1.x, ptInt1.y, 0) ; + vtN1.Normalize() ; + vtN2.Set( ptInt2.x, ptInt2.y, 0) ; + vtN2.Normalize() ; + if ( dU1 > dU2) { swap( dU1, dU2) ; - // Trovate intersezioni - return true ; - } - - // Una soluzione : la retta interseca la superficie laterale e un piano - else if ( nRoot == 1) { - // Se piano superiore - if ( nBasInt == 2) { - dU1 = vdRoots[0] ; + swap( ptInt1, ptInt2) ; + swap( vtN1, vtN2) ; + if ( bInvertNormals) { + vtN1 *= - 1 ; + vtN2 *= - 1 ; + } } - // altrimenti piano inferiore - else if ( nBasInt == 1) { - dU2 = vdRoots[0] ; - } - // altrimenti niente - else - return false ; - if ( dU1 > dU2) - swap( dU1, dU2) ; - // Trovate intersezioni + // Trovate intersezioni return true ; } - // Nessuna soluzione : nessuna intersezione + // Una soluzione : la retta interseca la superficie laterale e un piano + else if ( nRoot == 1) { + // Se piano superiore + if ( nBasInt == 2) { + // Punto di intersezione + dU1 = vdRoots[0] ; + ptInt1 = ptP + vdRoots[0] * vtV ; + // Normale alla superficie del cilindro verso l'interno + vtN1.Set( ptInt1.x, ptInt1.y, 0) ; + vtN1.Normalize() ; + } + // altrimenti piano inferiore + else if ( nBasInt == 1) { + // Punto di intersezione + dU2 = vdRoots[0] ; + ptInt2 = ptP + vdRoots[0] * vtV ; + // Normale alla superficie del cilindro verso l'interno + vtN2.Set( ptInt2.x, ptInt2.y, 0) ; + vtN2.Normalize() ; + } + // altrimenti niente + else + return false ; + if ( dU1 > dU2) { + swap( dU1, dU2) ; + swap( ptInt1, ptInt2) ; + swap( vtN1, vtN2) ; + if ( bInvertNormals) { + vtN1 *= - 1 ; + vtN2 *= - 1 ; + } + } + // Trovate intersezioni + return true ; + } + + // Nessuna soluzione : nessuna intersezione else return false ; } +//---------------------------------------------------------------------------- +// Riferimento con origine nel centro della base e asse di simmetria coincidente con l'asse Z. +// La funzione restituisce true in caso di intersezione, false altrimenti. +//---------------------------------------------------------------------------- +bool +IntersLineCyl( const Point3d& ptLineSt, const Vector3d& vtLineDir, + const Frame3d& CylFrame, double dH, double dRad, bool bTapLow, bool bTapUp, + double& dU1, Point3d& ptInt1, Vector3d& vtN1, double& dU2, Point3d& ptInt2, Vector3d& vtN2, bool bIgnoreTap, bool bInvertNormals) +{ + // Porto la linea nel riferimento del cilindro + Point3d ptP = GetToLoc( ptLineSt, CylFrame) ; + Vector3d vtV = GetToLoc( vtLineDir, CylFrame) ; + if ( IntersLineCyl( ptP, vtV, dH, dRad, bTapLow, bTapUp, + dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, bIgnoreTap, bInvertNormals)) + { + ptInt1.ToGlob( CylFrame) ; + vtN1.ToGlob( CylFrame) ; + ptInt2.ToGlob( CylFrame) ; + vtN2.ToGlob( CylFrame) ; + return true ; + } + return false ; +} + //---------------------------------------------------------------------------- // Linea e cilindro sono nel medesimo riferimento. // Il cilindro è definito con centro della base, asse, raggio e altezza. @@ -133,7 +208,13 @@ IntersLineCyl( const Point3d& ptL, const Vector3d& vtL, if ( ! frCyl.Set( ptCyl, vtCyl)) return false ; // Ora eseguo i conti nel riferimento intrinseco - return IntersLineCyl( GetToLoc( ptL, frCyl), GetToLoc( vtL, frCyl), dRad, dHeight, dU1, dU2) ; + bool bTapLow = false ; + bool bTapUp = false ; + bool bIgnoreTap = true ; + Point3d ptInt1, ptInt2 ; + Vector3d vtN1, vtN2 ; + return IntersLineCyl( ptL, vtL, frCyl, dHeight, dRad, bTapLow, bTapUp, + dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, bIgnoreTap) ; } //---------------------------------------------------------------------------- @@ -144,7 +225,7 @@ IntersLineCyl( const Point3d& ptL, const Vector3d& vtL, bool IntersLineCyl( const Point3d& ptL, const Vector3d& vtL, const Point3d& ptCyl1, const Point3d& ptCyl2, double dRad, - double& dU1, double& dU2) + double& dU1, double& dU2) { // Determino asse ed altezza del cilindro Vector3d vtCyl = ptCyl2 - ptCyl1 ; @@ -157,5 +238,39 @@ IntersLineCyl( const Point3d& ptL, const Vector3d& vtL, if ( ! frCyl.Set( ptCyl1, vtCyl)) return false ; // Ora eseguo i conti nel riferimento intrinseco - return IntersLineCyl( GetToLoc( ptL, frCyl), GetToLoc( vtL, frCyl), dRad, dHeight, dU1, dU2) ; + bool bTapLow = false ; + bool bTapUp = false ; + bool bIgnoreTap = true ; + Point3d ptInt1, ptInt2 ; + Vector3d vtN1, vtN2 ; + return IntersLineCyl( ptL, vtL, frCyl, dHeight, dRad, bTapLow, bTapUp, + dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, bIgnoreTap) ; +} + +//---------------------------------------------------------------------------- +// linea già nel riferimento intrinseco del cilindro +//---------------------------------------------------------------------------- +bool IntersLineCyl( const Point3d& ptL, const Vector3d& vtL, + double dRad, double dHeight, + double& dU1, double& dU2) +{ + Point3d ptInt1, ptInt2 ; + Vector3d vtN1, vtN2 ; + bool bTapLow = false, bTapUp = false ; + bool bIgnoreTap = true ; + return IntersLineCyl( ptL, vtL, dHeight, dRad, bTapLow, bTapUp, + dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, bIgnoreTap) ; +} + + +//---------------------------------------------------------------------------- +// funzione esposta per altre dll +//---------------------------------------------------------------------------- +bool +IntersLineCyl( const Point3d& ptLineSt, const Vector3d& vtLineDir, + const Frame3d& CylFrame, double dH, double dRad, + double& dU1, Point3d& ptInt1, Vector3d& vtN1, double& dU2, Point3d& ptInt2, Vector3d& vtN2) +{ + return IntersLineCyl( ptLineSt, vtLineDir, CylFrame, dH, dRad, false, false, + dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, true, false) ; } diff --git a/IntersLineCyl.h b/IntersLineCyl.h index fd14e4b..0fe2087 100644 --- a/IntersLineCyl.h +++ b/IntersLineCyl.h @@ -20,17 +20,27 @@ // Il cilindro è centrato sull'asse Z e appoggiato sul piano XY. // Con intersezione viene restituito true e i parametri in dU1 e dU2. //---------------------------------------------------------------------------- -bool IntersLineCyl( const Point3d& ptL, const Vector3d& vtL, - double dRad, double dHeight, - double& dU1, double& dU2) ; +bool +IntersLineCyl( const Point3d& ptP, const Vector3d& vtV, double dH, double dRad, bool bTapLow, bool bTapUp, + double& dU1, Point3d& ptInt1, Vector3d& vtN1, double& dU2, Point3d& ptInt2, Vector3d& vtN2, bool bIgnoreTap = false, bool bInvertNormals = false) ; + +// come sopra ma passo il riferimento intrinseco del cilindro in cui portare la linea +bool +IntersLineCyl( const Point3d& ptLineSt, const Vector3d& vtLineDir, + const Frame3d& CylFrame, double dH, double dRad, bool bTapLow, bool bTapUp, + double& dU1, Point3d& ptInt1, Vector3d& vtN1, double& dU2, Point3d& ptInt2, Vector3d& vtN2, bool bIgnoreTap = false, bool bInvertNormals = false) ; //---------------------------------------------------------------------------- inline bool TestIntersLineCyl( const Point3d& ptL, const Vector3d& vtL, double dRad, double dHeight) { + Point3d ptInt1, ptInt2 ; + Vector3d vtN1, vtN2 ; double dU1, dU2 ; - return IntersLineCyl( ptL, vtL, dRad, dHeight, dU1, dU2) ; + bool bTapLow = false, bTapUp = false ; + bool bIgnoreTap = true ; + return IntersLineCyl( ptL, vtL, dHeight, dRad, bTapLow, bTapUp, dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, bIgnoreTap) ; } //---------------------------------------------------------------------------- @@ -50,3 +60,12 @@ bool IntersLineCyl( const Point3d& ptL, const Vector3d& vtL, bool IntersLineCyl( const Point3d& ptL, const Vector3d& vtL, const Point3d& ptCyl1, const Point3d& ptCyl2, double dRad, double& dU1, double& dU2) ; + +//---------------------------------------------------------------------------- +// // Linea e cilindro sono nel medesimo riferimento. +// Il cilindro è definito con raggio e altezza. ( la linea è già nel riferimento intrinseco del cilindro) +// In caso di intersezione viene restituito true e i parametri in dU1 e dU2. +//---------------------------------------------------------------------------- +bool IntersLineCyl( const Point3d& ptL, const Vector3d& vtL, + double dRad, double dHeight, + double& dU1, double& dU2) ; diff --git a/VolZmap.h b/VolZmap.h index f29ea72..24cb4b9 100644 --- a/VolZmap.h +++ b/VolZmap.h @@ -393,9 +393,6 @@ class VolZmap : public IVolZmap, public IGeoObjRW double& dU1, double& dU2) const ; bool GetDepthWithDexel( const Point3d& ptP, const Vector3d& vtDir, double& dInLength, double& dOutLength) const ; bool GetDepthWithVoxel( const Point3d& ptP, const Vector3d& vtDir, double& dInLength, double& dOutLength) const ; - bool IntersLineCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir, - const Frame3d& CylFrame, double dH, double dRad, bool bTapLow, bool bTapUp, - Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const ; bool IntersLineEllipticalCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir, const Frame3d& CircFrame, double dRad, double dLongMvLen, double dOrtMvLen, bool bTapLow, bool bTapUp, diff --git a/VolZmapCalculus.cpp b/VolZmapCalculus.cpp index bb57461..132b017 100644 --- a/VolZmapCalculus.cpp +++ b/VolZmapCalculus.cpp @@ -2071,127 +2071,6 @@ VolZmap::CDeSurfTm( const ISurfTriMesh& tmSurf, double dSafeDist, bool bPrecise) return false ; } -//---------------------------------------------------------------------------- -// Riferimento con origine nel centro della base e asse di simmetria coincidente con l'asse Z. -// La funzione restituisce true in caso di intersezione, false altrimenti. -//---------------------------------------------------------------------------- -bool -VolZmap::IntersLineCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir, - const Frame3d& CylFrame, double dH, double dRad, bool bTapLow, bool bTapUp, - Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const -{ - // Porto la linea nel riferimento del cilindro - Point3d ptP = GetToLoc( ptLineSt, CylFrame) ; - Vector3d vtV = GetToLoc( vtLineDir, CylFrame) ; - - // Determino le eventuali intersezioni con le due basi a quota minima e massima (solo se linea non parallela ad esse) - int nBasInt = 0 ; - if ( abs( vtV.z) > EPS_ZERO) { - // le linee tangenti al cilindro non sono considerate intersecanti - double dEpsRad = ( vtV.IsZeroXY() ? - EPS_SMALL : EPS_SMALL) ; - ptInt1 = ptP + ( ( 0 - ptP.z) / vtV.z) * vtV ; - if ( ptInt1.x * ptInt1.x + ptInt1.y * ptInt1.y < dRad * dRad + 2 * dRad * dEpsRad) { - nBasInt += 1 ; - vtN1 = Z_AX ; - } - ptInt2 = ptP + ( ( dH - ptP.z) / vtV.z) * vtV ; - if ( ptInt2.x * ptInt2.x + ptInt2.y * ptInt2.y < dRad * dRad + 2 * dRad * dEpsRad) { - nBasInt += 2 ; - vtN2 = - Z_AX ; - } - } - - // Se la linea interseca entrambe le basi, si sono trovate le due intersezioni - if ( nBasInt == 3) { - // Porto i punti e i versori nel riferimento globale - ptInt1.ToGlob( CylFrame) ; - vtN1.ToGlob( CylFrame) ; - ptInt2.ToGlob( CylFrame) ; - vtN2.ToGlob( CylFrame) ; - // Trovate intersezioni - return true ; - } - - // Determino le intersezioni con la superficie laterale del cilindro - DBLVECTOR vdCoeff{ ptP.x * ptP.x + ptP.y * ptP.y - dRad * dRad, - 2 * ( ptP.x * vtV.x + ptP.y * vtV.y), - vtV.x * vtV.x + vtV.y * vtV.y} ; - DBLVECTOR vdRoots ; - int nRoot = PolynomialRoots( 2, vdCoeff, vdRoots) ; - - // Epsilon per piani di tappo - double dEpsLow = ( bTapLow ? - EPS_SMALL : EPS_SMALL) ; - double dEpsUp = ( bTapUp ? EPS_SMALL : - EPS_SMALL) ; - - // Elimino le soluzioni cha danno intersezioni fuori dai limiti in Z del cilindro - if ( nRoot == 2) { - double dIntZ2 = ptP.z + vdRoots[1] * vtV.z ; - if ( dIntZ2 < 0 + dEpsLow || dIntZ2 > dH + dEpsUp) - -- nRoot ; - } - if ( nRoot >= 1) { - double dIntZ1 = ptP.z + vdRoots[0] * vtV.z ; - if ( dIntZ1 < 0 + dEpsLow || dIntZ1 > dH + dEpsUp) { - if ( nRoot == 2) - vdRoots[0] = vdRoots[1] ; - -- nRoot ; - } - } - - // Due soluzioni: la retta interseca due volte la superficie laterale - if ( nRoot == 2) { - // Punti di intersezione con la superficie del cilindro - ptInt1 = ptP + vdRoots[0] * vtV ; - ptInt2 = ptP + vdRoots[1] * vtV ; - // Determino le normali - vtN1.Set( -ptInt1.x, -ptInt1.y, 0) ; - vtN1.Normalize() ; - vtN2.Set( -ptInt2.x, -ptInt2.y, 0) ; - vtN2.Normalize() ; - // Porto i punti e i versori nel riferimento globale - ptInt1.ToGlob( CylFrame) ; - vtN1.ToGlob( CylFrame) ; - ptInt2.ToGlob( CylFrame) ; - vtN2.ToGlob( CylFrame) ; - // Trovate intersezioni - return true ; - } - - // Una soluzione : la retta interseca la superficie laterale e un piano - else if ( nRoot == 1) { - // Se piano superiore - if ( nBasInt == 2) { - // Punto di intersezione - ptInt1 = ptP + vdRoots[0] * vtV ; - // Normale alla superficie del cilindro verso l'interno - vtN1.Set( -ptInt1.x, -ptInt1.y, 0) ; - vtN1.Normalize() ; - } - // altrimenti piano inferiore - else if ( nBasInt == 1) { - // Punto di intersezione - ptInt2 = ptP + vdRoots[0] * vtV ; - // Normale alla superficie del cilindro verso l'interno - vtN2.Set( -ptInt2.x, -ptInt2.y, 0) ; - vtN2.Normalize() ; - } - // altrimenti niente - else - return false ; - // Porto i punti e i versori nel riferimento globale - ptInt1.ToGlob( CylFrame) ; - vtN1.ToGlob( CylFrame) ; - ptInt2.ToGlob( CylFrame) ; - vtN2.ToGlob( CylFrame) ; - // Trovate intersezioni - return true ; - } - - // Nessuna soluzione : nessuna intersezione - else - return false ; -} - //---------------------------------------------------------------------------- // Riferimento con origine nel vertice del cono e asse di simmetria coincidente con l'asse Z. // La funzione restituisce true in caso di intersezione, false altrimenti. diff --git a/VolZmapOffset.cpp b/VolZmapOffset.cpp index a4e62d8..1aaf040 100644 --- a/VolZmapOffset.cpp +++ b/VolZmapOffset.cpp @@ -21,6 +21,7 @@ #include "CurveLine.h" #include "CurveArc.h" #include "GeoConst.h" +#include "IntersLineCyl.h" #include "/EgtDev/Include/EGkStmFromCurves.h" #include "/EgtDev/Include/EGkIntersLineSurfTm.h" #include "/EgtDev/Include/EgtNumUtils.h" @@ -968,8 +969,9 @@ VolZmap::CreateOffsetCylinderOnEdge( const Point3d& ptP1, const Point3d& ptP2, d Point3d ptC( ( i + 0.5) * m_dStep, ( j + 0.5) * m_dStep, 0) ; Point3d ptInt1, ptInt2 ; Vector3d vtN1, vtN2 ; - if ( IntersLineCylinder( ptC, Z_AX, CylFrame, dH, abs( dOffs), true, true, - ptInt1, vtN1, ptInt2, vtN2)) { + double dU1, dU2 ; + if ( IntersLineCyl( ptC, Z_AX, CylFrame, dH, abs( dOffs), true, true, + dU1, ptInt1, vtN1, dU2, ptInt2, vtN2)) { if ( dOffs > 0.) AddIntervalsForOffset( nGrid, i, j, ptInt1.z, ptInt2.z, -vtN1, -vtN2, nTool, nTool) ; else diff --git a/VolZmapVolume.cpp b/VolZmapVolume.cpp index 46cd639..c5f9dbf 100644 --- a/VolZmapVolume.cpp +++ b/VolZmapVolume.cpp @@ -21,6 +21,7 @@ #include "VolZmap.h" #include "GeoConst.h" #include "IntersLineBox.h" +#include "IntersLineCyl.h" #include "/EgtDev/Include/EGkIntervals.h" #include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkSurfBezier.h" @@ -6249,7 +6250,8 @@ VolZmap::CompCyl_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE, co Point3d ptC( ( i + 0.5) * m_dStep, ( j + 0.5) * m_dStep, 0) ; Point3d ptInt1, ptInt2 ; Vector3d vtN1, vtN2 ; - if ( IntersLineCylinder( ptC, Z_AX, CylFrame, dH, dRad, bTapB, bTapT, ptInt1, vtN1, ptInt2, vtN2)) { + double dU1, dU2 ; + if ( IntersLineCyl( ptC, Z_AX, CylFrame, dH, dRad, bTapB, bTapT, dU1, ptInt1, vtN1, dU2, ptInt2, vtN2)) { SubtractIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, vtN1, vtN2, nToolNum) ; } } @@ -6294,8 +6296,9 @@ VolZmap::CompConus_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE, Vector3d vtN1, vtN2 ; // Cilindro - if ( IntersLineCylinder( ptC, Z_AX, CylFrame, dH, dMaxRad, true, bTapT, - ptInt1, vtN1, ptInt2, vtN2)) { + double dU1, dU2 ; + if ( IntersLineCyl( ptC, Z_AX, CylFrame, dH, dMaxRad, true, bTapT, + dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, false, true)) { SubtractIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, vtN1, vtN2, nToolNum) ; } @@ -6474,7 +6477,8 @@ VolZmap::CompCyl_Milling( int nGrid, const Point3d& ptS, const Point3d& ptE, // Cilindro iniziale CylFrame.ChangeOrig( ptITip) ; - if ( IntersLineCylinder( ptC, Z_AX, CylFrame, dHei, dRad, bTapB, bTapT, ptInt1, vtN1, ptInt2, vtN2)) { + double dU1, dU2 ; + if ( IntersLineCyl( ptC, Z_AX, CylFrame, dHei, dRad, bTapB, bTapT, dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, false, true)) { SubtractIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, vtN1, vtN2, nToolNum) ; } @@ -6482,7 +6486,7 @@ VolZmap::CompCyl_Milling( int nGrid, const Point3d& ptS, const Point3d& ptE, // del sistema di riferimento, quindi usiamo lo stesso sistema sommando a ptC // il vettore che congiunge le due origini. CylFrame.ChangeOrig( ptITip + vtMove) ; - if ( IntersLineCylinder( ptC, Z_AX, CylFrame, dHei, dRad, bTapB, bTapT, ptInt1, vtN1, ptInt2, vtN2)) { + if ( IntersLineCyl( ptC, Z_AX, CylFrame, dHei, dRad, bTapB, bTapT, dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, false, true)) { SubtractIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, vtN1, vtN2, nToolNum) ; } @@ -7069,7 +7073,8 @@ VolZmap::CompBall_Milling( int nGrid, const Point3d& ptLs, const Point3d& ptLe, // Cilindro inviluppo della sfera Point3d ptInt1, ptInt2 ; Vector3d vtN1, vtN2 ; - if ( IntersLineCylinder( ptC, Z_AX, CylFrame, dLengthPath, dRad, false, false, ptInt1, vtN1, ptInt2, vtN2)) { + double dU1, dU2 ; + if ( IntersLineCyl( ptC, Z_AX, CylFrame, dLengthPath, dRad, false, false, dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, false, true)) { SubtractIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, vtN1, vtN2, nToolNum) ; } } @@ -7217,15 +7222,15 @@ VolZmap::AddingCylinder( int nGrid, const Point3d& ptS, const Point3d& ptE, cons Point3d ptInt1, ptInt2 ; Vector3d vtN1, vtN2 ; - - if ( IntersLineCylinder( ptC, Z_AX, CylFrame, dHei, dRad, true, true, - ptInt1, vtN1, ptInt2, vtN2)) { - AddIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, - vtN1, - vtN2, CurrTool.GetToolNum()) ; + double dU1, dU2 ; + if ( IntersLineCyl( ptC, Z_AX, CylFrame, dHei, dRad, true, true, + dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, false, false)) { + AddIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, vtN1, vtN2, CurrTool.GetToolNum()) ; } - if ( IntersLineCylinder( ptC - dLen1 * vtV1, Z_AX, CylFrame, dHei, dRad, true, true, - ptInt1, vtN1, ptInt2, vtN2)) { - AddIntervals( nGrid, i, j, ptInt1.z + dLen1 * vtV1.z, ptInt2.z + dLen1 * vtV1.z, - vtN1, - vtN2, CurrTool.GetToolNum()) ; + if ( IntersLineCyl( ptC - dLen1 * vtV1, Z_AX, CylFrame, dHei, dRad, true, true, + dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, false, false)) { + AddIntervals( nGrid, i, j, ptInt1.z + dLen1 * vtV1.z, ptInt2.z + dLen1 * vtV1.z, vtN1, vtN2, CurrTool.GetToolNum()) ; } if ( IntersLineMyPolyhedron( ptC, Z_AX, PolyFrame, dLen1, 2 * ( dRad + dMyTol), dHei + 2 * dMyTol, 0, @@ -7621,8 +7626,9 @@ VolZmap::AddingSphere( int nGrid, const Point3d& ptS, const Point3d& ptE, double // Cilindro inviluppo della sfera Point3d ptInt1, ptInt2 ; Vector3d vtN1, vtN2 ; - if ( IntersLineCylinder( ptC, Z_AX, CylFrame, dLengthPath, dRad, false, false, ptInt1, vtN1, ptInt2, vtN2)) { - AddIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, - vtN1, - vtN2, CurrTool.GetToolNum()) ; + double dU1, dU2 ; + if ( IntersLineCyl( ptC, Z_AX, CylFrame, dLengthPath, dRad, false, false, dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, false, false)) { + AddIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, vtN1, vtN2, CurrTool.GetToolNum()) ; } } }