EgtGeomKernel 2.2b2 :

- corretta OffsetCurveOnX per tratti orizzontali più corti dell'offset.
This commit is contained in:
Dario Sassi
2020-02-13 11:32:00 +00:00
parent 93db8d6b72
commit 49f957ced5
2 changed files with 18 additions and 27 deletions
BIN
View File
Binary file not shown.
+18 -27
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2016-2016
// EgalTech 2016-2020
//----------------------------------------------------------------------------
// File : OffsetCurveOnX.cpp Data : 02.04.16 Versione : 1.6o4
// File : OffsetCurveOnX.cpp Data : 13.02.20 Versione : 2.2b2
// Contenuto : Classe per offset di Curve lungo la sola X.
//
//
@@ -17,8 +17,8 @@
#include "CurveLine.h"
#include "CurveArc.h"
#include "GeoConst.h"
#include "/EgtDev/Include/EgkOffsetCurveOnX.h"
#include "/EgtDev/Include/EgkIntersCurves.h"
#include "/EgtDev/Include/EGkOffsetCurveOnX.h"
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <algorithm>
@@ -107,30 +107,20 @@ OffsetCurveOnX::Make( const ICurve* pCrv, double dDist)
return false ;
// indice della prima curva (1-based, per poter assegnare un significato al segno)
int nInd1 = 1 ;
// recupero la prima curva e la processo
// recupero la prima curva
PtrOwner<ICurve> pCrv1( ccCopy2.RemoveFirstOrLastCurve( false)) ;
if ( IsNull( pCrv1))
return false ;
// eseguo semplice offset orizzontale
pCrv1->SetTempProp( nInd1) ;
SimpleOffsetOnX( pCrv1, dDist) ;
// curve successive
PtrOwner<ICurve> pCrv2( ccCopy2.RemoveFirstOrLastCurve( false)) ;
while ( ! IsNull( pCrv2)) {
// eseguo semplice offset
pCrv2->SetTempProp( nInd1 + 1) ;
SimpleOffsetOnX( pCrv2, dDist) ;
// metto in lista curva precedente
m_CrvLst.push_back( Release( pCrv1)) ;
// aggiorno curva precedente
++ nInd1 ;
pCrv1.Set( Release( pCrv2)) ;
while ( ! IsNull( pCrv1)) {
// eseguo semplice offset orizzontale
pCrv1->SetTempProp( nInd1) ;
if ( SimpleOffsetOnX( pCrv1, dDist))
// metto in lista
m_CrvLst.push_back( Release( pCrv1)) ;
// passo alla curva successiva
pCrv2.Set( ccCopy2.RemoveFirstOrLastCurve( false)) ;
pCrv1.Set( ccCopy2.RemoveFirstOrLastCurve( false)) ;
++ nInd1 ;
}
// Metto in lista l'ultima curva rimasta
if ( ! IsNull( pCrv1))
m_CrvLst.push_back( Release( pCrv1)) ;
if ( m_CrvLst.empty())
return false ;
// Secondo passo : taglio angoli tipo interni
ICurve* pPrev = nullptr ;
@@ -387,8 +377,9 @@ SimpleOffsetOnX( ICurve* pCrv, double dDist)
Point3d ptStart, ptEnd ;
pCrv->GetStartPoint( ptStart) ;
pCrv->GetEndPoint( ptEnd) ;
if ( abs( ptStart.y - ptEnd.y) < EPS_SMALL)
;
if ( abs( ptStart.y - ptEnd.y) < EPS_SMALL) {
return ( abs( ptStart.x - ptEnd.x) > dDist) ;
}
else if ( ptStart.y < ptEnd.y)
pCrv->Translate( Vector3d( dDist, 0, 0)) ;
else