EgtGeomKernel :

- correzione alla IntersCrvCompoCrvCompo.
This commit is contained in:
Daniele Bariletti
2026-04-03 16:19:39 +02:00
parent 580230b38b
commit b4522c712d
+42 -21
View File
@@ -802,12 +802,19 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
INTVECTOR vNewOverlap ;
// salvo eventuali incoerenze col precedente
for ( int i = bCrvAClosed ? 0 : 1 ; i < m_nNumInters ; ++i) {
int j = i == 0 ? m_nNumInters - 1 : i - 1 ;
int kj = m_Info[j].bOverlap ? 1 : 0 ;
int j = ( i == 0 ? m_nNumInters - 1 : i - 1) ;
int kj = ( m_Info[j].bOverlap ? 1 : 0) ;
bool bSpike = m_Info[i].bOverlap && m_Info[j].bOverlap && m_Info[i].bCBOverEq != m_Info[j].bCBOverEq ;
if ( bSpike) {
bSpike = abs( m_Info[i].IciA[0].dU - m_Info[j].IciA[0].dU) < EPS_PARAM ||
abs( m_Info[i].IciA[0].dU - m_Info[j].IciA[1].dU) < EPS_PARAM ||
abs( m_Info[i].IciA[1].dU - m_Info[j].IciA[0].dU) < EPS_PARAM ||
abs( m_Info[i].IciA[1].dU - m_Info[j].IciA[1].dU) < EPS_PARAM ;
}
if ( (m_Info[j].IciA[kj].nNextTy == ICCT_NULL || m_Info[i].IciA[0].nPrevTy == ICCT_NULL || m_Info[j].IciA[kj].nNextTy != m_Info[i].IciA[0].nPrevTy) &&
m_Info[j].IciA[kj].nNextTy != ICCT_SPK && m_Info[i].IciA[0].nPrevTy != ICCT_SPK) {
vIncoherenceWithPrev.push_back( i) ;
if ( vIncoherenceWithPrev.empty() || vIncoherenceWithPrev.back() != i)
vIncoherenceWithPrev.push_back( i) ;
if ( bSpike) {
// se ho uno spike sistemo anche il successivo
int k = i == m_nNumInters - 1 ? -1 : i + 1 ;
@@ -823,8 +830,8 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
// incoerenze sulla curva A
if ( ! bCoherent) {
for ( int i : vIncoherenceWithPrev) {
int j = i == 0 ? m_nNumInters - 1 : i - 1 ;
int kj = m_Info[j].bOverlap ? 1 : 0 ;
int j = ( i == 0 ? m_nNumInters - 1 : i - 1) ;
int kj = ( m_Info[j].bOverlap ? 1 : 0) ;
int nType = 0 ;
CalcSide( j, i, &CCompoA, &CCompoB, true, nType) ;
if ( nType != ICCT_ON) {
@@ -846,16 +853,23 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
vIncoherenceWithPrev.clear() ;
// salvo eventuali incoerenze col precedente
for ( int i = bCrvBClosed ? 0 : 1 ; i < m_nNumInters ; ++i) {
int j = i == 0 ? m_nNumInters - 1 : i - 1 ;
int ki = m_Info[i].bOverlap && ! m_Info[i].bCBOverEq ? 1 : 0 ;
int kj = m_Info[j].bOverlap && m_Info[j].bCBOverEq ? 1 : 0 ;
int j = ( i == 0 ? m_nNumInters - 1 : i - 1) ;
int ki = ( m_Info[i].bOverlap && ! m_Info[i].bCBOverEq ? 1 : 0) ;
int kj = ( m_Info[j].bOverlap && m_Info[j].bCBOverEq ? 1 : 0) ;
bool bSpike = m_Info[i].bOverlap && m_Info[j].bOverlap && m_Info[i].bCBOverEq != m_Info[j].bCBOverEq ;
if ( bSpike) {
bSpike = abs( m_Info[i].IciA[0].dU - m_Info[j].IciA[0].dU) < EPS_PARAM ||
abs( m_Info[i].IciA[0].dU - m_Info[j].IciA[1].dU) < EPS_PARAM ||
abs( m_Info[i].IciA[1].dU - m_Info[j].IciA[0].dU) < EPS_PARAM ||
abs( m_Info[i].IciA[1].dU - m_Info[j].IciA[1].dU) < EPS_PARAM ;
}
if ( ( m_Info[j].IciB[kj].nNextTy == ICCT_NULL || m_Info[i].IciB[ki].nPrevTy == ICCT_NULL || m_Info[j].IciB[kj].nNextTy != m_Info[i].IciB[ki].nPrevTy) &&
m_Info[j].IciB[kj].nNextTy != ICCT_SPK && m_Info[i].IciB[ki].nPrevTy != ICCT_SPK) {
vIncoherenceWithPrev.push_back( i) ;
if ( vIncoherenceWithPrev.empty() || vIncoherenceWithPrev.back() != i)
vIncoherenceWithPrev.push_back( i) ;
if ( bSpike) {
// se ho uno spike sistemo anche il successivo
int k = i == m_nNumInters - 1 ? -1 : i + 1 ;
int k = ( i == m_nNumInters - 1 ? -1 : i + 1) ;
if ( k == -1 && bCrvBClosed)
k = 0 ;
@@ -868,9 +882,9 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
// incoerenze sulla curva B
if ( ! bCoherent) {
for ( int i : vIncoherenceWithPrev) {
int j = i == 0 ? m_nNumInters - 1 : i - 1 ;
int ki = m_Info[i].bOverlap && ! m_Info[i].bCBOverEq ? 1 : 0 ;
int kj = m_Info[j].bOverlap && m_Info[j].bCBOverEq ? 1 : 0 ;
int j = ( i == 0 ? m_nNumInters - 1 : i - 1) ;
int ki = ( m_Info[i].bOverlap && !m_Info[i].bCBOverEq ? 1 : 0) ;
int kj = ( m_Info[j].bOverlap && m_Info[j].bCBOverEq ? 1 : 0) ;
int nType = 0 ;
CalcSide( j, i, &CCompoB, &CCompoA, false, nType) ;
if ( nType != ICCT_ON) {
@@ -903,10 +917,10 @@ IntersCrvCompoCrvCompo::CalcSide( int j, int i,const ICurve* pThisCrv, const ICu
const IntCrvCrvInfo& Icci2 = m_Info[i] ;
// calcolo tra l'intersezione 1 e 2 se la curva sta dentro o fuori
int ki = 0 ;
int kj = Icci1.bOverlap ? 1 : 0 ;
int kj = ( Icci1.bOverlap ? 1 : 0) ;
if ( ! bCrvAOrB) {
ki = m_Info[i].bOverlap && ! m_Info[i].bCBOverEq ? 1 : 0 ;
kj = m_Info[j].bOverlap && m_Info[j].bCBOverEq ? 1 : 0 ;
ki = ( m_Info[i].bOverlap && !m_Info[i].bCBOverEq ? 1 : 0) ;
kj = ( m_Info[j].bOverlap && m_Info[j].bCBOverEq ? 1 : 0) ;
}
double dU = 0 ;
@@ -1045,8 +1059,11 @@ IntersCrvCompoCrvCompo::CalcSide( int j, int i,const ICurve* pThisCrv, const ICu
bool
IntersCrvCompoCrvCompo::MergeNewOverlap( int i, bool bCrvAOrB)
{
if ( i >= ssize(m_Info))
return false ;
// faccio il merge col precedente
int j = i == 0 ? m_nNumInters - 1 : i - 1 ;
int j = ( i == 0 ? m_nNumInters - 1 : i - 1) ;
if ( m_Info[j].bOverlap) {
m_Info[i].IciA[0] = m_Info[j].IciA[0] ;
m_Info[i].IciB[0] = m_Info[j].IciB[0] ;
@@ -1185,21 +1202,25 @@ SortGreaterB( const IntCrvCrvInfo& aInfo1, const IntCrvCrvInfo& aInfo2)
dU1 = aInfo1.IciB[0].dU ;
if ( aInfo1.bOverlap) {
// caso normale
if ( aInfo1.IciB[0].dU < aInfo1.IciB[1].dU)
if ( ( aInfo1.bCBOverEq && aInfo1.IciB[0].dU < aInfo1.IciB[1].dU) || ( ! aInfo1.bCBOverEq && aInfo1.IciB[0].dU > aInfo1.IciB[1].dU))
dU1 = 0.5 * ( aInfo1.IciB[0].dU + aInfo1.IciB[1].dU) ;
// a cavallo di fine / inizio
else
else if ( aInfo1.bCBOverEq)
dU1 = aInfo1.IciB[0].dU + SPAN_PARAM ;
else
dU1 = aInfo1.IciB[1].dU + SPAN_PARAM ;
}
// determino il secondo termine del confronto
dU2 = aInfo2.IciB[0].dU ;
if ( aInfo2.bOverlap) {
// caso normale
if ( aInfo2.IciB[0].dU < aInfo2.IciB[1].dU)
if ( ( aInfo2.bCBOverEq && aInfo2.IciB[0].dU < aInfo2.IciB[1].dU) || ( ! aInfo2.bCBOverEq && aInfo2.IciB[0].dU > aInfo2.IciB[1].dU))
dU2 = 0.5 * ( aInfo2.IciB[0].dU + aInfo2.IciB[1].dU) ;
// a cavallo di fine / inizio
else
else if ( aInfo2.bCBOverEq)
dU2 = aInfo2.IciB[0].dU + SPAN_PARAM ;
else
dU2 = aInfo2.IciB[1].dU + SPAN_PARAM ;
}
return ( dU2 > dU1 + EPS_PARAM) ;