EgtGeomKernel 2.4b2 :

- in chiusura di Curva Composita con estremi più vicini di 10*EPS_SMALL si spostano gli estremi a metà strada
- in creazione FlatRegion da FatCurve migliorata gestione curve quasi chiuse.
This commit is contained in:
DarioS
2022-02-20 19:31:03 +01:00
parent 899e371c52
commit f43951a9e2
3 changed files with 31 additions and 13 deletions
+16 -5
View File
@@ -255,14 +255,25 @@ CurveComposite::Close( void)
// se già chiusa, non faccio alcunché
if ( IsClosed())
return true ;
// aggiungo la linea di chiusura
PtrOwner<CurveLine> pLine( CreateBasicCurveLine()) ;
// determino la distanza tra gli estremi
Point3d ptStart, ptEnd ;
if ( ! GetStartPoint( ptStart) ||
! GetEndPoint( ptEnd) ||
! pLine->Set( ptEnd, ptStart) ||
! AddSimpleCurve( Release( pLine)))
! GetEndPoint( ptEnd))
return false ;
// se molto vicini li modifico
if ( SqDist( ptStart, ptEnd) < 100 * SQ_EPS_SMALL) {
Point3d ptMid = Media( ptStart, ptEnd) ;
if ( ! ModifyStart( ptMid) ||
! ModifyEnd( ptMid))
return false ;
}
// altrimenti aggiungo la linea di chiusura
else {
PtrOwner<CurveLine> pLine( CreateBasicCurveLine()) ;
if ( ! pLine->Set( ptEnd, ptStart) ||
! AddSimpleCurve( Release( pLine)))
return false ;
}
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
BIN
View File
Binary file not shown.
+15 -8
View File
@@ -136,14 +136,21 @@ GetSurfFlatRegionFromFatCurve( ICurve* pCrv, double dRadius, bool bSquareEnds, b
pCompo1->GetEndPoint( ptEnd) ;
pCompo1->GetEndDir( vtEnd) ;
pCompo1->GetMidPoint( ptMid) ;
if ( Dist( ptStart, ptEnd) <= 2 * dRadius && Dist( ptStart, ptMid) > 2 * dRadius && Dist( ptEnd, ptMid) > 2 * dRadius) {
double dAngEnd ; vtEnd.ToSpherical( nullptr, nullptr, &dAngEnd) ;
double dAngStart ; vtStart.ToSpherical( nullptr, nullptr, &dAngStart) ;
PtrOwner<ICurve> pClose( GetBiArc( ptEnd, dAngEnd, ptStart, dAngStart, 0.5)) ;
if ( ! IsNull( pClose))
pCompo1->AddCurve( Release( pClose)) ;
else
pCompo1->Close() ;
if ( AreSamePointEpsilon( ptStart, ptEnd, 2 * dRadius) && Dist( ptStart, ptMid) > 2 * dRadius && Dist( ptEnd, ptMid) > 2 * dRadius) {
if ( AreSamePointEpsilon( ptStart, ptEnd, max( 0.1 * dRadius, 10 * EPS_SMALL))) {
Point3d ptNew = Media( ptStart, ptEnd) ;
pCompo1->ModifyStart( ptNew) ;
pCompo1->ModifyEnd( ptNew) ;
}
else {
double dAngEnd ; vtEnd.ToSpherical( nullptr, nullptr, &dAngEnd) ;
double dAngStart ; vtStart.ToSpherical( nullptr, nullptr, &dAngStart) ;
PtrOwner<ICurve> pClose( GetBiArc( ptEnd, dAngEnd, ptStart, dAngStart, 0.5)) ;
if ( ! IsNull( pClose))
pCompo1->AddCurve( Release( pClose)) ;
else
pCompo1->Close() ;
}
}
// tipo di offset
int nOffsType = ( bSquareMids ? ICurve::OFF_EXTEND : ICurve::OFF_FILLET) ;