EgtGeomKernel 1.5f6 :
- agg. intersezione linee-linee - agg. alle curve metodi per passare da lunghezza a parametro e viceversa - agg. metodi per creare curve composite come poligoni regolari - corr. errore in triangulate con contorni CW - agg. opportune funzioni a TSC.
This commit is contained in:
+19
-7
@@ -1,13 +1,13 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Triangulate.cpp Data : 08.04.14 Versione : 1.5d2
|
||||
// File : Triangulate.cpp Data : 23.06.14 Versione : 1.5f6
|
||||
// Contenuto : Implementazione della classe Triangulate.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 08.04.14 DS Creazione modulo.
|
||||
//
|
||||
// 23.06.14 DS Corretto errore con contorni CW.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "\EgtDev\Include\EGkPolyLine.h"
|
||||
#include "\EgtDev\Include\EGkPlane3d.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// In : PolyLine
|
||||
// Out : PNTVECTOR (Point3d Vector) : points of the polyline
|
||||
@@ -71,8 +73,18 @@ Triangulate::Make( const PolyLine& PL, PNTVECTOR& vPt, INTVECTOR& vTr)
|
||||
vPol.push_back( i) ;
|
||||
}
|
||||
|
||||
// eseguo la triangolazione
|
||||
return MakeByEC2( vPt, vPol, vTr) ;
|
||||
// eseguo la triangolazione
|
||||
if ( ! MakeByEC2( vPt, vPol, vTr))
|
||||
return false ;
|
||||
|
||||
// se era CW, devo invertire il senso dei triangoli
|
||||
if ( ! bCCW) {
|
||||
int nSize = int( vTr.size()) ;
|
||||
for ( int i = 0 ; i < nSize / 2 ; ++ i)
|
||||
swap( vTr[i], vTr[nSize-i-1]) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -205,10 +217,10 @@ Triangulate::MakeByEC2( const PNTVECTOR& vPt, const INTVECTOR& vPol, INTVECTOR&
|
||||
if ( TestTriangle( vPt, vPol, vPrev, vNext, k))
|
||||
dSqDist2 = SqDist( vPt[vPol[vPrev[k]]], vPt[vPol[vNext[k]]]) ;
|
||||
}
|
||||
// Choose the better
|
||||
if ( dSqDist <= dSqDist1 && dSqDist <= dSqDist2)
|
||||
// Choose the better (EPS_ZERO to have a difference)
|
||||
if ( dSqDist < dSqDist1 + EPS_ZERO && dSqDist < dSqDist2 + EPS_ZERO)
|
||||
; // i is the better
|
||||
else if ( dSqDist1 <= dSqDist2)
|
||||
else if ( dSqDist1 < dSqDist2 + EPS_ZERO)
|
||||
i = j ;
|
||||
else
|
||||
i = k ;
|
||||
|
||||
Reference in New Issue
Block a user