diff --git a/EgtGeomKernel.vcxproj b/EgtGeomKernel.vcxproj
index e39d247..a83c0ba 100644
--- a/EgtGeomKernel.vcxproj
+++ b/EgtGeomKernel.vcxproj
@@ -325,6 +325,7 @@ copy $(TargetPath) \EgtProg\Dll64
+
@@ -490,6 +491,7 @@ copy $(TargetPath) \EgtProg\Dll64
+
diff --git a/EgtGeomKernel.vcxproj.filters b/EgtGeomKernel.vcxproj.filters
index 4d4b58d..e90a76d 100644
--- a/EgtGeomKernel.vcxproj.filters
+++ b/EgtGeomKernel.vcxproj.filters
@@ -354,6 +354,9 @@
File di origine\Geo
+
+ File di origine\GeoInters
+
@@ -776,6 +779,9 @@
File di intestazione
+
+ File di intestazione
+
diff --git a/IntersLineLine.cpp b/IntersLineLine.cpp
index 0254c80..7092c79 100644
--- a/IntersLineLine.cpp
+++ b/IntersLineLine.cpp
@@ -149,7 +149,7 @@ IntersLineLine::IntersFiniteLines( const ICurveLine& Line1, const ICurveLine& Li
// flag per linee parallele
bool bParallel = ( fabs( dCrossXY) < SIN_EPS_ANG_ZERO * ( dLen1XY * dLen2XY)) ;
// flag per segmenti che si allontanano significativamente
- bool bFarEnds = ( ( fabs( dCrossXY) > sin( 1 * DEGTORAD) * ( dLen1XY * dLen2XY)) ||
+ bool bFarEnds = ( ( fabs( dCrossXY) > SIN_EPS_ANG_SMALL * ( dLen1XY * dLen2XY)) ||
IsPointOutFatSegment( ptS1, ptS2, vtDir2, dLen2XY, EPS_SMALL) ||
IsPointOutFatSegment( ptE1, ptS2, vtDir2, dLen2XY, EPS_SMALL) ||
IsPointOutFatSegment( ptS2, ptS1, vtDir1, dLen1XY, EPS_SMALL) ||
diff --git a/RemoveCurveSpikes.cpp b/RemoveCurveSpikes.cpp
new file mode 100644
index 0000000..278fd03
--- /dev/null
+++ b/RemoveCurveSpikes.cpp
@@ -0,0 +1,74 @@
+//----------------------------------------------------------------------------
+// EgalTech 2017-2017
+//----------------------------------------------------------------------------
+// File : RemoveCurveSpikes.cpp Data : 02.10.17 Versione : 1.8j1
+// Contenuto : Implementazione rimozione spikes di curva.
+//
+//
+//
+// Modifiche : 02.10.17 DS Creazione modulo.
+//
+//
+//----------------------------------------------------------------------------
+
+//--------------------------- Include ----------------------------------------
+#include "stdafx.h"
+#include "GeoConst.h"
+#include "CurveComposite.h"
+#include "DistPointLine.h"
+#include "RemoveCurveSpikes.h"
+#include
+
+using namespace std ;
+
+//----------------------------------------------------------------------------
+bool
+RemoveCurveSpikes( ICurveComposite* pCurve)
+{
+ // verifico validità curva
+ if ( pCurve == nullptr)
+ return false ;
+ // recupero il numero di curve semplici componenti la composta
+ int nCrvCount = pCurve->GetCurveCount() ;
+ if ( nCrvCount < 2 || ( nCrvCount < 3 && pCurve->IsClosed()))
+ return true ;
+ // ciclo sulle curve elementari della composita
+ int nStart = pCurve->IsClosed() ? 0 : 1 ;
+ for ( int i = nStart ; i < nCrvCount ; ++ i) {
+ // recupero due curve consecutive
+ const ICurve* pPrevCrv = pCurve->GetCurve( ( i > 0 ? i - 1 : nCrvCount - 1)) ;
+ const ICurve* pNextCrv = pCurve->GetCurve( i) ;
+ // se sono entrambe rette
+ if ( pPrevCrv->GetType() == CRV_LINE && pNextCrv->GetType() == CRV_LINE) {
+ // recupero i punti estremi
+ Point3d ptStart ; pPrevCrv->GetStartPoint( ptStart) ;
+ Point3d ptMid ; pPrevCrv->GetEndPoint( ptMid) ;
+ Point3d ptEnd ; pNextCrv->GetEndPoint( ptEnd) ;
+ // recupero le direzioni negli estremi
+ Vector3d vtPrev ; pPrevCrv->GetStartDir( vtPrev) ;
+ Vector3d vtNext ; pNextCrv->GetStartDir( vtNext) ;
+ // verifico se spike
+ double dPrevDist, dNextDist ;
+ if ( vtPrev * vtNext < cos( 175 * DEGTORAD) &&
+ (( DistPointLine( ptStart, ptMid, ptEnd).GetDist( dPrevDist) && dPrevDist < EPS_SMALL) ||
+ ( DistPointLine( ptEnd, ptStart, ptMid).GetDist( dNextDist) && dNextDist < EPS_SMALL))) {
+ // se spike ha base abbastanza larga, basta togliere uno dei due lati
+ if ( SqDist( ptStart, ptEnd) > SQ_EPS_SMALL) {
+ pCurve->RemoveJoint( i) ;
+ -- nCrvCount ;
+ -- i ;
+ }
+ // altrimenti bisogna togliere entrambi
+ else {
+ pCurve->RemoveJoint( i - 1) ;
+ pCurve->RemoveJoint( i) ;
+ nCrvCount -= 2 ;
+ i = max( i - 2, nStart - 1) ;
+ }
+ }
+ }
+ // !!! Aggiungere la gestione degli altri tipi di curve !!!
+ }
+
+ return true ;
+}
\ No newline at end of file
diff --git a/RemoveCurveSpikes.h b/RemoveCurveSpikes.h
new file mode 100644
index 0000000..e301a6b
--- /dev/null
+++ b/RemoveCurveSpikes.h
@@ -0,0 +1,20 @@
+//----------------------------------------------------------------------------
+// EgalTech 2017-2017
+//----------------------------------------------------------------------------
+// File : RemoveCurveSpikes.h Data : 02.10.17 Versione : 1.8j1
+// Contenuto : Dichiarazione funzione rimozione spikes curve.
+//
+//
+//
+// Modifiche : 02.10.17 DS Creazione modulo.
+//
+//
+//----------------------------------------------------------------------------
+
+#pragma once
+
+#include "/EgtDev/Include/EGkCurveComposite.h"
+
+
+//----------------------------------------------------------------------------
+bool RemoveCurveSpikes( ICurveComposite* pCurve) ;
diff --git a/SurfFlatRegion.cpp b/SurfFlatRegion.cpp
index 37ca734..22f9d04 100644
--- a/SurfFlatRegion.cpp
+++ b/SurfFlatRegion.cpp
@@ -20,6 +20,7 @@
#include "CurveAux.h"
#include "CurveComposite.h"
#include "RemoveCurveOverlaps.h"
+#include "RemoveCurveSpikes.h"
#include "GeoConst.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkUiUnits.h"
@@ -97,10 +98,14 @@ SurfFlatRegion::AddExtLoop( ICurve* pCrv)
// aggiungo le singole curve
bool bOk = true ;
for ( auto& pCrv : CrvLst) {
- // se curva composita, unisco eventuali tratti allineati
+ // se curva composita
CurveComposite* pCrvCo = GetBasicCurveComposite( pCrv) ;
- if ( pCrvCo != nullptr)
+ if ( pCrvCo != nullptr) {
+ // unisco eventuali tratti allineati
pCrvCo->MergeCurves( LIN_TOL_MIN, ANG_TOL_STD_DEG) ;
+ // elimino eventuali spikes
+ RemoveCurveSpikes( pCrvCo) ;
+ }
// aggiungo il loop
if ( ! AddSimpleExtLoop( pCrv))
bOk = false ;
@@ -239,10 +244,14 @@ SurfFlatRegion::AddIntLoop( ICurve* pCrv)
// aggiungo le singole curve
bool bOk = true ;
for ( auto& pCrv : CrvLst) {
- // se curva composita, unisco eventuali tratti allineati
+ // se curva composita
CurveComposite* pCrvCo = GetBasicCurveComposite( pCrv) ;
- if ( pCrvCo != nullptr)
+ if ( pCrvCo != nullptr) {
+ // unisco eventuali tratti allineati
pCrvCo->MergeCurves( LIN_TOL_MIN, ANG_TOL_STD_DEG) ;
+ // elimino eventuali spikes
+ RemoveCurveSpikes( pCrvCo) ;
+ }
// aggiungo il loop
if ( ! AddSimpleIntLoop( pCrv))
bOk = false ;