From aa490f32c823a4b6a35c614e5cc41d7433ed9ef2 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 6 Apr 2017 18:37:26 +0000 Subject: [PATCH] =?UTF-8?q?EgtGeomKernel=20:=20-=20correzioni=20su=20Zmap?= =?UTF-8?q?=20con=20utensili=20conici=20e=20cos=C3=AC=20approssimati.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VolTriZmapVolume.cpp | 154 +++++++++++++++++++++++-------------------- 1 file changed, 83 insertions(+), 71 deletions(-) diff --git a/VolTriZmapVolume.cpp b/VolTriZmapVolume.cpp index 917fa2a..fdd4eb1 100644 --- a/VolTriZmapVolume.cpp +++ b/VolTriZmapVolume.cpp @@ -5121,7 +5121,7 @@ VolZmap::CompConus_Milling( unsigned int nGrid, const Point3d & ptS, const Point ptPoly.ToLoc( PolyFrame) ; vtPoly.ToLoc( PolyFrame) ; - + Point3d ptPoly1 = ptPoly + ( ( ( ptFacet135 - ptPoly) * vtNs) / ( vtPoly * vtNs)) * vtPoly ; Point3d ptPoly2 = ptPoly + ( ( ( ptFacet246 - ptPoly) * vtNd) / ( vtPoly * vtNd)) * vtPoly ; Point3d ptPoly3 = ptPoly + ( ( ( ptFacet135 - ptPoly) * vtIF) / ( vtPoly * vtIF)) * vtPoly ; @@ -5132,107 +5132,119 @@ VolZmap::CompConus_Milling( unsigned int nGrid, const Point3d & ptS, const Point int nIntNum = 0 ; // Intersezione con la prima faccia - if ( dLenY * ptPoly1.x >= dLenX * ptPoly1.y && - dLenY * ( ptPoly1.x - dDeltaX) <= dLenX * ptPoly1.y && - dDeltaX * ptPoly1.y >= dDeltaY * ptPoly1.x && - dDeltaX * ( ptPoly1.y - dLenY) <= dDeltaY * ( ptPoly1.x - dLenX)) { + if ( abs( vtPoly * vtNs) > COS_ORTO_ANG_ZERO) { + if ( dLenY * ptPoly1.x >= dLenX * ptPoly1.y && + dLenY * ( ptPoly1.x - dDeltaX) <= dLenX * ptPoly1.y && + dDeltaX * ptPoly1.y >= dDeltaY * ptPoly1.x && + dDeltaX * ( ptPoly1.y - dLenY) <= dDeltaY * ( ptPoly1.x - dLenX)) { - ptInt1 = ptPoly1 ; - vtN1 = - vtNs ; - ++ nIntNum ; - } + ptInt1 = ptPoly1 ; + vtN1 = - vtNs ; + ++ nIntNum ; + } + } // Intersezione con la seconda faccia - if ( dLenY * ptPoly2.x >= dLenX * ptPoly2.y && - dLenY * ( ptPoly2.x - dDeltaX) <= dLenX * ptPoly2.y && - dDeltaX * ptPoly2.y >= dDeltaY * ptPoly2.x && - dDeltaX * ( ptPoly2.y - dLenY) <= dDeltaY * ( ptPoly2.x - dLenX)) { + if ( abs( vtPoly * vtNd) > COS_ORTO_ANG_ZERO) { + if ( dLenY * ptPoly2.x >= dLenX * ptPoly2.y && + dLenY * ( ptPoly2.x - dDeltaX) <= dLenX * ptPoly2.y && + dDeltaX * ptPoly2.y >= dDeltaY * ptPoly2.x && + dDeltaX * ( ptPoly2.y - dLenY) <= dDeltaY * ( ptPoly2.x - dLenX)) { - if ( nIntNum == 0) { + if ( nIntNum == 0) { - ptInt1 = ptPoly2 ; - vtN1 = - vtNd ; - ++ nIntNum ; - } - else if ( ( ptInt1 - ptPoly2).SqLen() > dSqIndet) { + ptInt1 = ptPoly2 ; + vtN1 = - vtNd ; + ++ nIntNum ; + } + else if ( ( ptInt1 - ptPoly2).SqLen() > dSqIndet) { - ptInt2 = ptPoly2 ; - vtN2 = - vtNd ; - ++ nIntNum ; + ptInt2 = ptPoly2 ; + vtN2 = - vtNd ; + ++ nIntNum ; + } } } // Intersezione con la terza faccia - if ( nIntNum < 2 && - ptPoly3.x >= 0 && ptPoly3.x <= dDeltaX && - dDeltaX * abs( ptPoly3.z) < dDeltaX * dLenZ + dDeltaZ * ptPoly3.x) { + if ( abs( vtPoly * vtIF) > COS_ORTO_ANG_ZERO) { + if ( nIntNum < 2 && + ptPoly3.x >= 0 && ptPoly3.x <= dDeltaX && + dDeltaX * abs( ptPoly3.z) < dDeltaX * dLenZ + dDeltaZ * ptPoly3.x) { - if ( nIntNum == 0) { + if ( nIntNum == 0) { - ptInt1 = ptPoly3 ; - vtN1 = - vtIF ; - ++ nIntNum ; - } - else if ( ( ptInt1 - ptPoly3).SqLen() > dSqIndet) { + ptInt1 = ptPoly3 ; + vtN1 = - vtIF ; + ++ nIntNum ; + } + else if ( ( ptInt1 - ptPoly3).SqLen() > dSqIndet) { - ptInt2 = ptPoly3 ; - vtN2 = - vtIF ; - ++ nIntNum ; + ptInt2 = ptPoly3 ; + vtN2 = - vtIF ; + ++ nIntNum ; + } } } // Intersezione con la quarta faccia - if ( nIntNum < 2 && - ptPoly4.x >= dLenX && ptPoly4.x <= dLenX + dDeltaX && - dDeltaX * abs( ptPoly4.z) < dDeltaX * dLenZ + dDeltaZ * ( ptPoly4.x - dLenX)) { + if ( abs( vtPoly * vtIF) > COS_ORTO_ANG_ZERO) { + if ( nIntNum < 2 && + ptPoly4.x >= dLenX && ptPoly4.x <= dLenX + dDeltaX && + dDeltaX * abs( ptPoly4.z) < dDeltaX * dLenZ + dDeltaZ * ( ptPoly4.x - dLenX)) { - if ( nIntNum == 0) { + if ( nIntNum == 0) { - ptInt1 = ptPoly4 ; - vtN1 = vtIF ; - ++ nIntNum ; - } - else if ( ( ptInt1 - ptPoly4).SqLen() > dSqIndet) { + ptInt1 = ptPoly4 ; + vtN1 = vtIF ; + ++ nIntNum ; + } + else if ( ( ptInt1 - ptPoly4).SqLen() > dSqIndet) { - ptInt2 = ptPoly4 ; - vtN2 = vtIF ; - ++ nIntNum ; + ptInt2 = ptPoly4 ; + vtN2 = vtIF ; + ++ nIntNum ; + } } } // Intersezione con la quinta faccia - if ( nIntNum < 2 && - ptPoly5.y >= 0 && ptPoly5.y <= dLenY && - abs( ptPoly5.z) <= dLenZ) { + if ( abs( vtPoly * vtUD) > COS_ORTO_ANG_ZERO) { + if ( nIntNum < 2 && + ptPoly5.y >= 0 && ptPoly5.y <= dLenY && + abs( ptPoly5.z) <= dLenZ) { - if ( nIntNum == 0) { + if ( nIntNum == 0) { - ptInt1 = ptPoly5 ; - vtN1 = - vtUD ; - ++ nIntNum ; + ptInt1 = ptPoly5 ; + vtN1 = - vtUD ; + ++ nIntNum ; + } + else if ( ( ptInt1 - ptPoly5).SqLen() > dSqIndet) { + + ptInt2 = ptPoly5 ; + vtN2 = - vtUD ; + ++ nIntNum ; + } } - else if ( ( ptInt1 - ptPoly5).SqLen() > dSqIndet) { - - ptInt2 = ptPoly5 ; - vtN2 = - vtUD ; - ++ nIntNum ; - } } // Intersezione con la sesta faccia - if ( nIntNum < 2 && - ptPoly6.y >= dDeltaY && ptPoly6.y <= dLenY + dDeltaY && - abs( ptPoly6.z) <= dLenZ + dDeltaZ) { + if ( abs( vtPoly * vtUD) > COS_ORTO_ANG_ZERO) { + if ( nIntNum < 2 && + ptPoly6.y >= dDeltaY && ptPoly6.y <= dLenY + dDeltaY && + abs( ptPoly6.z) <= dLenZ + dDeltaZ) { - if ( nIntNum == 0) { + if ( nIntNum == 0) { - ptInt1 = ptPoly6; - vtN1 = vtUD ; - ++ nIntNum ; - } - else if ( ( ptInt1 - ptPoly6).SqLen() > dSqIndet) { + ptInt1 = ptPoly6; + vtN1 = vtUD ; + ++ nIntNum ; + } + else if ( ( ptInt1 - ptPoly6).SqLen() > dSqIndet) { - ptInt2 = ptPoly6; - vtN2 = vtUD ; - ++ nIntNum ; + ptInt2 = ptPoly6; + vtN2 = vtUD ; + ++ nIntNum ; + } } } // Se il poliedro è attraversato taglio