diff --git a/IntersLineCyl.cpp b/IntersLineCyl.cpp index 425e094..ae40e16 100644 --- a/IntersLineCyl.cpp +++ b/IntersLineCyl.cpp @@ -60,14 +60,14 @@ IntersLineCyl( const Point3d& ptP, const Vector3d& vtV, double dH, double dRad, // Se la linea interseca entrambe le basi, si sono trovate le due intersezioni if ( nBasInt == 3) { - if ( isfinite( dU1) && isfinite(dU2) && dU1 > dU2) { + if ( dU1 > dU2) { swap( dU1, dU2) ; swap( ptInt1, ptInt2) ; swap( vtN1, vtN2) ; - if ( bInvertNormals) { - vtN1 *= - 1 ; - vtN2 *= - 1 ; - } + } + if ( bInvertNormals) { + vtN1 *= - 1 ; + vtN2 *= - 1 ; } // Trovate intersezioni return true ; @@ -119,10 +119,10 @@ IntersLineCyl( const Point3d& ptP, const Vector3d& vtV, double dH, double dRad, swap( dU1, dU2) ; swap( ptInt1, ptInt2) ; swap( vtN1, vtN2) ; - if ( bInvertNormals) { - vtN1 *= - 1 ; - vtN2 *= - 1 ; - } + } + if ( bInvertNormals) { + vtN1 *= - 1 ; + vtN2 *= - 1 ; } // Trovate intersezioni return true ; @@ -155,10 +155,10 @@ IntersLineCyl( const Point3d& ptP, const Vector3d& vtV, double dH, double dRad, swap( dU1, dU2) ; swap( ptInt1, ptInt2) ; swap( vtN1, vtN2) ; - if ( bInvertNormals) { - vtN1 *= - 1 ; - vtN2 *= - 1 ; - } + } + if ( bInvertNormals) { + vtN1 *= - 1 ; + vtN2 *= - 1 ; } // Trovate intersezioni return true ; diff --git a/VolZmapOffset.cpp b/VolZmapOffset.cpp index 1aaf040..ebe88e6 100644 --- a/VolZmapOffset.cpp +++ b/VolZmapOffset.cpp @@ -971,11 +971,11 @@ VolZmap::CreateOffsetCylinderOnEdge( const Point3d& ptP1, const Point3d& ptP2, d Vector3d vtN1, vtN2 ; double dU1, dU2 ; if ( IntersLineCyl( ptC, Z_AX, CylFrame, dH, abs( dOffs), true, true, - dU1, ptInt1, vtN1, dU2, ptInt2, vtN2)) { + dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, false, false)) { if ( dOffs > 0.) - AddIntervalsForOffset( nGrid, i, j, ptInt1.z, ptInt2.z, -vtN1, -vtN2, nTool, nTool) ; + AddIntervalsForOffset( nGrid, i, j, ptInt1.z, ptInt2.z, vtN1, vtN2, nTool, nTool) ; else - SubtractIntervalsForOffset( nGrid, i, j, ptInt1.z, ptInt2.z, vtN1, vtN2, nTool) ; + SubtractIntervalsForOffset( nGrid, i, j, ptInt1.z, ptInt2.z, -vtN1, -vtN2, nTool) ; } } } diff --git a/VolZmapVolume.cpp b/VolZmapVolume.cpp index c5f9dbf..0f238e3 100644 --- a/VolZmapVolume.cpp +++ b/VolZmapVolume.cpp @@ -6251,7 +6251,7 @@ VolZmap::CompCyl_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE, co Point3d ptInt1, ptInt2 ; Vector3d vtN1, vtN2 ; double dU1, dU2 ; - if ( IntersLineCyl( ptC, Z_AX, CylFrame, dH, dRad, bTapB, bTapT, dU1, ptInt1, vtN1, dU2, ptInt2, vtN2)) { + if ( IntersLineCyl( ptC, Z_AX, CylFrame, dH, dRad, bTapB, bTapT, dU1, ptInt1, vtN1, dU2, ptInt2, vtN2, false, true)) { SubtractIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, vtN1, vtN2, nToolNum) ; } }