EgtGeomKernel :

- corretto GetBBox di SurfFlatRegion con più parti
- in OffsetCurve migliorato Migliorato angoli esterni di valore circa 180deg.
This commit is contained in:
Dario Sassi
2023-08-03 17:32:05 +02:00
parent c4a4da6945
commit 238c0ae490
2 changed files with 23 additions and 8 deletions
+22 -7
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2020
// EgalTech 2015-2023
//----------------------------------------------------------------------------
// File : OffsetCurve.cpp Data : 10.10.20 Versione : 2.2j2
// File : OffsetCurve.cpp Data : 03.08.23 Versione : 2.5h1
// Contenuto : Classe per offset avanzato di Curve.
//
//
@@ -9,6 +9,7 @@
// Modifiche : 23.09.15 DS Creazione modulo.
// 24.06.19 DS Agg. GetShorterCurve.
// 10.10.20 DS Migliorata gestione angoli interni.
// 03.08.23 DS Migliorato riconoscimento angoli esterni di valore circa 180deg.
//
//----------------------------------------------------------------------------
@@ -865,16 +866,30 @@ CalcAngle( const ICurve* pCrv1, const ICurve* pCrv2, double& dAngDeg)
if ( ! vtDir1.GetAngleXY( vtDir2, dAngDeg))
return false ;
// se vicino all'angolo piatto, si devono ricalcolare spostandosi un poco
if ( abs( dAngDeg) > ( ANG_STRAIGHT - EPS_ANG_SMALL)) {
// eseguo calcolo spostato
const double MAX_ANG_DELTA = 2 ;
double dAngDelta = abs( abs( dAngDeg) - ANG_STRAIGHT) ;
if ( dAngDelta < MAX_ANG_DELTA) {
// angolo al centro delle curve
double dAngCen1 = 0 ;
if ( pCrv1->GetType() == CRV_ARC)
dAngCen1 = abs( GetBasicCurveArc( pCrv1)->GetAngCenter()) ;
double dAngCen2 = 0 ;
if ( pCrv2->GetType() == CRV_ARC)
dAngCen2 = abs( GetBasicCurveArc( pCrv2)->GetAngCenter()) ;
// determino posizioni spostate
double dU1 = 1 ;
if ( dAngCen1 > EPS_ANG_SMALL) {
dU1 = 1 - min( 1.1 * dAngDelta / ( dAngCen1 + dAngCen2), 0.5) ;
}
double dU2 = 0 ;
if ( dAngCen2 > EPS_ANG_SMALL) {
dU2 = 0 + min( 1.1 * dAngDelta / ( dAngCen1 + dAngCen2), 0.5) ;
}
// eseguo calcolo spostato
Point3d ptDummy ;
Vector3d vtDir1b ;
Vector3d vtDir2b ;
if ( ! MoveParamToAvoidTg( dU1, ICurve::FROM_MINUS, *pCrv1) ||
! pCrv1->GetPointTang( dU1, ICurve::FROM_MINUS, ptDummy, vtDir1b) ||
! MoveParamToAvoidTg( dU2, ICurve::FROM_PLUS, *pCrv2) ||
if ( ! pCrv1->GetPointTang( dU1, ICurve::FROM_MINUS, ptDummy, vtDir1b) ||
! pCrv2->GetPointTang( dU2, ICurve::FROM_PLUS, ptDummy, vtDir2b))
return false ;
if ( ! vtDir1b.GetAngleXY( vtDir2b, dAngDeg))
+1 -1
View File
@@ -597,7 +597,7 @@ SurfFlatRegion::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
// è il bounding box dei loop esterni
for ( auto i : m_vExtInd) {
BBox3d b3Tmp ;
if ( m_vpLoop[i]->GetBBox( frCompo, b3Ref, nFlag))
if ( m_vpLoop[i]->GetBBox( frCompo, b3Tmp, nFlag))
b3Ref.Add( b3Tmp) ;
}
return ( ! b3Ref.IsEmpty()) ;