diff --git a/VolZmapVolume.cpp b/VolZmapVolume.cpp index 99de0c9..e672cab 100644 --- a/VolZmapVolume.cpp +++ b/VolZmapVolume.cpp @@ -639,10 +639,10 @@ VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d& // Versore utensile parallelo all'asse Z if ( vtLsXY.SqLen() < EPS_SMALL * EPS_SMALL) { - Vector3d vtMove = ptLe[i] - ptLs[i] ; vtMove.Normalize() ; + Vector3d vtMove = ptLe[i] - ptLs[i] ; // Foratura - if ( vtMove.SqLenXY() < EPS_SMALL) { + if ( vtMove.SqLenXY() < EPS_SMALL * EPS_SMALL) { switch ( m_Tool.GetType()) { case Tool::GEN : GenTool_ZDrilling( i, ptLs[i], ptLe[i], vtLs[i]) ; @@ -704,10 +704,11 @@ VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d& // Versore utensile nel piano else if ( abs( vtLs[i].z) < EPS_SMALL) { - Vector3d vtMove = ptLe[i] - ptLs[i] ; vtMove.Normalize() ; + Vector3d vtMove = ptLe[i] - ptLs[i] ; Vector3d vtMLong = ( vtMove * vtLs[i]) * vtLs[i] ; Vector3d vtMOrt = vtMove - vtMLong ; + double dSqLLong = vtMLong.SqLen() ; double dSqLOrt = vtMOrt.SqLen() ; // Foratura @@ -732,7 +733,7 @@ VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d& } } // Fresatura con vettore movimento perpendicolare all'utensile - else if ( 1 - dSqLOrt < EPS_SMALL * EPS_SMALL) { + else if ( dSqLLong < EPS_SMALL * EPS_SMALL) { switch ( m_Tool.GetType()) { case Tool::GEN : GenTool_Milling( i, ptLs[i], ptLe[i], vtLs[i]) ; @@ -771,7 +772,7 @@ VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d& // Versore utensile con direzione generica else { - Vector3d vtMove = ptLe[i] - ptLs[i] ; vtMove.Normalize() ; + Vector3d vtMove = ptLe[i] - ptLs[i] ; Vector3d vtMLong = ( vtMove * vtLs[i]) * vtLs[i] ; Vector3d vtMOrt = vtMove - vtMLong ;