Merge commit 'a98b6bcc09a707b1c42a025b8e85a85801465f08'

This commit is contained in:
Dario Sassi
2024-10-02 17:26:01 +02:00
+37 -10
View File
@@ -1845,12 +1845,10 @@ GetSinglePocketingCurves( ISurfFlatRegion* pSfr, const PocketParams& PockParams,
int nChunks = pSfr->GetChunkCount() ;
int nCurrChunk = 0 ;
for ( int i = 0 ; i < nChunks ; ++ i) {
// recupero il Chunk corrente
PtrOwner<ISurfFlatRegion> pSfrChunk( pSfr->CloneChunk( nCurrChunk)) ;
if ( IsNull( pSfrChunk) || ! pSfrChunk->IsValid())
return false ;
// se il Chunk corrente si svuota con curva singola, allora lo rimuovo dalla superficie
bool bRemoved = false ;
GetPocketCurvesByClosedEdges( pSfrChunk, PockParams, vCrvSingleCurves, bRemoved) ;
@@ -1873,7 +1871,27 @@ GetSinglePocketingCurves( ISurfFlatRegion* pSfr, const PocketParams& PockParams,
/*
Idea : Feed proporzionale al minimo Offset per annullare la regione
-> Massimo parametro sui bisettori di VORONOI
se le curve risultano aperte, cambio il loro punto iniziale a seconda dell'estensione fatta
*/
if ( vCrvSingleCurves[i]->IsValid() && vCrvSingleCurves[i]->GetCurveCount() != 0 &&
! vCrvSingleCurves[i]->IsClosed()) {
int nTempProp_firstCrv = vCrvSingleCurves[i]->GetFirstCurve()->GetTempProp( 0) ;
int nTempProp_lastCrv = vCrvSingleCurves[i]->GetLastCurve()->GetTempProp( 0) ;
// se estremi entrambi estesi
if ( nTempProp_firstCrv == TEMP_PROP_OUT_START && nTempProp_lastCrv == TEMP_PROP_OUT_START) {
if ( PockParams.ptStart.IsValid()) {
Point3d ptStart ; vCrvSingleCurves[i]->GetStartPoint( ptStart) ;
double dSqDist_first = SqDist( PockParams.ptStart, ptStart) ;
Point3d ptEnd ; vCrvSingleCurves[i]->GetEndPoint( ptEnd) ;
double dSqDist_last = SqDist( PockParams.ptStart, ptEnd) ;
if ( dSqDist_last < dSqDist_first)
vCrvSingleCurves[i]->Invert() ;
}
}
// se invece l'estensione è alla fine
else if ( nTempProp_lastCrv == TEMP_PROP_OUT_START)
vCrvSingleCurves[i]->Invert() ;
}
// recupero il MaxOffset per la curva
double dMaxOffs = vCrvSingleCurves[i]->GetTempParam( 0) ;
// calcolo la Feed proporzionale a tale Offset
@@ -6704,6 +6722,17 @@ AddOneWay( ISurfFlatRegion* pSrfPock, const ISurfFlatRegion* pSfrOrig, PocketPar
pCrvSegCompo->AddCurve( Release( pCrvSeg)) ;
// calcolo la Feed
AssignFeedZigZagOneWay( pCrvSegCompo, false, vCrvNull, vLineUnder, vCrvCompoNull, PockParams) ;
// estendo presso lati aperti se richiesto
if ( ! PockParams.bAllClosed) {
Vector3d vtRef ; pCrvSegCompo->GetStartDir( vtRef) ;
vtRef.Invert() ;
bool bIsExtended = false ;
if ( ! ExtendPath( pCrvSegCompo, pSfrOrig, PockParams, vtRef, false,bIsExtended))
return false ;
pCrvSegCompo->GetEndDir( vtRef) ;
if ( ! ExtendPath( pCrvSegCompo, pSfrOrig, PockParams, vtRef, true, bIsExtended))
return false ;
}
vCrvCompoRes.emplace_back( Release( pCrvSegCompo)) ;
}
}
@@ -8125,11 +8154,10 @@ AddConformal( ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrOrig,
aperti mediante Offset di tipo Chamfer; in questo modo semplifico la classificazione
*/
PtrOwner<ISurfFlatRegion> pSfrClass( pSfrPock->CreateOffsetSurf( - ( 3. * PockParams.dRad / 4.) - PockParams.dRadialOffset, ICurve::OFF_FILLET)) ;
if ( IsNull( pSfrClass) || ! pSfrClass->IsValid())
return false ;
// recupero la dimensione del vettore delle curve da resituire ( nel caso dovessi lavorare in SPIRAL_IN)
int nDim = int( vCrvCompoRes.size()) ;
if ( IsNull( pSfrClass))
return false ;
if ( ! pSfrClass->IsValid())
return true ; // non posso svuotare nulla
// scorro i chunk della superficie da lavorare
for ( int nC = 0 ; nC < pSfrPock->GetChunkCount() ; ++ nC) {
@@ -8169,9 +8197,8 @@ AddConformal( ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrOrig,
return false ;
// se non ottengo Curve di Offset, lavoro in SpiralIn ( il Chunk ha dei lati aperti)
if ( vvCrvOffs.empty()) {
vCrvCompoRes.resize( nDim) ; // pulisco il vettore di curve
// NB. Facendo un offset interno di 3R/4 potrebbero essersi splittati dei Chunks
return ( AddSpiralIn( pSfrPock, pSfrOrig, PockParams, vCrvCompoRes)) ;
if ( ! AddSpiralIn( pSfrChunk, pSfrOrig, PockParams, vCrvCompoRes))
return false ;
}
else {
// definisco vettore degli Offset e dei Link