EgtGeomKernel :

- correzioni a VM 5 assi con casi ottimizzati.
This commit is contained in:
Daniele Bariletti
2025-07-02 17:14:08 +02:00
parent 2fc6c30c8f
commit de7229aee7
2 changed files with 441 additions and 91 deletions
+437 -87
View File
@@ -1188,9 +1188,9 @@ VolZmap::GenTool_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR&
frNormFrame.Set( ORIG, X_AX, -Z_AX, Y_AX) ;
// Ciclo sulle curve del profilo
const CurveComposite& ToolProfile = CurrTool.GetApproxOutline() ;
int i = - 1 ;
int c = - 1 ;
const ICurve* pPrevCurve = nullptr ;
const ICurve* pCurve = ToolProfile.GetCurve( ++ i) ;
const ICurve* pCurve = ToolProfile.GetCurve( ++ c) ;
double dCumHeight = 0 ; // altezza cumulativa dei tratti già considerati
while ( pCurve != nullptr) {
@@ -1224,7 +1224,7 @@ VolZmap::GenTool_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR&
}
// verifiche curva successiva per eventuale tappo sotto
bool bTapB = true ;
const ICurve* pNextCurve = ToolProfile.GetCurve( ++ i) ;
const ICurve* pNextCurve = ToolProfile.GetCurve( ++ c) ;
if ( pNextCurve != nullptr && pNextCurve->GetType() == CRV_LINE) {
const ICurveLine* pOthLine = GetCurveLine( pNextCurve) ;
Point3d ptOthStart = pOthLine->GetStart() ;
@@ -1273,7 +1273,7 @@ VolZmap::GenTool_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR&
else {
// Passo alla curva successiva
pPrevCurve = pCurve ;
pCurve = ToolProfile.GetCurve( ++ i) ;
pCurve = ToolProfile.GetCurve( ++ c) ;
}
}
@@ -1294,7 +1294,7 @@ VolZmap::GenTool_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR&
dHeight = abs( ptStart.y - ptEnd.y) ;
// Passo alla curva successiva
pPrevCurve = pCurve ;
pCurve = ToolProfile.GetCurve( ++ i) ;
pCurve = ToolProfile.GetCurve( ++ c) ;
}
// Determino le posizioni iniziale e finale del componente successivo
@@ -1335,7 +1335,14 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
PNTVECTOR d ;
Vector3d q = Z_AX ;
DBLVECTOR A1, B1, C1, A2, B2, C2 ;
int nTotSurf = 2 + nSub * 2 ;
int nTotSurf = 4;
if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS)
nTotSurf = 2 + nSub * 2 ;
else if( n5AxisType == VolZmap::Move5Axis::ALONG_CONVEX || n5AxisType == VolZmap::Move5Axis::ALONG_CONCAVE)
nTotSurf = 2 + nSub * 2 + nStepCnt ;
else if( n5AxisType == VolZmap::Move5Axis::ACROSS)
nTotSurf = 2 + nSub * 4 ;
ISURFBEZPOVECTOR vSurfBez( nTotSurf * nStepCnt) ;
BOXVECTOR vSurfBox( nTotSurf * nStepCnt) ;
double dSide = 0 ;
@@ -1349,13 +1356,13 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
Vector3d vtDirTipStartEx ;
Vector3d vtDirTipEndEx ;
////debug
//if( nGrid == 0)
// vGeo.clear() ;
////debug
//debug
if( nGrid == 0)
vGeo.clear() ;
//debug
for ( int s = 0 ; s < nStepCnt ; ++s) {
// punti d riferimento sul tool
// punti di riferimento sul tool
Point3d ptTop1s ;
Point3d ptTop1e ;
Point3d ptTop2s ;
@@ -1400,10 +1407,16 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
ptBottom1e = ptP2T + vtAuxBottomE ;
ptBottom2e = ptP2T - vtAuxBottomE ;
// punti sul top e tip del tool che servono per costruire le bilineare di congiunzione tra step
PNTVECTOR vPntTipStart ;
PNTVECTOR vPntTipEnd ;
PNTVECTOR vPntTopStart ;
PNTVECTOR vPntTopEnd ;
// punti addizionali che servono nei casi che rischiedono più superfici bilineari ( tutti tranne NO_BASE_INTERS)
PNTVECTOR vPntTipStart2 ;
PNTVECTOR vPntTipEnd2 ;
PNTVECTOR vPntTopStart2 ;
PNTVECTOR vPntTopEnd2 ;
if ( nSub > 1) {
// determino in che modo collegare il cilindro iniziale con quello finale
Vector3d vtTopBaseEnd = vtDirTop - ( (vtDirTop * vtLe[s]) * vtLe[s]) ;
@@ -1423,13 +1436,17 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
Vector3d vtTipBaseStart = - (vtLs[s] ^ vtDirTip) ;
vtTipBaseStart.Normalize() ;
vtTipBaseStart *= dMinRad ;
if ( s == 0)
if ( s == 0) {
vtDirTipStartEx = vtTipBaseStart ;
vtDirTipStartEx.Rotate( vtLs[s], 90) ;
}
Vector3d vtTipBaseEnd = - (vtLe[s] ^ vtDirTip) ;
vtTipBaseEnd.Normalize() ;
vtTipBaseEnd *= dMinRad ;
if ( s == nStepCnt - 1)
if ( s == nStepCnt - 1) {
vtDirTipEndEx = vtTipBaseEnd ;
vtDirTipEndEx.Rotate( vtLe[s], 90) ;
}
// aggiungo il primo punto per ognuno dei gruppi
vtTopBaseStart.Rotate( vtLs[s], 90) ;
vtTopBaseEnd.Rotate( vtLe[s], 90) ;
@@ -1437,32 +1454,58 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
vPntTopEnd.emplace_back( ptE[s] + vtTopBaseEnd) ;
vPntTipStart.emplace_back( ptP1T + vtTipBaseStart) ;
vPntTipEnd.emplace_back( ptP2T + vtTipBaseEnd) ;
// punti addizionali per superfici bilineari
vPntTopStart2.emplace_back( ptS[s] + vtTopBaseStart) ;
vPntTopEnd2.emplace_back( ptE[s] + vtTopBaseEnd) ;
vPntTipStart2.emplace_back( ptP1T + vtTipBaseStart) ;
vPntTipEnd2.emplace_back( ptP2T + vtTipBaseEnd) ;
double dSubAng = 180. / nSub ;
// se dSide si discosta da zero allora devo usare più di una superficie per definire la parte superiore e inferiore del volume spazzata dal tool
for ( int i = 0 ; i < nSub ; ++i) {
// punti sulla base superiore dei cilindri
vPntTopStart.emplace_back( vPntTopStart.back()) ;
if ( dSide > 0)
vPntTopStart2.emplace_back( vPntTopStart2.back()) ;
if ( dSide > 0){
vPntTopStart.back().Rotate(ptS[s], vtLs[s], dSubAng) ;
else
vPntTopStart2.back().Rotate(ptS[s], vtLs[s], -dSubAng) ;
}
else{
vPntTopStart.back().Rotate(ptS[s], vtLs[s], -dSubAng) ;
vPntTopStart2.back().Rotate(ptS[s], vtLs[s], dSubAng) ;
}
vPntTopEnd.emplace_back( vPntTopEnd.back()) ;
if ( dSide > 0)
vPntTopEnd2.emplace_back( vPntTopEnd2.back()) ;
if ( dSide > 0){
vPntTopEnd.back().Rotate(ptE[s], vtLe[s], dSubAng) ;
else
vPntTopEnd2.back().Rotate(ptE[s], vtLe[s], -dSubAng) ;
}
else{
vPntTopEnd.back().Rotate(ptE[s], vtLe[s], -dSubAng) ;
vPntTopEnd2.back().Rotate(ptE[s], vtLe[s], dSubAng) ;
}
// punti sulla base inferiore dei cilindri
vPntTipStart.emplace_back( vPntTipStart.back()) ;
if ( dSide > 0)
vPntTipStart2.emplace_back( vPntTipStart2.back()) ;
if ( dSide > 0){
vPntTipStart.back().Rotate(ptP1T, vtLs[s], dSubAng) ;
else
vPntTipStart2.back().Rotate(ptP1T, vtLs[s], -dSubAng) ;
}
else{
vPntTipStart.back().Rotate(ptP1T, vtLs[s], -dSubAng) ;
vPntTipStart2.back().Rotate(ptP1T, vtLs[s], dSubAng) ;
}
vPntTipEnd.emplace_back( vPntTipEnd.back()) ;
if ( dSide > 0)
vPntTipEnd2.emplace_back( vPntTipEnd2.back()) ;
if ( dSide > 0){
vPntTipEnd.back().Rotate(ptP2T, vtLe[s], dSubAng) ;
else
vPntTipEnd2.back().Rotate(ptP2T, vtLe[s], -dSubAng) ;
}
else{
vPntTipEnd.back().Rotate(ptP2T, vtLe[s], -dSubAng) ;
vPntTipEnd2.back().Rotate(ptP2T, vtLe[s], dSubAng) ;
}
}
}
// mi salvo i punti ausiliari per la posizione iniziale e finale del tool
@@ -1470,7 +1513,7 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
vPntTipStartEx = vPntTipStart ;
vPntTopStartEx = vPntTopStart ;
}
else if ( s == nStepCnt - 1) {
if ( s == nStepCnt - 1) {
vPntTipEndEx = vPntTipEnd ;
vPntTopEndEx = vPntTopEnd ;
}
@@ -1487,13 +1530,50 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
vvPtCtrl.emplace_back( PNTVECTOR({ ptTop1s, ptTop2s, ptTop1e, ptTop2e})) ;
}
else {
// superfici inferiori
for ( int i = 0 ; i < nSub ; ++i) {
vvPtCtrl.emplace_back( PNTVECTOR({ vPntTipStart[i], vPntTipStart[i+1], vPntTipEnd[i], vPntTipEnd[i+1]})) ;
if( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS || n5AxisType == VolZmap::Move5Axis::ACROSS){
// superfici inferiori
for ( int i = 0 ; i < nSub ; ++i) {
vvPtCtrl.emplace_back( PNTVECTOR({ vPntTipStart[i], vPntTipStart[i+1], vPntTipEnd[i], vPntTipEnd[i+1]})) ;
}
// superfici superiori
for ( int i = 0 ; i < nSub ; ++i) {
vvPtCtrl.emplace_back( PNTVECTOR({ vPntTopStart[i], vPntTopStart[i+1], vPntTopEnd[i], vPntTopEnd[i+1]})) ;
}
// aggiungo le superfici bilineari anche nell'altro verso sia per il top che per il tip
if( n5AxisType == VolZmap::Move5Axis::ACROSS) {
// inferiori
for ( int i = 0 ; i < nSub ; ++i) {
vvPtCtrl.emplace_back( PNTVECTOR({ vPntTipStart2[i], vPntTipStart2[i+1], vPntTipEnd2[i], vPntTipEnd2[i+1]})) ;
}
// superfici superiori
for ( int i = 0 ; i < nSub ; ++i) {
vvPtCtrl.emplace_back( PNTVECTOR({ vPntTopStart2[i], vPntTopStart2[i+1], vPntTopEnd2[i], vPntTopEnd2[i+1]})) ;
}
}
}
// superficie superiori
for ( int i = 0 ; i < nSub ; ++i) {
vvPtCtrl.emplace_back( PNTVECTOR({ vPntTopStart[i], vPntTopStart[i+1], vPntTopEnd[i], vPntTopEnd[i+1]})) ;
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONVEX) {
// superfici superiori
for ( int i = 0 ; i < nSub ; ++i) {
vvPtCtrl.emplace_back( PNTVECTOR({ vPntTopStart[i], vPntTopStart[i+1], vPntTopEnd[i], vPntTopEnd[i+1]})) ;
}
// superfici superiori nell'altro verso
for ( int i = 0 ; i < nSub ; ++i) {
vvPtCtrl.emplace_back( PNTVECTOR({ vPntTopStart2[i], vPntTopStart2[i+1], vPntTopEnd2[i], vPntTopEnd2[i+1]})) ;
}
// superfici inferiori semplici
vvPtCtrl.emplace_back( PNTVECTOR({ vPntTipStart.front(), vPntTipStart.back(), vPntTipEnd.front(), vPntTipEnd.back()})) ;
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONCAVE) {
// superfici inferiori
for ( int i = 0 ; i < nSub ; ++i) {
vvPtCtrl.emplace_back( PNTVECTOR({ vPntTipStart[i], vPntTipStart[i+1], vPntTipEnd[i], vPntTipEnd[i+1]})) ;
}
// superfici inferiori nell'altro verso
for ( int i = 0 ; i < nSub ; ++i) {
vvPtCtrl.emplace_back( PNTVECTOR({ vPntTipStart2[i], vPntTipStart2[i+1], vPntTipEnd2[i], vPntTipEnd2[i+1]})) ;
}
// superfici superiori semplici
vvPtCtrl.emplace_back( PNTVECTOR({ vPntTopStart.front(), vPntTopStart.back(), vPntTopEnd.front(), vPntTopEnd.back()})) ;
}
}
@@ -1501,12 +1581,12 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
for( int z = 0 ; z < nTotSurf ; ++z) {
int nSurfInd = s * nTotSurf + z ;
vSurfBez[nSurfInd].Set( CreateSurfBezier()) ;
vSurfBez[nSurfInd]->Init(nDegU, nDegV, nSpanU, nSpanV, bRat) ;
vSurfBez[nSurfInd]->Init( nDegU, nDegV, nSpanU, nSpanV, bRat) ;
vSurfBez[nSurfInd]->SetControlPoint( 0, vvPtCtrl[z][0]) ;
vSurfBez[nSurfInd]->SetControlPoint( 1, vvPtCtrl[z][1]) ;
vSurfBez[nSurfInd]->SetControlPoint( 2, vvPtCtrl[z][2]) ;
vSurfBez[nSurfInd]->SetControlPoint( 3, vvPtCtrl[z][3]) ;
vSurfBox[nSurfInd].Add(vvPtCtrl[z]) ;
vSurfBox[nSurfInd].Add( vvPtCtrl[z]) ;
Vector3d a = vvPtCtrl[z][3] - vvPtCtrl[z][1] + ( vvPtCtrl[z][0] - vvPtCtrl[z][2]) ;
Vector3d b = vvPtCtrl[z][1] - vvPtCtrl[z][0] ;
@@ -1647,7 +1727,41 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
// verifico se sono nella metà della base il cui contorno è in contatto con le bilineari
//base inferiore
double dSectorAng = 0 ;
if ( bOnBottomBase1 && ( pt1 - frStartCyl.Orig()) * vtDirTipStartEx > 0) {
bool bApproxedSideBottom = false ;
bool bApproxedSideTop = false ;
double dBottomBaseSide1 = ( pt1 - frStartCyl.Orig()) * vtDirTipStartEx ;
double dTopBaseSide1 = ( pt1 - ( frStartCyl.Orig() + frStartCyl.VersZ() * dHeight))* vtDirTopStartEx ;
if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS) {
if ( dSide < 0) {
bApproxedSideBottom = dBottomBaseSide1 < 0 ;
bApproxedSideTop = dTopBaseSide1 > 0 ;
}
else {
bApproxedSideBottom = dBottomBaseSide1 > 0 ;
bApproxedSideTop = dTopBaseSide1 < 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ACROSS) {
bApproxedSideBottom = dBottomBaseSide1 < 0 ;
bApproxedSideTop = dTopBaseSide1 < 0 ;
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONVEX){
if ( bOnBottomBase1)
bUpdate1 = dBottomBaseSide1 < 0 ;
else if ( bOnTopBase1) {
bApproxedSideTop = dTopBaseSide1 < 0 ;
bUpdate1 = dTopBaseSide1 > 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONCAVE ) {
if ( bOnBottomBase1) {
bApproxedSideBottom = dBottomBaseSide1 < 0 ;
bUpdate1 = dBottomBaseSide1 > 0 ;
}
else if ( bOnTopBase1)
bUpdate1 = dTopBaseSide1 < 0 ;
}
if ( bOnBottomBase1 && bApproxedSideBottom) {
vvtTipStartAux.front().GetAngle(pt1 - frStartCyl.Orig(), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub) + 1) ;
@@ -1659,7 +1773,7 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
bUpdate1 = dDist > dMinRadApprox - EPS_SMALL && dDist < dMinRad ;
}
// base superiore
else if( bOnTopBase1 && ( pt1 - ( frStartCyl.Orig() + frStartCyl.VersZ() * dHeight))* vtDirTopStartEx > 0) {
else if( bOnTopBase1 && bApproxedSideTop) {
vvtTopStartAux.front().GetAngle( pt1 - ( frStartCyl.Orig() + frStartCyl.VersZ() * dHeight), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub)) + 1 ;
@@ -1670,7 +1784,7 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
else
bUpdate1 = dDist > dMaxRadApprox - EPS_SMALL && dDist < dMaxRad ;
}
else
else if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS && ((bOnTopBase1 && dSide < 0) || ( bOnBottomBase1 && dSide > 0)))
bUpdate1 = true ;
}
else {
@@ -1683,7 +1797,41 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
// verifico se sono nella metà della base il cui contorno è in contatto con le bilineari
//base inferiore
double dSectorAng = 0 ;
if ( bOnBottomBase2 && ( pt2 - frStartCyl.Orig()) * vtDirTipStartEx > 0) {
bool bApproxedSideBottom = false ;
bool bApproxedSideTop = false ;
double dBottomBaseSide2 = ( pt2 - frStartCyl.Orig()) * vtDirTipStartEx ;
double dTopBaseSide2 = ( pt2 - ( frStartCyl.Orig() + frStartCyl.VersZ() * dHeight))* vtDirTopStartEx ;
if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS) {
if ( dSide < 0) {
bApproxedSideBottom = dBottomBaseSide2 < 0 ;
bApproxedSideTop = dTopBaseSide2 > 0 ;
}
else {
bApproxedSideBottom = dBottomBaseSide2 > 0 ;
bApproxedSideTop = dTopBaseSide2 < 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ACROSS) {
bApproxedSideBottom = dBottomBaseSide2 < 0 ;
bApproxedSideTop = dTopBaseSide2 < 0 ;
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONVEX){
if ( bOnBottomBase2)
bUpdate2 = dBottomBaseSide2 < 0 ;
else if ( bOnTopBase2) {
bApproxedSideTop = dTopBaseSide2 < 0 ;
bUpdate2 = dTopBaseSide2 > 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONCAVE) {
if ( bOnBottomBase2) {
bApproxedSideBottom = dBottomBaseSide2 < 0 ;
bUpdate2 = dBottomBaseSide2 > 0 ;
}
else if ( bOnTopBase2)
bUpdate2 = dTopBaseSide2 < 0 ;
}
if ( bOnBottomBase2 && bApproxedSideBottom) {
vvtTipStartAux.front().GetAngle( pt2 - frStartCyl.Orig(), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub)) + 1 ;
@@ -1696,7 +1844,7 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
}
// base superiore
else if( bOnTopBase2 && ( pt2 - ( frStartCyl.Orig() + frStartCyl.VersZ() * dHeight))* vtDirTopStartEx > 0) {
else if( bOnTopBase2 && bApproxedSideTop) {
vvtTopStartAux.front().GetAngle( pt2 - ( frStartCyl.Orig() + frStartCyl.VersZ() * dHeight), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub)) + 1 ;
@@ -1708,7 +1856,7 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
bUpdate2 = dDist > dMaxRadApprox - EPS_SMALL && dDist < dMaxRad ;
}
}
else
else if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS && ((bOnTopBase2 && dSide < 0) || ( bOnBottomBase2 && dSide > 0)))
bUpdate2 = true ;
}
else {
@@ -1739,30 +1887,64 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
// verifico se sono nella metà della base il cui contorno è in contatto con le bilineari
//base inferiore
double dSectorAng = 0 ;
if ( bOnBottomBase1 && ( pt1 - frEndCyl.Orig()) * vtDirTipEndEx > 0) {
vvtTipStartAux.front().GetAngle(pt1 - frEndCyl.Orig(), dSectorAng) ;
bool bApproxedSideBottom = false ;
bool bApproxedSideTop = false ;
double dBottomBaseSide1 = ( pt1 - frEndCyl.Orig()) * vtDirTipEndEx ;
double dTopBaseSide1 = ( pt1 - ( frEndCyl.Orig() + frEndCyl.VersZ() * dHeight))* vtDirTopEndEx ;
if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS) {
if ( dSide < 0) {
bApproxedSideBottom = dBottomBaseSide1 < 0 ;
bApproxedSideTop = dTopBaseSide1 > 0 ;
}
else {
bApproxedSideBottom = dBottomBaseSide1 > 0 ;
bApproxedSideTop = dTopBaseSide1 < 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ACROSS) {
bApproxedSideBottom = dBottomBaseSide1 > 0 ;
bApproxedSideTop = dTopBaseSide1 > 0 ;
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONVEX){
if ( bOnBottomBase1)
bUpdate1 = dBottomBaseSide1 > 0 ;
else if ( bOnTopBase1) {
bApproxedSideTop = dTopBaseSide1 > 0 ;
bUpdate1 = dTopBaseSide1 < 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONCAVE ) {
if ( bOnBottomBase1) {
bApproxedSideBottom = dBottomBaseSide1 > 0 ;
bUpdate1 = dBottomBaseSide1 < 0 ;
}
else if ( bOnTopBase1)
bUpdate1 = dTopBaseSide1 > 0 ;
}
if ( bOnBottomBase1 && bApproxedSideBottom) {
vvtTipEndAux.front().GetAngle(pt1 - frEndCyl.Orig(), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub)) + 1 ;
// verifico se l'intersezione linea-base è interna o esterna
double dDist = (pt1 - frEndCyl.Orig()) * vvtTipStartAux[nSector] ;
double dDist = (pt1 - frEndCyl.Orig()) * vvtTipEndAux[nSector] ;
if ( dSide < 0)
bUpdate1 = dDist < dMinRadApprox - EPS_SMALL ;
else
bUpdate1 = dDist > dMinRadApprox - EPS_SMALL && dDist < dMinRad ;
}
// base superiore
else if( bOnTopBase1 && ( pt1 - ( frEndCyl.Orig() + frEndCyl.VersZ() * dHeight))* vtDirTopEndEx > 0) {
vvtTopStartAux.front().GetAngle( pt1 - ( frEndCyl.Orig() + frEndCyl.VersZ() * dHeight), dSectorAng) ;
else if( bOnTopBase1 && bApproxedSideTop) {
vvtTopEndAux.front().GetAngle( pt1 - ( frEndCyl.Orig() + frEndCyl.VersZ() * dHeight), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub)) + 1 ;
// verifico se l'intersezione linea-base è interna o esterna
double dDist = ( pt1 - ( frEndCyl.Orig() + frEndCyl.VersZ() * dHeight)) * vvtTopStartAux[nSector] ;
double dDist = ( pt1 - ( frEndCyl.Orig() + frEndCyl.VersZ() * dHeight)) * vvtTopEndAux[nSector] ;
if ( dSide > 0)
bUpdate1 = dDist < dMaxRadApprox - EPS_SMALL ;
else
bUpdate1 = dDist > dMaxRadApprox - EPS_SMALL && dDist < dMaxRad ;
}
else
else if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS && ((bOnTopBase1 && dSide > 0) || ( bOnBottomBase1 && dSide < 0)))
bUpdate1 = true ;
}
else {
@@ -1775,30 +1957,64 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
// verifico se sono nella metà della base il cui contorno è in contatto con le bilineari
//base inferiore
double dSectorAng = 0 ;
if ( bOnBottomBase2 && ( pt2 - frEndCyl.Orig()) * vtDirTipEndEx > 0) {
vvtTipStartAux.front().GetAngle(pt2 - frEndCyl.Orig(), dSectorAng) ;
bool bApproxedSideBottom = false ;
bool bApproxedSideTop = false ;
double dBottomBaseSide2 = ( pt2 - frEndCyl.Orig()) * vtDirTipEndEx ;
double dTopBaseSide2 = ( pt2 - ( frEndCyl.Orig() + frEndCyl.VersZ() * dHeight))* vtDirTopEndEx ;
if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS) {
if ( dSide < 0) {
bApproxedSideBottom = dBottomBaseSide2 < 0 ;
bApproxedSideTop = dTopBaseSide2 > 0 ;
}
else {
bApproxedSideBottom = dBottomBaseSide2 > 0 ;
bApproxedSideTop = dTopBaseSide2 < 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ACROSS) {
bApproxedSideBottom = dBottomBaseSide2 > 0 ;
bApproxedSideTop = dTopBaseSide2 > 0 ;
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONVEX){
if ( bOnBottomBase2)
bUpdate2 = dBottomBaseSide2 > 0 ;
else if ( bOnTopBase2) {
bApproxedSideTop = dTopBaseSide2 > 0 ;
bUpdate2 = dTopBaseSide2 < 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONCAVE) {
if ( bOnBottomBase2) {
bApproxedSideBottom = dBottomBaseSide2 > 0 ;
bUpdate2 = dBottomBaseSide2 < 0 ;
}
else if ( bOnTopBase2)
bUpdate2 = dTopBaseSide2 > 0 ;
}
if ( bOnBottomBase2 && bApproxedSideBottom) {
vvtTipEndAux.front().GetAngle(pt2 - frEndCyl.Orig(), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub)) + 1 ;
// verifico se l'intersezione linea-base è interna o esterna
double dDist = (pt2 - frEndCyl.Orig()) * vvtTipStartAux[nSector] ;
double dDist = (pt2 - frEndCyl.Orig()) * vvtTipEndAux[nSector] ;
if ( dSide < 0)
bUpdate2 = dDist < dMinRadApprox - EPS_SMALL ;
else
bUpdate2 = dDist > dMinRadApprox - EPS_SMALL && dDist < dMinRad ;
}
// base superiore
else if( bOnTopBase2 && ( pt2 - ( frEndCyl.Orig() + frEndCyl.VersZ() * dHeight))* vtDirTopEndEx > 0) {
vvtTopStartAux.front().GetAngle( pt2 - ( frEndCyl.Orig() + frEndCyl.VersZ() * dHeight), dSectorAng) ;
else if( bOnTopBase2 && bApproxedSideTop) {
vvtTopEndAux.front().GetAngle( pt2 - ( frEndCyl.Orig() + frEndCyl.VersZ() * dHeight), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub)) + 1 ;
// verifico se l'intersezione linea-base è interna o esterna
double dDist = ( pt2 - ( frEndCyl.Orig() + frEndCyl.VersZ() * dHeight)) * vvtTopStartAux[nSector] ;
double dDist = ( pt2 - ( frEndCyl.Orig() + frEndCyl.VersZ() * dHeight)) * vvtTopEndAux[nSector] ;
if ( dSide > 0)
bUpdate2 = dDist < dMaxRadApprox - EPS_SMALL ;
else
bUpdate2 = dDist > dMaxRadApprox - EPS_SMALL && dDist < dMaxRad ;
}
else
else if ( (n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS && ((bOnTopBase2 && dSide > 0) || ( bOnBottomBase2 && dSide < 0))))
bUpdate2 = true ;
}
else {
@@ -1832,7 +2048,41 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
// verifico se sono nella metà della base il cui contorno è in contatto con le bilineari
//base inferiore
double dSectorAng = 0 ;
if ( bOnBottomBase1 && ( pt1 - frStartCon.Orig()) * vtDirTipStartEx > 0) {
bool bApproxedSideBottom = false ;
bool bApproxedSideTop = false ;
double dBottomBaseSide2 = ( pt2 - frStartCon.Orig()) * vtDirTipStartEx ;
double dTopBaseSide2 = ( pt2 - ( frStartCon.Orig() + frStartCon.VersZ() * dHeight))* vtDirTopStartEx ;
if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS) {
if ( dSide < 0) {
bApproxedSideBottom = dBottomBaseSide2 < 0 ;
bApproxedSideTop = dTopBaseSide2 > 0 ;
}
else {
bApproxedSideBottom = dBottomBaseSide2 > 0 ;
bApproxedSideTop = dTopBaseSide2 < 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ACROSS) {
bApproxedSideBottom = dBottomBaseSide2 < 0 ;
bApproxedSideTop = dTopBaseSide2 < 0 ;
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONVEX){
if ( bOnBottomBase2)
bUpdate2 = dBottomBaseSide2 < 0 ;
else if ( bOnTopBase2) {
bApproxedSideTop = dTopBaseSide2 < 0 ;
bUpdate2 = dTopBaseSide2 > 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONCAVE) {
if ( bOnBottomBase2) {
bApproxedSideBottom = dBottomBaseSide2 < 0 ;
bUpdate2 = dBottomBaseSide2 > 0 ;
}
else if ( bOnTopBase2)
bUpdate2 = dTopBaseSide2 < 0 ;
}
if ( bOnBottomBase1 && bApproxedSideBottom) {
vvtTipStartAux.front().GetAngle(pt1 - frStartCon.Orig(), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub) + 1) ;
@@ -1844,7 +2094,7 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
bUpdate1 = dDist > dMinRadApprox - EPS_SMALL && dDist < dMinRad ;
}
// base superiore
else if( bOnTopBase1 && ( pt1 - ( frStartCon.Orig() + frStartCon.VersZ() * dHeight))* vtDirTopStartEx > 0) {
else if( bOnTopBase1 && bApproxedSideTop) {
vvtTopStartAux.front().GetAngle( pt1 - ( frStartCon.Orig() + frStartCon.VersZ() * dHeight), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub)) + 1 ;
@@ -1855,7 +2105,7 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
else
bUpdate1 = dDist > dMaxRadApprox - EPS_SMALL && dDist < dMaxRad ;
}
else
else if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS && ((bOnTopBase1 && dSide < 0) || ( bOnBottomBase1 && dSide > 0)))
bUpdate1 = true ;
}
else {
@@ -1868,7 +2118,37 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
// verifico se sono nella metà della base il cui contorno è in contatto con le bilineari
//base inferiore
double dSectorAng = 0 ;
if ( bOnBottomBase2 && ( pt2 - frStartCon.Orig()) * vtDirTipStartEx > 0) {
bool bApproxedSideBottom = false ;
bool bApproxedSideTop = false ;
double dBottomBaseSide2 = ( pt2 - frStartCon.Orig()) * vtDirTipStartEx ;
double dTopBaseSide2 = ( pt2 - ( frStartCon.Orig() + frStartCon.VersZ() * dHeight))* vtDirTopStartEx ;
if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS) {
if ( dSide < 0) {
bApproxedSideBottom = dBottomBaseSide2 < 0 ;
bApproxedSideTop = dTopBaseSide2 > 0 ;
}
else {
bApproxedSideBottom = dBottomBaseSide2 > 0 ;
bApproxedSideTop = dTopBaseSide2 < 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ACROSS) {
bApproxedSideBottom = dBottomBaseSide2 < 0 ;
bApproxedSideTop = dTopBaseSide2 < 0 ;
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONVEX){
if ( bOnBottomBase2)
bUpdate2 = dBottomBaseSide2 < 0 ;
else if ( bOnTopBase2)
bApproxedSideTop = dTopBaseSide2 < 0 ;
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONCAVE) {
if ( bOnBottomBase2)
bApproxedSideBottom = dBottomBaseSide2 < 0 ;
else if ( bOnTopBase2)
bUpdate2 = dTopBaseSide2 < 0 ;
}
if ( bOnBottomBase2 && bApproxedSideBottom) {
vvtTipStartAux.front().GetAngle( pt2 - frStartCon.Orig(), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub)) + 1 ;
@@ -1881,7 +2161,7 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
}
// base superiore
else if( bOnTopBase2 && ( pt2 - ( frStartCon.Orig() + frStartCon.VersZ() * dHeight))* vtDirTopStartEx > 0) {
else if( bOnTopBase2 && bApproxedSideTop) {
vvtTopStartAux.front().GetAngle( pt2 - ( frStartCon.Orig() + frStartCon.VersZ() * dHeight), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub)) + 1 ;
@@ -1893,7 +2173,7 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
bUpdate2 = dDist > dMaxRadApprox - EPS_SMALL && dDist < dMaxRad ;
}
}
else
else if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS && ((bOnTopBase2 && dSide < 0) || ( bOnBottomBase2 && dSide > 0)))
bUpdate2 = true ;
}
else {
@@ -1924,7 +2204,41 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
// verifico se sono nella metà della base il cui contorno è in contatto con le bilineari
//base inferiore
double dSectorAng = 0 ;
if ( bOnBottomBase1 && ( pt1 - frEndCon.Orig()) * vtDirTipEndEx > 0) {
bool bApproxedSideBottom = false ;
bool bApproxedSideTop = false ;
double dBottomBaseSide1 = ( pt1 - frEndCon.Orig()) * vtDirTipEndEx ;
double dTopBaseSide1 = ( pt1 - ( frEndCon.Orig() + frEndCon.VersZ() * dHeight))* vtDirTopEndEx ;
if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS) {
if ( dSide < 0) {
bApproxedSideBottom = dBottomBaseSide1 < 0 ;
bApproxedSideTop = dTopBaseSide1 > 0 ;
}
else {
bApproxedSideBottom = dBottomBaseSide1 > 0 ;
bApproxedSideTop = dTopBaseSide1 < 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ACROSS) {
bApproxedSideBottom = dBottomBaseSide1 > 0 ;
bApproxedSideTop = dTopBaseSide1 > 0 ;
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONVEX){
if ( bOnBottomBase1)
bUpdate1 = dBottomBaseSide1 > 0 ;
else if ( bOnTopBase1) {
bApproxedSideTop = dTopBaseSide1 > 0 ;
bUpdate1 = dTopBaseSide1 < 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONCAVE ) {
if ( bOnBottomBase1) {
bApproxedSideBottom = dBottomBaseSide1 > 0 ;
bUpdate1 = dBottomBaseSide1 < 0 ;
}
else if ( bOnTopBase1)
bUpdate1 = dTopBaseSide1 > 0 ;
}
if ( bOnBottomBase1 && bApproxedSideBottom) {
vvtTipStartAux.front().GetAngle(pt1 - frEndCon.Orig(), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub)) + 1 ;
@@ -1936,7 +2250,7 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
bUpdate1 = dDist > dMinRadApprox - EPS_SMALL && dDist < dMinRad ;
}
// base superiore
else if( bOnTopBase1 && ( pt1 - ( frEndCon.Orig() + frEndCon.VersZ() * dHeight))* vtDirTopEndEx > 0) {
else if( bOnTopBase1 && bApproxedSideTop) {
vvtTopStartAux.front().GetAngle( pt1 - ( frEndCon.Orig() + frEndCon.VersZ() * dHeight), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub)) + 1 ;
@@ -1947,7 +2261,7 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
else
bUpdate1 = dDist > dMaxRadApprox - EPS_SMALL && dDist < dMaxRad ;
}
else
else if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS && ((bOnTopBase1 && dSide > 0) || ( bOnBottomBase1 && dSide < 0)))
bUpdate1 = true ;
}
else {
@@ -1960,7 +2274,41 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
// verifico se sono nella metà della base il cui contorno è in contatto con le bilineari
//base inferiore
double dSectorAng = 0 ;
if ( bOnBottomBase2 && ( pt2 - frEndCon.Orig()) * vtDirTipEndEx > 0) {
bool bApproxedSideBottom = false ;
bool bApproxedSideTop = false ;
double dBottomBaseSide2 = ( pt2 - frEndCon.Orig()) * vtDirTipEndEx ;
double dTopBaseSide2 = ( pt2 - ( frEndCon.Orig() + frEndCon.VersZ() * dHeight))* vtDirTopEndEx ;
if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS) {
if ( dSide < 0) {
bApproxedSideBottom = dBottomBaseSide2 < 0 ;
bApproxedSideTop = dTopBaseSide2 > 0 ;
}
else {
bApproxedSideBottom = dBottomBaseSide2 > 0 ;
bApproxedSideTop = dTopBaseSide2 < 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ACROSS) {
bApproxedSideBottom = dBottomBaseSide2 > 0 ;
bApproxedSideTop = dTopBaseSide2 > 0 ;
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONVEX){
if ( bOnBottomBase2)
bUpdate2 = dBottomBaseSide2 > 0 ;
else if ( bOnTopBase2) {
bApproxedSideTop = dTopBaseSide2 > 0 ;
bUpdate2 = dTopBaseSide2 < 0 ;
}
}
else if ( n5AxisType == VolZmap::Move5Axis::ALONG_CONCAVE) {
if ( bOnBottomBase2) {
bApproxedSideBottom = dBottomBaseSide2 > 0 ;
bUpdate2 = dBottomBaseSide2 < 0 ;
}
else if ( bOnTopBase2)
bUpdate2 = dTopBaseSide2 > 0 ;
}
if ( bOnBottomBase2 && bApproxedSideBottom) {
vvtTipStartAux.front().GetAngle(pt2 - frEndCon.Orig(), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub)) + 1 ;
@@ -1972,7 +2320,7 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
bUpdate2 = dDist > dMinRadApprox - EPS_SMALL && dDist < dMinRad ;
}
// base superiore
else if( bOnTopBase2 && ( pt2 - ( frEndCon.Orig() + frEndCon.VersZ() * dHeight))* vtDirTopEndEx > 0) {
else if( bOnTopBase2 && bApproxedSideTop) {
vvtTopStartAux.front().GetAngle( pt2 - ( frEndCon.Orig() + frEndCon.VersZ() * dHeight), dSectorAng) ;
// determino in quale settore del semicerchio approssimato mi trovo
int nSector = int( dSectorAng / ( 180. / nSub)) + 1 ;
@@ -1983,7 +2331,7 @@ VolZmap::Comp_5AxisMilling( int nGrid, const PNTVECTOR& ptS, const PNTVECTOR& pt
else
bUpdate2 = dDist > dMaxRadApprox - EPS_SMALL && dDist < dMaxRad ;
}
else
else if ( n5AxisType == VolZmap::Move5Axis::NO_BASE_INTERS && ((bOnTopBase2 && dSide > 0) || ( bOnBottomBase2 && dSide < 0)))
bUpdate2 = true ;
}
else {
@@ -2181,7 +2529,7 @@ VolZmap::SelectGeneralMotion( int nGrid, const PNTVECTOR& ptPs, const PNTVECTOR&
case Tool::GEN :
return GenTool_5AxisMilling( nGrid, ptPs, ptPe, vtLs, vtLe, CurrTool.GetToolNum(), n5AxisType) ;
//case Tool::CYLMILL :
// return Cyl_5AxisMilling( nGrid, ptPs, ptPe, vtLs, vtLe, CurrTool.GetToolNum(), n5AxisType) ;
// return Cyl_5AxisMilling( nGrid, ptPs, ptPe, vtLs, vtLe, CurrTool.GetToolNum(), 0, n5AxisType) ;
//case Tool::BALLMILL :
// return CylBall_5AxisMilling( nGrid, ptPs, ptPe, vtLs, vtLe, CurrTool.GetToolNum(), n5AxisType) ;
//case Tool::CONEMILL :
@@ -2193,6 +2541,8 @@ VolZmap::SelectGeneralMotion( int nGrid, const PNTVECTOR& ptPs, const PNTVECTOR&
}
///// questo swithc non dovrebbe servire
//switch( nType) {
//case VolZmap::Move5Axis::ALONG : {
// switch ( CurrTool.GetType()) {
@@ -2245,9 +2595,10 @@ VolZmap::MillingGeneralMotionStep( const Point3d& ptPs, const Vector3d& vtDs, co
bool bAcross = abs( dAcrossAngDeg) > EPS_SMALL ;
bool bAcrossInters = false ;
if( vtDe * vtDir < vtDs * vtDir)
dAlongAngDeg *= -1 ;
bool bAlong = abs( dAlongAngDeg) > EPS_SMALL ;
bool bAlongInters = false ;
bool bAlongAcrossInters = false ;
if ( bAcross && bAlong) {
Vector3d vtInters = vtDs ^ vtDe ;
Vector3d vtMaxDir = vtInters ^ vtDe ;
@@ -2260,9 +2611,9 @@ VolZmap::MillingGeneralMotionStep( const Point3d& ptPs, const Vector3d& vtDs, co
}
}
else if ( bAcross)
bAcrossInters = dRad * sin( dAcrossAngDeg) > dHStep ;
bAcrossInters = dRad * sin( dAcrossAngDeg * DEGTORAD) > dHStep ;
else if ( bAlong)
bAlongInters = dRad * sin( dAlongAngDeg) > dHStep ;
bAlongInters = dRad * sin( abs( dAlongAngDeg) * DEGTORAD) > dHStep ;
int n5AxisType = VolZmap::Move5Axis::NO_BASE_INTERS ;
if ( bAcross && bAlong && ( bAcrossInters || bAlongInters))
@@ -2284,13 +2635,12 @@ VolZmap::MillingGeneralMotionStep( const Point3d& ptPs, const Vector3d& vtDs, co
n5AxisType = VolZmap::Move5Axis::NO_BASE_INTERS ;
}
// Divido il movimento in tratti con direzione utensile costante
//////// debug - vecchia modalità
//bool bOk = true ;
// // Calcolo coefficiente di riduzione movimenti con direzione costante per evitare extra tagli
// !!! In attesa dell'algoritmo esatto !!!
////!!! In attesa dell'algoritmo esatto !!!
//double dToolLen = m_vTool[m_nCurrTool].GetHeigth() ;
//double dToolCrad = m_vTool[m_nCurrTool].GetCornRadius() ;
//Vector3d vtBase = ptPe - ptPs ;
@@ -2336,18 +2686,18 @@ VolZmap::MillingGeneralMotionStep( const Point3d& ptPs, const Vector3d& vtDs, co
//BIPNTVECTOR vPntStep( nStepCnt) ;
//vector<pair<Vector3d, Vector3d>> vDirStep( nStepCnt) ;
vector<Point3d[N_MAPS]> ptLs( nStepCnt + 1) ;
vector<Point3d[N_MAPS]> ptLe( nStepCnt + 1) ;
vector<Vector3d[N_MAPS]> vtLs( nStepCnt + 1) ;
vector<Vector3d[N_MAPS]> vtLe( nStepCnt + 1) ;
vector<Point3d[N_MAPS]> ptLs( nStepCnt) ;
vector<Point3d[N_MAPS]> ptLe( nStepCnt) ;
vector<Vector3d[N_MAPS]> vtLs( nStepCnt) ;
vector<Vector3d[N_MAPS]> vtLe( nStepCnt) ;
for ( int i = 0 ; i <= nStepCnt ; ++ i) {
for ( int i = 0 ; i < nStepCnt ; ++ i) {
//// replico il tutto ma tenendo degli step più ampi e usando i veri vettori di start e end del tratto
double dPosCoeffE, dDirCoeffE, dPosCoeffS, dDirCoeffS ;
dPosCoeffS = double( i) / (nStepCnt + 1) ;
dDirCoeffS = double( i) / (nStepCnt + 1) ;
dPosCoeffE = double( i + 1) / (nStepCnt + 1) ;
dDirCoeffE = double( i + 1) / (nStepCnt + 1) ;
dPosCoeffS = double( i) / (nStepCnt) ;
dDirCoeffS = double( i) / (nStepCnt) ;
dPosCoeffE = double( i + 1) / (nStepCnt) ;
dDirCoeffE = double( i + 1) / (nStepCnt) ;
if ( i != 0) {
ptSti = Media( ptPs, ptPe, dPosCoeffS - dCorr) ;
vtDSi = Media( vtDs, vtDe, dDirCoeffS - dCorr) ; vtDSi.Normalize() ;
@@ -2361,11 +2711,11 @@ VolZmap::MillingGeneralMotionStep( const Point3d& ptPs, const Vector3d& vtDs, co
///// decommentare solo per debug
bool bOk = true ;
for( int j = 0 ; j < N_MAPS; ++j) {
PNTVECTOR ptLs_j( nStepCnt + 1) ;
PNTVECTOR ptLe_j( nStepCnt + 1) ;
VCT3DVECTOR vtLs_j( nStepCnt + 1) ;
VCT3DVECTOR vtLe_j( nStepCnt + 1) ;
for ( int z = 0 ; z <= nStepCnt ; ++z) {
PNTVECTOR ptLs_j( nStepCnt) ;
PNTVECTOR ptLe_j( nStepCnt) ;
VCT3DVECTOR vtLs_j( nStepCnt) ;
VCT3DVECTOR vtLe_j( nStepCnt) ;
for ( int z = 0 ; z < nStepCnt ; ++z) {
ptLs_j[z] = ptLs[z][j] ;
ptLe_j[z] = ptLe[z][j] ;
vtLs_j[z] = vtLs[z][j] ;
@@ -2384,11 +2734,11 @@ VolZmap::MillingGeneralMotionStep( const Point3d& ptPs, const Vector3d& vtDs, co
//vector<VCT3DVECTOR> vtLs_j( m_nMapNum) ;
//vector<VCT3DVECTOR> vtLe_j( m_nMapNum) ;
//for( int p = 0 ; p < m_nMapNum ; ++p) {
// ptLs_j[p].resize(nStepCnt + 1) ;
// ptLe_j[p].resize(nStepCnt + 1) ;
// vtLs_j[p].resize(nStepCnt + 1) ;
// vtLe_j[p].resize(nStepCnt + 1) ;
// for ( int z = 0 ; z <= nStepCnt ; ++z) {
// ptLs_j[p].resize(nStepCnt) ;
// ptLe_j[p].resize(nStepCnt) ;
// vtLs_j[p].resize(nStepCnt) ;
// vtLe_j[p].resize(nStepCnt) ;
// for ( int z = 0 ; z < nStepCnt ; ++z) {
// ptLs_j[p][z] = ptLs[z][p] ;
// ptLe_j[p][z] = ptLe[z][p] ;
// vtLs_j[p][z] = vtLs[z][p] ;