diff --git a/Tool.cpp b/Tool.cpp index 9d6ba95..b66b713 100644 --- a/Tool.cpp +++ b/Tool.cpp @@ -74,6 +74,10 @@ Tool::SetTolerances( double dLinTol, double dAngTolDeg) bool Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR, double dCutterH, int nToolNum) { + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////// Test Additivi ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + return SetAdditiveTool( sToolName, dH, dR, dCornR, nToolNum) ; + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Impostazioni generali m_sName = sToolName ; m_nCurrentNum = nToolNum ; @@ -676,7 +680,7 @@ Tool::SetAdditiveTool( const std::string& sToolName, double dH, double dR, doubl if ( dH < EPS_SMALL || dR < EPS_SMALL || dRC < - EPS_SMALL) return false ; - m_nType = ADDITIVE ; + /*m_nType = ADDITIVE ;*/ m_dHeight = dH ; m_dRadius = dR ; m_dRCorner = dRC ; @@ -711,10 +715,13 @@ Tool::SetAdditiveTool( const std::string& sToolName, double dH, double dR, doubl // Utensile cilindrico con eventuale raggio corner else { // Utensile mal definito - if ( m_dRadius - m_dRCorner < EPS_SMALL) + if ( m_dRadius - m_dRCorner < 0) return false ; - // Raggio corner nullo - if ( m_dRadius < EPS_SMALL) { + // Utensile sferico + else if ( m_dRadius - m_dRCorner < EPS_SMALL) + ; + // Raggio corner nullo: cilindro + else if ( m_dRCorner < EPS_SMALL) { ; } else { diff --git a/VolZmapCreation.cpp b/VolZmapCreation.cpp index a7ab70f..6de8651 100644 --- a/VolZmapCreation.cpp +++ b/VolZmapCreation.cpp @@ -28,6 +28,10 @@ using namespace std ; bool VolZmap::Create( const Point3d& ptO, double dLengthX, double dLengthY, double dLengthZ, double dStep, bool bTriDex) { + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////// Test Additivi ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + return CreateEmptyMap(ptO, dLengthX, dLengthY, dLengthZ, dStep, bTriDex); + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Controlli sull'ammissibilità delle dimensioni lineari del grezzo e del passo if ( dStep < EPS_SMALL || dLengthX < EPS_SMALL || dLengthY < EPS_SMALL || dLengthZ < EPS_SMALL) return false ; @@ -736,6 +740,11 @@ VolZmap::CreateEmptyMap( const Point3d& ptO, double dLengthX, double dLengthY, d // Aggiornamento dello stato m_nStatus = OK ; - + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////// Test Additivi /////////////////////////////////////////////////////////////////////////////////////////////////////////// + AddTool(); + SetCurrTool(0); + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// return true ; } \ No newline at end of file diff --git a/VolZmapVolume.cpp b/VolZmapVolume.cpp index 73374cc..f3e262c 100644 --- a/VolZmapVolume.cpp +++ b/VolZmapVolume.cpp @@ -726,8 +726,11 @@ VolZmap::MillingTranslationStep( const Point3d& ptPs, const Point3d& ptPe, const Vector3d vtLs[N_MAPS] ; Vector3d vtALs[N_MAPS] ; InitializePointsAndVectors( ptPs, ptPe, vtD, vtA, ptLs, ptLe, vtLs, vtALs) ; + for ( int i = 0 ; i < m_nMapNum ; ++ i) { + SelectMotion( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ; + } // Ciclo sulle mappe - vector< future> vRes ; + /*vector< future> vRes ; vRes.resize( m_nMapNum) ; for ( int i = 0 ; i < m_nMapNum ; ++ i) { vRes[i] = async( launch::async, &VolZmap::SelectMotion, this, i, cref( ptLs[i]), cref( ptLe[i]), cref( vtLs[i]), cref( vtALs[i])) ; @@ -741,7 +744,7 @@ VolZmap::MillingTranslationStep( const Point3d& ptPs, const Point3d& ptPe, const ++ nTerminated ; } } - } + }*/ return true ; } @@ -7799,12 +7802,23 @@ VolZmap::AddingMotion( int nGrid, const Point3d& ptS, const Point3d& ptE, const double dRad = m_vTool[m_nCurrTool].GetRadius() ; double dCornerRad = m_vTool[m_nCurrTool].GetCornRadius() ; - if ( dCornerRad < EPS_SMALL) { + // Utensile sfiancato + if ( dCornerRad * dCornerRad - 0.25 * dHei * dHei > 0) { + AddingGeneral( nGrid, ptS, ptE, vtAx) ; + } + // Utensile sferico + else if ( dRad - dCornerRad < EPS_SMALL) { + ; + } + // Utensile cilindro + else if ( dCornerRad < EPS_SMALL) { AddingCylinder( nGrid, ptS, ptE, vtAx, dHei, dRad) ; } + // Utensile naso di toro else { AddingGeneral( nGrid, ptS, ptE, vtAx) ; } + return true ; } @@ -8122,10 +8136,10 @@ VolZmap::AddingTruncatedCone( int nGrid, const Point3d& ptS, const Point3d& ptE, // Intersezione con la prima faccia if ( abs( vtPoly * vtNs) > COS_ORTO_ANG_ZERO) { - if ( dLenY * ptPoly1.x >= dLenX * ptPoly1.y && - dLenY * ( ptPoly1.x - dDeltaX) <= dLenX * ( ptPoly1.y - dDeltaY) && - dDeltaX * ptPoly1.y >= dDeltaY * ptPoly1.x && - dDeltaX * ( ptPoly1.y - dLenY) <= dDeltaY * ( ptPoly1.x - dLenX)) { + if ( dLenY * ( ptPoly1.x + EPS_SMALL) > dLenX * ptPoly1.y && + dLenY * ( ptPoly1.x - dDeltaX - EPS_SMALL) < dLenX * ( ptPoly1.y - dDeltaY) && + dDeltaX * ( ptPoly1.y + EPS_SMALL) > dDeltaY * ptPoly1.x && + dDeltaX * ( ptPoly1.y - dLenY - EPS_SMALL) < dDeltaY * ( ptPoly1.x - dLenX)) { ptInt1 = ptPoly1 ; vtN1 = - vtNs ; if ( ! ( vtArcNormMaxR.IsSmall() || vtArcNormMinR.IsSmall())) { @@ -8143,10 +8157,10 @@ VolZmap::AddingTruncatedCone( int nGrid, const Point3d& ptS, const Point3d& ptE, } // Intersezione con la seconda faccia if ( abs( vtPoly * vtNd) > COS_ORTO_ANG_ZERO) { - if ( dLenY * ptPoly2.x >= dLenX * ptPoly2.y && - dLenY * ( ptPoly2.x - dDeltaX) <= dLenX * ( ptPoly2.y - dDeltaY) && - dDeltaX * ptPoly2.y >= dDeltaY * ptPoly2.x && - dDeltaX * ( ptPoly2.y - dLenY) <= dDeltaY * ( ptPoly2.x - dLenX)) { + if ( dLenY * ( ptPoly2.x + EPS_SMALL) > dLenX * ptPoly2.y && + dLenY * ( ptPoly2.x - dDeltaX - EPS_SMALL) < dLenX * ( ptPoly2.y - dDeltaY) && + dDeltaX * ( ptPoly2.y + EPS_SMALL) > dDeltaY * ptPoly2.x && + dDeltaX * ( ptPoly2.y - dLenY - EPS_SMALL) < dDeltaY * ( ptPoly2.x - dLenX)) { if ( nIntNum == 0) { ptInt1 = ptPoly2 ; @@ -8183,8 +8197,8 @@ VolZmap::AddingTruncatedCone( int nGrid, const Point3d& ptS, const Point3d& ptE, // Intersezione con la terza faccia 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) { + ptPoly3.x > - EPS_SMALL && ptPoly3.x < dDeltaX + EPS_SMALL && + dDeltaX * abs( ptPoly3.z) < dDeltaX * dLenZ + dDeltaZ * ptPoly3.x + dDeltaX * EPS_SMALL) { if ( nIntNum == 0) { ptInt1 = ptPoly3 ; @@ -8202,8 +8216,8 @@ VolZmap::AddingTruncatedCone( int nGrid, const Point3d& ptS, const Point3d& ptE, // Intersezione con la quarta faccia 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)) { + ptPoly4.x > dLenX - EPS_SMALL && ptPoly4.x < dLenX + dDeltaX + EPS_SMALL && + dDeltaX * abs( ptPoly4.z) < dDeltaX * dLenZ + dDeltaZ * ( ptPoly4.x - dLenX) + dDeltaX * EPS_SMALL) { if ( nIntNum == 0) { ptInt1 = ptPoly4 ;