EgtGeomKernel :

- correzione a VirtualMilling per chisel con piccolissima inclinazione su AuxDir.
This commit is contained in:
Dario Sassi
2018-09-04 15:37:22 +00:00
parent 5afe1ddf16
commit 397c1a5edd
2 changed files with 34 additions and 30 deletions
+28 -23
View File
@@ -1169,25 +1169,42 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine
const Frame3d& PolyFrame, double dLenX, double dLenY, double dLenZ, double dDeltaZ,
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2)
{
// Costanti degli Offset
const double dOffsetX = EPS_SMALL ;
const double dOffsetY = EPS_SMALL ;
const double dOffsetZ = EPS_SMALL * sqrt( 1 + ( dDeltaZ * dDeltaZ) / ( dLenX * dLenX)) ;
// Controllo sulle dimensioni lineari affinché sia valido l'offset
if ( dLenX <= 2 * dOffsetX || dLenY <= 2 * dOffsetY || dLenZ <= 2 * dOffsetZ)
return false ;
// Accorcio le dimensioni lineari in modo opportuno: si noti che ora dLenX > 0 e ( 1 - 2 * EPS_SMALL / dLenX) < 1
dLenX -= 2 * dOffsetX ;
dLenY -= 2 * dOffsetY ;
dLenZ -= 2 * dOffsetZ ;
dDeltaZ = dDeltaZ * ( 1 - ( 2 * EPS_SMALL) / dLenX) ;
// Riferimento del poliedro offsettato
Frame3d frInnerFrame = PolyFrame ;
frInnerFrame.Translate( dOffsetX * frInnerFrame.VersX() + dOffsetZ * frInnerFrame.VersZ()) ;
Point3d ptP = ptLineSt ;
Vector3d vtV = vtLineDir ;
// Trasformazione delle coordinate
ptP.ToLoc( PolyFrame) ;
vtV.ToLoc( PolyFrame) ;
ptP.ToLoc( frInnerFrame) ;
vtV.ToLoc( frInnerFrame) ;
// Facce 1 e 2 parallele a XY
// Facce 3 e 4 parallele a XZ
// Facce 5 e 6 oblique
Point3d ptFacet135( 0, dLenY / 2, 0) ;
Point3d ptFacet246( dLenX , - dLenY / 2, dLenZ + dDeltaZ) ;
Point3d ptFacet246( dLenX, - dLenY / 2, dLenZ + dDeltaZ) ;
// Servono per descrivere i piani obliqui
Vector3d vtFacet5 = ptFacet135 - ptP ;
Vector3d vtFacet6 = ptFacet246 - ptP ;
Vector3d vtOb( - dDeltaZ, 0, dLenX) ;
vtOb.Normalize() ;
Point3d ptI1 = ptP + ( ( ptFacet135.y - ptP.y) / vtV.y) * vtV ;
@@ -1200,29 +1217,18 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine
// Controlli affinché non vengano tagliati dexel a filo
// con il passaggio dell'utensile:
// Controllo sulle facce 1 e 2
if ( abs( vtV.y) < EPS_ZERO &&
abs( ptP.y) > dLenY / 2 - EPS_SMALL)
if ( abs( vtV.y) < EPS_ZERO && abs( ptP.y) > ptFacet135.y)
return false ;
// Controllo sulle facce 3 e 4
if ( abs( vtV.x) < EPS_ZERO &&
( ptP.x < EPS_SMALL ||
ptP.x > dLenX - EPS_SMALL))
if ( abs( vtV.x) < EPS_ZERO && ( ptP.x < ptFacet135.x || ptP.x > ptFacet246.x))
return false ;
// Controllo sulle facce 5 e 6
/*Vector3d vtW( 0, dLenX, dDeltaZ) ;
vtW.Normalize() ;
Vector3d vtU = vtV - vtV.y * Y_AX - vtV * vtW * vtW ;
if ( vtU.Len() < EPS_ZERO &&
( ptP.z * dLenX < dDeltaZ * ptP.x + dLenX * EPS_SMALL ||
ptP.z * dLenX > dDeltaZ * ptP.x + dLenX * ( dLenY - EPS_SMALL)))
return false ;*/
double dDotObV = abs( vtV * vtOb) ;
Vector3d vtP1 = ptFacet135 - ptP ;
Vector3d vtP2 = ptFacet246 - ptP ;
double dP1 = abs ( vtP1 * vtOb) ;
double dP2 = abs ( vtP2 * vtOb) ;
if ( dDotObV < EPS_ZERO &&
( dP1 < EPS_SMALL || dP2 < EPS_SMALL))
if ( dDotObV < EPS_ZERO && ( dP1 < EPS_SMALL || dP2 < EPS_SMALL))
return false ;
// Ricerca intersezioni con le facce
@@ -1231,7 +1237,6 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine
// Intersezione con la prima faccia
if ( ptI1.x >= 0 && ptI1.x <= dLenX &&
ptI1.z * dLenX >= dDeltaZ * ptI1.x && ( ptI1.z - dLenZ) * dLenX <= dDeltaZ * ptI1.x) {
ptInt1 = ptI1 ;
vtN1 = - Y_AX ;
++ nIntNum ;
@@ -1317,10 +1322,10 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine
}
if ( nIntNum == 2) {
ptInt1.ToGlob( PolyFrame) ;
ptInt2.ToGlob( PolyFrame) ;
vtN1.ToGlob( PolyFrame) ;
vtN2.ToGlob( PolyFrame) ;
ptInt1.ToGlob( frInnerFrame) ;
ptInt2.ToGlob( frInnerFrame) ;
vtN1.ToGlob( frInnerFrame) ;
vtN2.ToGlob( frInnerFrame) ;
return true ;
}
else