EgtGeomKernel :

- rimosso flag di debug.
This commit is contained in:
Daniele Bariletti
2026-04-27 15:03:49 +02:00
parent a55770d702
commit 2b1d2a512d
+51 -51
View File
@@ -63,7 +63,7 @@
#define DEBUG_EDGES 0
#define DEBUG_SHAPE_STM 0
#define DEBUG_HOLES 0
#define DEBUG_SMOOTH_CURVATURE 1
#define DEBUG_SMOOTH_CURVATURE 0
#if DEBUG_BASIC_BORDERS || DEBUG_CHAIN_CURVES || DEBUG_ANG_APPROX || DEBUG_BEZIER_INTERP || \
DEBUG_FACE_SEARCH || DEBUG_FACE_SEARCH_TRIA_MODIF || DEBUG_BRK_POINTS || DEBUG_BRK_THICK || \
DEBUG_BRK || DEBUG_BORDERS_BY_NORMALS || DEBUG_SYNC_POINTS || DEBUG_SYNC_INTERPOLATION || \
@@ -4938,55 +4938,55 @@ FillPntInfo( const PNTVECTOR& vPnt, const ICurveComposite* pCC, PNTINFOVECTOR& v
return true ;
}
////------------------------------------------------------------------------------
//static bool
//RemoveInflexionPoints( PNTVECTOR& vPnt, PNTINFOVECTOR& vPntInfo, PNTINFOVECTOR& vPntRefInfo)
//{
// // se trovo tre punti di fila che sono dallo stesso lato, opposto a quello degli altri punti attorno, allora cerco di spostarli lungo la
// // normale alla superficie in modo da evitare cambi di concavità
// bool bSameSideAsPrev = true ;
// for ( int i = 2 ; i < ssize( vPntInfo) - 2 ; ++i) {
// int nPrev = vPntInfo[i-1].dDist < EPS_ZERO ? i - 2 : i - 1 ;
// double dProj = vPntInfo[i].vtPos * vPntInfo[nPrev].vtPos ;
// bSameSideAsPrev = vPntInfo[i].dDist < EPS_ZERO || dProj >= 0 ;
// if ( ! bSameSideAsPrev) {
// // devo verificare anche che sia diverso anche dal successivo ( o dal quello dopo ancora, se il successivo sta sulla curva)
// bool bCurrOrPrev = vPntInfo[i+1].dDist < EPS_ZERO ;
// int nFirst, nSecond, nThird ;
// if ( bCurrOrPrev) {
// nFirst = i ;
// nSecond = i + 1 ;
// nThird = i + 2 ;
// }
// else {
// nFirst = i - 2 ;
// nSecond = i - 1 ;
// nThird = i ;
// }
// int nNext = bCurrOrPrev ? i + 2 : i + 1 ;
// // se il successivo è diverso ho un terzetto anomalo da aggiustare
// // altrimenti ho un cambio naturale di concavità
// if ( vPntInfo[i].vtPos * vPntInfo[nNext].vtPos < 0) {
// // ruoto il terzetto fino a matchare la tangente sull'altra curva
// Vector3d vtCurr = vPntInfo[nNext].pt - vPntInfo[i].pt ;
// Vector3d vtRef = vPntRefInfo[nNext].pt - vPntRefInfo[i].pt ;
// Vector3d vtAx = vPntRefInfo[nSecond].pt - vPntInfo[nSecond].pt ;
// bool bDet = false ;
// double dAng = 0 ; vtCurr.GetRotation(vtRef, vtAx, dAng, bDet) ;
// if ( dAng > 170) {
// dAng = 180 - dAng ;
// // devo capire quale delle due curve ha i punti di controllo incrociati (come conseguenza della correzione precedente) e rimediare
// // DA IMPLEMENTARE, eventualmente
// }
//
// vPnt[nFirst].Rotate( vPnt[nSecond], vtAx, dAng) ;
// vPnt[nThird].Rotate( vPnt[nSecond], vtAx, dAng) ;
// if ( bCurrOrPrev)
// i += 2 ;
// }
// }
// }
//}
//------------------------------------------------------------------------------
static bool
RemoveInflexionPoints( PNTVECTOR& vPnt, PNTINFOVECTOR& vPntInfo, PNTINFOVECTOR& vPntRefInfo)
{
// se trovo tre punti di fila che sono dallo stesso lato, opposto a quello degli altri punti attorno, allora cerco di spostarli lungo la
// normale alla superficie in modo da evitare cambi di concavità
bool bSameSideAsPrev = true ;
for ( int i = 2 ; i < ssize( vPntInfo) - 2 ; ++i) {
int nPrev = vPntInfo[i-1].dDist < EPS_ZERO ? i - 2 : i - 1 ;
double dProj = vPntInfo[i].vtPos * vPntInfo[nPrev].vtPos ;
bSameSideAsPrev = vPntInfo[i].dDist < EPS_ZERO || dProj >= 0 ;
if ( ! bSameSideAsPrev) {
// devo verificare anche che sia diverso anche dal successivo ( o dal quello dopo ancora, se il successivo sta sulla curva)
bool bCurrOrPrev = vPntInfo[i+1].dDist < EPS_ZERO ;
int nFirst, nSecond, nThird ;
if ( bCurrOrPrev) {
nFirst = i ;
nSecond = i + 1 ;
nThird = i + 2 ;
}
else {
nFirst = i - 2 ;
nSecond = i - 1 ;
nThird = i ;
}
int nNext = bCurrOrPrev ? i + 2 : i + 1 ;
// se il successivo è diverso ho un terzetto anomalo da aggiustare
// altrimenti ho un cambio naturale di concavità
if ( vPntInfo[i].vtPos * vPntInfo[nNext].vtPos < 0) {
// ruoto il terzetto fino a matchare la tangente sull'altra curva
Vector3d vtCurr = vPntInfo[nNext].pt - vPntInfo[i].pt ;
Vector3d vtRef = vPntRefInfo[nNext].pt - vPntRefInfo[i].pt ;
Vector3d vtAx = vPntRefInfo[nSecond].pt - vPntInfo[nSecond].pt ;
bool bDet = false ;
double dAng = 0 ; vtCurr.GetRotation(vtRef, vtAx, dAng, bDet) ;
if ( dAng > 170) {
dAng = 180 - dAng ;
// devo capire quale delle due curve ha i punti di controllo incrociati (come conseguenza della correzione precedente) e rimediare
// DA IMPLEMENTARE, eventualmente
}
vPnt[nFirst].Rotate( vPnt[nSecond], vtAx, dAng) ;
vPnt[nThird].Rotate( vPnt[nSecond], vtAx, dAng) ;
if ( bCurrOrPrev)
i += 2 ;
}
}
}
}
//------------------------------------------------------------------------------
// Funzione per la regolarizzazione delle curve di bordo di una lavorazione di trim
@@ -5135,7 +5135,7 @@ RegolarizeBordersLocally( const ISurfBezier* pSurfBz, const BIPOINT& bpIsoStart,
FillPntInfo( vPnt0, pCC1, vPntInfo1) ;
FillPntInfo( vPnt1, pCC2, vPntInfo2) ;
//RemoveInflexionPoints( ) ;
RemoveInflexionPoints( ) ;
// se trovo tre punti di fila che sono dallo stesso lato, opposto a quello degli altri punti attorno, allora cerco di spostarli lungo la
// normale alla superficie in modo da evitare cambi di concavità