EgtMachKernel :
- codice di prova per VRONI - entrate Spiral - ZigZag.
This commit is contained in:
+199
-96
@@ -6843,10 +6843,30 @@ Pocketing::CalcLinkOnStep( const Point3d& ptS, const Point3d& ptE, const ISurfFl
|
||||
! pSfrSafe->CalcMedialAxis( vCrvBisectors, WMAT_IN) ||
|
||||
vCrvBisectors.empty())
|
||||
return false ;
|
||||
|
||||
/*
|
||||
*/
|
||||
m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pSfrSafe->Clone()) ;
|
||||
ICURVEPOVECTOR VRONI ;
|
||||
pSfrSafe->CalcVoronoiDiagram( VRONI) ;
|
||||
|
||||
// porto i bisettori nel riferimento
|
||||
for ( int i = 0 ; i < ( int)vCrvBisectors.size() ; ++ i)
|
||||
vCrvBisectors[i]->ToLoc( frCurr) ;
|
||||
for ( int i = 0 ; i < ( int)vCrvBisectors.size() ; ++ i) {
|
||||
//vCrvBisectors[i]->ToLoc( frCurr) ;
|
||||
int r = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, vCrvBisectors[i]->Clone()) ;
|
||||
m_pGeomDB->SetMaterial( r, RED) ;
|
||||
}
|
||||
|
||||
// porto i bisettori nel riferimento
|
||||
for ( int i = 0 ; i < ( int)VRONI.size() ; ++ i) {
|
||||
//vCrvBisectors[i]->ToLoc( frCurr) ;
|
||||
int r = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, VRONI[i]->Clone()) ;
|
||||
m_pGeomDB->SetMaterial( r, BLUE) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return false ;
|
||||
|
||||
// trasformo in composite concatenando le curve ( bloccandomi alle biforcazioni)
|
||||
ICRVCOMPOPOVECTOR vCompoBisChain ;
|
||||
@@ -6859,6 +6879,7 @@ Pocketing::CalcLinkOnStep( const Point3d& ptS, const Point3d& ptE, const ISurfFl
|
||||
if ( IsNull( pCrvPath))
|
||||
return false ;
|
||||
ChooseBestBisectorPath( vCompoBisChain, ORIG, ptEProj, pCrvPath) ;
|
||||
m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pCrvPath->Clone()) ;
|
||||
|
||||
double dMAxElev = 0. ;
|
||||
|
||||
@@ -6869,6 +6890,8 @@ Pocketing::CalcLinkOnStep( const Point3d& ptS, const Point3d& ptE, const ISurfFl
|
||||
Point3d ptS_path, ptE_path ;
|
||||
if ( ! pCrvPath->GetStartPoint( ptS_path) || ! pCrvPath->GetEndPoint( ptE_path))
|
||||
return false ;
|
||||
int r = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pSfrDanger->Clone()) ;
|
||||
m_pGeomDB->SetMaterial( r, ORANGE) ;
|
||||
|
||||
if ( ! AreSamePointEpsilon( ptS_path, ORIG, 5 * EPS_SMALL)) {
|
||||
PtrOwner<ICurveLine> pSegStart( CreateCurveLine()) ;
|
||||
@@ -6876,6 +6899,7 @@ Pocketing::CalcLinkOnStep( const Point3d& ptS, const Point3d& ptE, const ISurfFl
|
||||
! pSegStart->ToGlob( frCurr) || ! GetSpecialElevation( pSfrDanger, pSegStart, true, dMAxElev))
|
||||
return false ;
|
||||
bSkip = ( dMAxElev > EPS_SMALL) ;
|
||||
m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pSegStart->Clone()) ;
|
||||
}
|
||||
if ( ! bSkip) {
|
||||
if ( ! AreSamePointEpsilon( ptE_path, ptEProj, 5 * EPS_SMALL)) {
|
||||
@@ -7013,6 +7037,11 @@ Pocketing::ChooseBestBisectorPath( ICRVCOMPOPOVECTOR& vCrvCompo, const Point3d&
|
||||
return false ;
|
||||
pCrvPath->Clear() ;
|
||||
|
||||
for ( int u = 0 ; u < int( vCrvCompo.size()) ; ++ u) {
|
||||
int b = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, vCrvCompo[u]->Clone()) ;
|
||||
m_pGeomDB->SetMaterial( b, BLUE) ;
|
||||
}
|
||||
|
||||
// cerco gli indici delle curve più vicine a ptS e ptE
|
||||
double dMinDistORIG = INFINITO, dMinDistEnd = INFINITO ;
|
||||
int nIndS, nIndE ;
|
||||
@@ -7041,6 +7070,15 @@ Pocketing::ChooseBestBisectorPath( ICRVCOMPOPOVECTOR& vCrvCompo, const Point3d&
|
||||
! vCrvCompo[nIndE]->GetParamAtPoint( ptBisE, dUE, 10 * EPS_SMALL))
|
||||
return false ;
|
||||
|
||||
IGeoPoint3d* ptSS = CreateGeoPoint3d() ; ptSS->Set( ptS) ;
|
||||
m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, ptSS->Clone()) ;
|
||||
ptSS->Set( ptBisS) ;
|
||||
m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, ptSS->Clone()) ;
|
||||
ptSS->Set( ptE) ;
|
||||
m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, ptSS->Clone()) ;
|
||||
ptSS->Set( ptBisE) ;
|
||||
m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, ptSS->Clone()) ;
|
||||
|
||||
// splitto le curve più vicine sui rispettivi punti ( se non coincidenti a degli estremi)
|
||||
if ( nIndS != nIndE) {
|
||||
// se le curve sono distinte
|
||||
@@ -7206,7 +7244,7 @@ Pocketing::ChooseBestBisectorPath( ICRVCOMPOPOVECTOR& vCrvCompo, const Point3d&
|
||||
// inserisco il punto iniziale alla curva da restituire
|
||||
pCrvPath->AddPoint( ptBisE) ;
|
||||
|
||||
// percorro a ritroso i Nodi indivisuati
|
||||
// percorro a ritroso i Nodi individuati
|
||||
int nIndCurrNode = nDestInd ;
|
||||
int nIndPrecNode = -1 ;
|
||||
while ( vnIndPrec[nIndCurrNode] != -1) {
|
||||
@@ -7593,8 +7631,6 @@ Pocketing::AddSpiralOut( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVEC
|
||||
if ( IsNull( pCurve))
|
||||
return false ;
|
||||
|
||||
m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pCurve->Clone()) ;
|
||||
|
||||
// se prima curva del percorso
|
||||
if ( u == 0) {
|
||||
// ricavo il punto inziale
|
||||
@@ -10341,10 +10377,12 @@ Pocketing::AddLeadIn( const ICurveComposite* pCrvCompo, const Point3d& ptP1, con
|
||||
double dDeltaN = ( ptStart - ptP1) * vtN ;
|
||||
double dExtraAng = 0. ;
|
||||
if ( vtEnd.IsValid()) {
|
||||
vtEnd.GetAngle( vtStart, dExtraAng) ;
|
||||
bool bDet ;
|
||||
vtStart.GetRotation( vtEnd, vtN, dExtraAng, bDet) ;
|
||||
if ( dExtraAng < 0 && bAtLeft)
|
||||
dExtraAng = ANG_FULL + dExtraAng ;
|
||||
}
|
||||
double dAngCen = ( bAtLeft ? dExtraAng : - dExtraAng) +
|
||||
ceil( - dDeltaN / ( m_Params.m_dLiElev + 20 * EPS_SMALL)) * ( bAtLeft ? ANG_FULL : - ANG_FULL) ;
|
||||
double dAngCen = dExtraAng + ceil( - dDeltaN / ( m_Params.m_dLiElev + 20 * EPS_SMALL)) * ( bAtLeft ? ANG_FULL : - ANG_FULL) ;
|
||||
// verifico se fattibile
|
||||
if ( bSkipControl || VerifyLeadInHelix( pSrfChunk, ptCen, dRad)) {
|
||||
// creo l'elica
|
||||
@@ -10372,100 +10410,165 @@ Pocketing::AddLeadIn( const ICurveComposite* pCrvCompo, const Point3d& ptP1, con
|
||||
|
||||
// dati dello zigzag
|
||||
double dDeltaN = ( ptStart - ptP1) * vtN ;
|
||||
int nStep = int( ceil( - dDeltaN / ( m_Params.m_dLiElev + 20 * EPS_SMALL))) ;
|
||||
double dStep = - dDeltaN / nStep ;
|
||||
double dLenRef = 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
|
||||
// ricavo la curva di primo Offset dal percorso
|
||||
PtrOwner<ICurveComposite> pCrvCompoFirstOffs( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvCompoFirstOffs))
|
||||
// se sono in un caso ottimizzato dei trapezi ( tutti i lati chiusi)
|
||||
PtrOwner<ICurveComposite> pSingleCrv( CloneCurveComposite( pCrvCompo)) ;
|
||||
if ( IsNull( pSingleCrv) || ! pSingleCrv->IsValid())
|
||||
return false ;
|
||||
for ( int u = 0 ; u < pCrvCompo->GetCurveCount() ; ++ u) {
|
||||
Point3d ptEnd ; pCrvCompo->GetCurve( u)->GetEndPoint( ptEnd) ;
|
||||
pCrvCompoFirstOffs->AddCurve( pCrvCompo->GetCurve( u)->Clone()) ;
|
||||
if ( AreSamePointApprox( ptEnd, ptStart))
|
||||
break ;
|
||||
}
|
||||
// per sicurezza...
|
||||
pCrvCompoFirstOffs->Close() ;
|
||||
// la traslo della quantità richiesta ( il percorso a ZigZag incomincia sopra al piano di pocketing)
|
||||
pCrvCompoFirstOffs->Translate( - vtN * dDeltaN) ;
|
||||
double dLen, dUA, dUB ;
|
||||
if ( pCrvCompoFirstOffs->GetParamAtLength( 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam), dUA) &&
|
||||
pCrvCompoFirstOffs->GetLength( dLen) &&
|
||||
pCrvCompoFirstOffs->GetParamAtLength( dLen - 0.5 * ( m_Params.m_dLiTang, m_TParams.m_dDiam), dUB))
|
||||
{
|
||||
// recupero le due sottocurve per definire il percorso a ZigZag
|
||||
PtrOwner<ICurve> pCrvA( pCrvCompoFirstOffs->CopyParamRange( 0., dUA)) ;
|
||||
PtrOwner<ICurve> pCrvB( pCrvCompoFirstOffs->CopyParamRange( dUB, pCrvCompoFirstOffs->GetCurveCount())) ;
|
||||
if ( IsNull( pCrvA) || IsNull( pCrvB) || ! pCrvA->IsValid() || ! pCrvB->IsValid())
|
||||
pSingleCrv->MergeCurves( 100 * EPS_ANG_SMALL, 100 * EPS_ANG_SMALL) ; // per sicurezza
|
||||
// ricavo la lunghezza della curva
|
||||
double dLen ;
|
||||
if ( ! pSingleCrv->GetLength( dLen))
|
||||
return false ;
|
||||
|
||||
// se la curva è singola e permette l'entrata a zigzag...
|
||||
if ( pSingleCrv->GetCurveCount() == 1 && dLen > dLenRef) {
|
||||
int nStep = int( ceil( - dDeltaN / ( m_Params.m_dLiElev + 20 * EPS_SMALL))) + 1 ;
|
||||
double dStep = - dDeltaN / nStep ;
|
||||
double dUTrap ;
|
||||
Point3d ptTrap ;
|
||||
if ( ! pSingleCrv->GetParamAtLength( dLenRef, dUTrap) ||
|
||||
! pSingleCrv->GetPointD1D2( dUTrap, ICurve::FROM_MINUS, ptTrap))
|
||||
return false ;
|
||||
|
||||
// inverto la curva sinistra
|
||||
pCrvB->Invert() ;
|
||||
|
||||
// traslo MAX_NUM_PT punti della curva lungo -vtN e creo quindi le curve per lo ZigZag
|
||||
const int MAX_NUM_PT = 100 ;
|
||||
PtrOwner<ICurveComposite> pCrvA_ZigZag( CreateCurveComposite()) ;
|
||||
PtrOwner<ICurveComposite> pCrvB_ZigZag( CreateCurveComposite()) ;
|
||||
PtrOwner<ICurveComposite> pCrvA_ZigZag_I( CreateCurveComposite()) ;
|
||||
PtrOwner<ICurveComposite> pCrvB_ZigZag_I( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvA_ZigZag) || IsNull( pCrvB_ZigZag) ||
|
||||
IsNull( pCrvA_ZigZag_I) || IsNull( pCrvB_ZigZag_I))
|
||||
return false ;
|
||||
|
||||
Point3d ptS ; pCrvA->GetStartPoint( ptS) ;
|
||||
pCrvA_ZigZag->AddPoint( ptS) ;
|
||||
pCrvB_ZigZag->AddPoint( ptS) ;
|
||||
ptS.Translate( - vtN * 0.5 * dStep) ;
|
||||
pCrvA_ZigZag_I->AddPoint( ptS) ;
|
||||
pCrvB_ZigZag->AddPoint( ptS) ;
|
||||
ptS.Translate( - vtN * 0.5 * dStep) ;
|
||||
pCrvB_ZigZag_I->AddPoint( ptS) ;
|
||||
|
||||
double dLenRef = 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
PNTVECTOR vPtA ; PNTVECTOR vPtB ;
|
||||
for ( int j = 1 ; j <= MAX_NUM_PT ; ++ j) {
|
||||
double dParA ; pCrvA->GetParamAtLength( j * ( dLenRef / MAX_NUM_PT), dParA) ;
|
||||
Point3d ptA ; pCrvA->GetPointD1D2( dParA, ICurve::FROM_MINUS, ptA) ;
|
||||
Point3d ptA_z = ptA ; ptA_z.Translate( - vtN * j * ( 0.25 * dStep / MAX_NUM_PT)) ;
|
||||
pCrvA_ZigZag->AddLine( ptA_z) ;
|
||||
Point3d ptA_z_I = ptA ; ptA_z_I.Translate( - vtN * ( 0.25 * dStep) * ( 2.0 - ( 1. * j) / MAX_NUM_PT)) ;
|
||||
pCrvA_ZigZag_I->AddLine( ptA_z_I) ;
|
||||
double dParB ; pCrvB->GetParamAtLength( j * ( dLenRef / MAX_NUM_PT), dParB) ;
|
||||
Point3d ptB ; pCrvB->GetPointD1D2( dParB, ICurve::FROM_MINUS, ptB) ;
|
||||
Point3d ptB_z = ptB ; ptB_z.Translate( - vtN * ( 0.25 * dStep) * ( 2.0 + ( 1. * j) / MAX_NUM_PT)) ;
|
||||
pCrvB_ZigZag->AddLine( ptB_z) ;
|
||||
Point3d ptB_z_I = ptB ; ptB_z_I.Translate( - vtN * ( 0.25 * dStep) * ( 4 - ( 1. * j) / MAX_NUM_PT)) ;
|
||||
pCrvB_ZigZag_I->AddLine( ptB_z_I) ;
|
||||
}
|
||||
|
||||
// abbellisco le curve
|
||||
pCrvA_ZigZag->MergeCurves( 500 * EPS_SMALL, 500 * EPS_ANG_SMALL) ;
|
||||
pCrvA_ZigZag_I->MergeCurves( 500 * EPS_SMALL, 500 * EPS_ANG_SMALL) ;
|
||||
pCrvA_ZigZag_I->Invert() ;
|
||||
pCrvB_ZigZag->MergeCurves( 500 * EPS_SMALL, 500 * EPS_ANG_SMALL) ;
|
||||
pCrvB_ZigZag_I->MergeCurves( 500 * EPS_SMALL, 500 * EPS_ANG_SMALL) ;
|
||||
pCrvB_ZigZag_I->Invert() ;
|
||||
|
||||
// per ogni step copio le curve
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
if ( AddCurveMove( pCrvA_ZigZag, MCH_CL_LEADIN) == GDB_ID_NULL ||
|
||||
AddCurveMove( pCrvA_ZigZag_I, MCH_CL_LEADIN) == GDB_ID_NULL ||
|
||||
AddCurveMove( pCrvB_ZigZag, MCH_CL_LEADIN) == GDB_ID_NULL ||
|
||||
AddCurveMove( pCrvB_ZigZag_I, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
pCrvA_ZigZag->Translate( - vtN * dStep) ;
|
||||
pCrvA_ZigZag_I->Translate( - vtN * dStep) ;
|
||||
pCrvB_ZigZag->Translate( - vtN * dStep) ;
|
||||
pCrvB_ZigZag_I->Translate( - vtN * dStep) ;
|
||||
}
|
||||
return true ;
|
||||
// traslo il punto trovato alla quota di ptP1
|
||||
ptTrap.Translate( - dDeltaN * vtN) ;
|
||||
// estremi del percorso a ZigZag
|
||||
Point3d ptPa = ptTrap + vtStart * dLenRef ;
|
||||
Point3d ptPb = ptTrap - vtStart * dLenRef ;
|
||||
// verifico se fattibile
|
||||
if ( bSkipControl || VerifyLeadInZigZag( pSrfChunk, ptPa, ptPb)) {
|
||||
for ( int i = 1 ; i < nStep ; ++ i) {
|
||||
if ( AddLinearMove( ptPa - vtN * ( i - 0.75) * dStep, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( AddLinearMove( ptPb - vtN * ( i - 0.25) * dStep, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
if ( AddLinearMove( ptPa - vtN * ( nStep - 0.75) * dStep, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
return ( AddLinearMove( ptStart, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
nType = POCKET_LI_NONE ;
|
||||
if ( m_TParams.m_nType == TT_MILL_NOTIP)
|
||||
return false ;
|
||||
int nStep = int( ceil( - dDeltaN / ( m_Params.m_dLiElev + 20 * EPS_SMALL))) ;
|
||||
double dStep = - dDeltaN / nStep ;
|
||||
// se la svuotatuta è SpiralOut, l'entrata a ZigZag è più conveniente farla lineare
|
||||
if ( m_Params.m_nSubType == POCKET_SUB_SPIRALOUT) {
|
||||
Point3d ptPa = ptP1 + vtStart * dLenRef ;
|
||||
Point3d ptPb = ptP1 - vtStart * dLenRef ;
|
||||
// verifico se fattibile
|
||||
if ( bSkipControl || VerifyLeadInZigZag( pSrfChunk, ptPa, ptPb)) {
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
if ( AddLinearMove( ptPa - vtN * ( i - 0.75) * dStep, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( AddLinearMove( ptPb - vtN * ( i - 0.25) * dStep, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
return ( AddLinearMove( ptStart, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// ricavo la curva di primo Offset dal percorso
|
||||
PtrOwner<ICurveComposite> pCrvCompoFirstOffs( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvCompoFirstOffs))
|
||||
return false ;
|
||||
for ( int u = 0 ; u < pCrvCompo->GetCurveCount() ; ++ u) {
|
||||
Point3d ptEnd ; pCrvCompo->GetCurve( u)->GetEndPoint( ptEnd) ;
|
||||
pCrvCompoFirstOffs->AddCurve( pCrvCompo->GetCurve( u)->Clone()) ;
|
||||
if ( AreSamePointApprox( ptEnd, ptStart))
|
||||
break ;
|
||||
}
|
||||
// per sicurezza...
|
||||
pCrvCompoFirstOffs->Close() ;
|
||||
// la traslo della quantità richiesta ( il percorso a ZigZag incomincia sopra al piano di pocketing)
|
||||
pCrvCompoFirstOffs->Translate( - vtN * dDeltaN) ;
|
||||
double dLen, dUA, dUB ;
|
||||
if ( pCrvCompoFirstOffs->GetParamAtLength( dLenRef, dUA) &&
|
||||
pCrvCompoFirstOffs->GetLength( dLen) &&
|
||||
pCrvCompoFirstOffs->GetParamAtLength( dLen - dLenRef, dUB))
|
||||
{
|
||||
// recupero le due sottocurve per definire il percorso a ZigZag
|
||||
PtrOwner<ICurve> pCrvA( pCrvCompoFirstOffs->CopyParamRange( 0., dUA)) ;
|
||||
PtrOwner<ICurve> pCrvB( pCrvCompoFirstOffs->CopyParamRange( dUB, pCrvCompoFirstOffs->GetCurveCount())) ;
|
||||
if ( IsNull( pCrvA) || IsNull( pCrvB) || ! pCrvA->IsValid() || ! pCrvB->IsValid())
|
||||
return false ;
|
||||
|
||||
// inverto la curva sinistra
|
||||
pCrvB->Invert() ;
|
||||
|
||||
// traslo MAX_NUM_PT punti della curva lungo -vtN e creo quindi le curve per lo ZigZag
|
||||
const int MAX_NUM_PT = 100 ;
|
||||
PtrOwner<ICurveComposite> pCrvA_ZigZag( CreateCurveComposite()) ;
|
||||
PtrOwner<ICurveComposite> pCrvB_ZigZag( CreateCurveComposite()) ;
|
||||
PtrOwner<ICurveComposite> pCrvA_ZigZag_I( CreateCurveComposite()) ; // Invertita
|
||||
PtrOwner<ICurveComposite> pCrvB_ZigZag_I( CreateCurveComposite()) ; // Invertita
|
||||
if ( IsNull( pCrvA_ZigZag) || IsNull( pCrvB_ZigZag) ||
|
||||
IsNull( pCrvA_ZigZag_I) || IsNull( pCrvB_ZigZag_I))
|
||||
return false ;
|
||||
|
||||
// ricavo, rispettivamente, i valori al 0%, 25%, 50%, 75%, 100% delle quote per la discesa
|
||||
// ( il percorso a ZigZag sarà formato da crvA, crvA_invetered, crvB, crvB_inverted)
|
||||
Point3d ptS ; pCrvA->GetStartPoint( ptS) ;
|
||||
pCrvA_ZigZag->AddPoint( ptS) ;
|
||||
pCrvB_ZigZag->AddPoint( ptS) ;
|
||||
ptS.Translate( - vtN * 0.5 * dStep) ;
|
||||
pCrvA_ZigZag_I->AddPoint( ptS) ;
|
||||
pCrvB_ZigZag->AddPoint( ptS) ;
|
||||
ptS.Translate( - vtN * 0.5 * dStep) ;
|
||||
pCrvB_ZigZag_I->AddPoint( ptS) ;
|
||||
|
||||
|
||||
for ( int j = 1 ; j <= MAX_NUM_PT ; ++ j) { // j parte da 1, ho già inserito i punti inziali
|
||||
// tra lo 0% e il 50% della discesa, si considera la curva A
|
||||
double dParA ; pCrvA->GetParamAtLength( j * ( dLenRef / MAX_NUM_PT), dParA) ;
|
||||
Point3d ptA ; pCrvA->GetPointD1D2( dParA, ICurve::FROM_MINUS, ptA) ;
|
||||
// tra 0% e 25%
|
||||
Point3d ptA_z = ptA ; ptA_z.Translate( - vtN * j * ( 0.25 * dStep / MAX_NUM_PT)) ;
|
||||
pCrvA_ZigZag->AddLine( ptA_z) ;
|
||||
// tra 25% e 50%
|
||||
Point3d ptA_z_I = ptA ; ptA_z_I.Translate( - vtN * ( 0.25 * dStep) * ( 2.0 - ( 1. * j) / MAX_NUM_PT)) ;
|
||||
pCrvA_ZigZag_I->AddLine( ptA_z_I) ;
|
||||
// tra il 50% e il 100% della discesa, si considera la curva B
|
||||
double dParB ; pCrvB->GetParamAtLength( j * ( dLenRef / MAX_NUM_PT), dParB) ;
|
||||
Point3d ptB ; pCrvB->GetPointD1D2( dParB, ICurve::FROM_MINUS, ptB) ;
|
||||
// tra il 50% e 75%
|
||||
Point3d ptB_z = ptB ; ptB_z.Translate( - vtN * ( 0.25 * dStep) * ( 2.0 + ( 1. * j) / MAX_NUM_PT)) ;
|
||||
pCrvB_ZigZag->AddLine( ptB_z) ;
|
||||
// tra 75% e 100%
|
||||
Point3d ptB_z_I = ptB ; ptB_z_I.Translate( - vtN * ( 0.25 * dStep) * ( 4 - ( 1. * j) / MAX_NUM_PT)) ;
|
||||
pCrvB_ZigZag_I->AddLine( ptB_z_I) ;
|
||||
}
|
||||
|
||||
// semplifico le curve
|
||||
pCrvA_ZigZag->MergeCurves( 500 * EPS_SMALL, 500 * EPS_ANG_SMALL) ;
|
||||
pCrvA_ZigZag_I->MergeCurves( 500 * EPS_SMALL, 500 * EPS_ANG_SMALL) ;
|
||||
pCrvA_ZigZag_I->Invert() ; // altrimenti la curva salirebbe lungo vtN
|
||||
pCrvB_ZigZag->MergeCurves( 500 * EPS_SMALL, 500 * EPS_ANG_SMALL) ;
|
||||
pCrvB_ZigZag_I->MergeCurves( 500 * EPS_SMALL, 500 * EPS_ANG_SMALL) ;
|
||||
pCrvB_ZigZag_I->Invert() ; // altrimenti la curva salirebbe lungo vtN
|
||||
|
||||
// per ogni step copio le curve
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
if ( AddCurveMove( pCrvA_ZigZag, MCH_CL_LEADIN) == GDB_ID_NULL ||
|
||||
AddCurveMove( pCrvA_ZigZag_I, MCH_CL_LEADIN) == GDB_ID_NULL ||
|
||||
AddCurveMove( pCrvB_ZigZag, MCH_CL_LEADIN) == GDB_ID_NULL ||
|
||||
AddCurveMove( pCrvB_ZigZag_I, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// traslo per il percorso a ZigZag sottostante ( se ne ho uno)
|
||||
if ( i < nStep) {
|
||||
pCrvA_ZigZag->Translate( - vtN * dStep) ;
|
||||
pCrvA_ZigZag_I->Translate( - vtN * dStep) ;
|
||||
pCrvB_ZigZag->Translate( - vtN * dStep) ;
|
||||
pCrvB_ZigZag_I->Translate( - vtN * dStep) ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
nType = POCKET_LI_NONE ;
|
||||
if ( m_TParams.m_nType == TT_MILL_NOTIP)
|
||||
return false ;
|
||||
}
|
||||
// Se a scivolo e fattibile
|
||||
if ( nType == POCKET_LI_GLIDE) {
|
||||
|
||||
Reference in New Issue
Block a user