EgtGeomKernel 1.5f7 :
- aggiunta intersezione tra curve composte (e gestione loro topologia) - corretto salvataggio entità testo - aggiunto EPS_SMALL a test su box - aggiunte funzioni di verifica validità e tipo parametro di curve - aggiunto comando TSC OUTTEXTICCI.
This commit is contained in:
+263
-131
@@ -18,7 +18,24 @@
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IntersLineLine::IntersLineLine( const ICurveLine& Line1, const ICurveLine& Line2, bool bFinites)
|
||||
// Il punto è esterno al FatSegment se dista da questo più di Tol e la sua proiezione sta sul segmento
|
||||
bool
|
||||
IsPointOutFatSegment( const Point3d& ptP, const Point3d& ptS, const Vector3d& vtDir, double dLenXY, double dTol)
|
||||
{
|
||||
// distanza del punto dalla linea del segmento
|
||||
if ( fabs( CrossXY( ( ptP - ptS), vtDir)) < dTol * dLenXY)
|
||||
return false ;
|
||||
// distanza con segno della proiezione del punto sul segmento dall'inizio per lunghezza segmento
|
||||
double dDistXY = ScalarXY( ( ptP - ptS), vtDir) ;
|
||||
// se il punto non si proietta sul segmento entro la tolleranza
|
||||
if ( dDistXY < - dTol * dLenXY || dDistXY > ( dLenXY + dTol) * dLenXY)
|
||||
return false ;
|
||||
// altrimenti
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IntersLineLine::IntersLineLine( const ICurveLine& Line1, const ICurveLine& Line2, bool bFinite)
|
||||
{
|
||||
// Le intersezioni sono calcolate nel piano XY locale.
|
||||
|
||||
@@ -30,149 +47,252 @@ IntersLineLine::IntersLineLine( const ICurveLine& Line1, const ICurveLine& Line2
|
||||
if ( ! Line1.IsValid() || ! Line2.IsValid())
|
||||
return ;
|
||||
|
||||
// linea 1 : pto Start e direzione
|
||||
// se sono linee (infinite)
|
||||
if ( ! bFinite)
|
||||
IntersInfiniteLines( Line1, Line2) ;
|
||||
else
|
||||
IntersFiniteLines( Line1, Line2) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
IntersLineLine::IntersInfiniteLines( const ICurveLine& Line1, const ICurveLine& Line2)
|
||||
{
|
||||
// linea 1 : Start, End, Direzione e Lunghezza
|
||||
Point3d ptS1 = Line1.GetStart() ;
|
||||
Vector3d vtDir1 = Line1.GetEnd() - ptS1 ;
|
||||
// linea 2 : pto Start e direzione
|
||||
Point3d ptE1 = Line1.GetEnd() ;
|
||||
Vector3d vtDir1 = ptE1 - ptS1 ;
|
||||
double dLen1XY = vtDir1.LenXY() ;
|
||||
if ( dLen1XY < EPS_SMALL)
|
||||
return ;
|
||||
// linea 2 : Start, Direzione e Lunghezza
|
||||
Point3d ptS2 = Line2.GetStart() ;
|
||||
Vector3d vtDir2 = Line2.GetEnd() - ptS2 ;
|
||||
Point3d ptE2 = Line2.GetEnd() ;
|
||||
Vector3d vtDir2 = ptE2 - ptS2 ;
|
||||
double dLen2XY = vtDir2.LenXY() ;
|
||||
if ( dLen2XY < EPS_SMALL)
|
||||
return ;
|
||||
// prodotto vettoriale nel piano XY tra le direzioni delle linee
|
||||
double dCrossXY = CrossXY( vtDir1, vtDir2) ;
|
||||
|
||||
// se le linee non sono parallele
|
||||
if ( dCrossXY * dCrossXY > EPS_ZERO * EPS_ZERO) {
|
||||
if ( fabs( dCrossXY) > SIN_EPS_ANG_ZERO * ( dLen1XY * dLen2XY)) {
|
||||
// posizioni parametriche dell'intersezione sulle linee
|
||||
m_Info[0].Ici[0].dU = CrossXY( ( ptS2 - ptS1), vtDir2) / dCrossXY ;
|
||||
m_Info[0].Ici[1].dU = CrossXY( ( ptS2 - ptS1), vtDir1) / dCrossXY ;
|
||||
// tipo di posizione
|
||||
enum IntPos { IP_NULL = 0, IP_START = 1, IP_MID = 2, IP_END = 3} ;
|
||||
int nPos1 = IP_MID ;
|
||||
int nPos2 = IP_MID ;
|
||||
// se segmenti, ne verifico la posizione
|
||||
if ( bFinites) {
|
||||
// prima linea
|
||||
if ( ( m_Info[0].Ici[0].dU * vtDir1).IsSmall())
|
||||
nPos1 = IP_START ; // vicino a inizio
|
||||
else if ( (( 1 - m_Info[0].Ici[0].dU) * vtDir1).IsSmall())
|
||||
nPos1 = IP_END ; // vicino a fine
|
||||
else if ( m_Info[0].Ici[0].dU > 0 && m_Info[0].Ici[0].dU < 1)
|
||||
nPos1 = IP_MID ; // nell'interno
|
||||
else
|
||||
nPos1 = IP_NULL ; // fuori
|
||||
// seconda linea
|
||||
if ( ( m_Info[0].Ici[1].dU * vtDir2).IsSmall())
|
||||
nPos2 = IP_START ; // vicino a inizio
|
||||
else if ( (( 1 - m_Info[0].Ici[1].dU) * vtDir2).IsSmall())
|
||||
nPos2 = IP_END ; // vicino a fine
|
||||
else if ( m_Info[0].Ici[1].dU > 0 && m_Info[0].Ici[1].dU < 1)
|
||||
nPos2 = IP_MID ; // nell'interno
|
||||
else
|
||||
nPos2 = IP_NULL ; // fuori
|
||||
}
|
||||
// se soluzione non accettata, esco
|
||||
if ( nPos1 == IP_NULL || nPos2 == IP_NULL)
|
||||
return ;
|
||||
m_Info.IciA[0].dU = CrossXY( ( ptS2 - ptS1), vtDir2) / dCrossXY ;
|
||||
m_Info.IciB[0].dU = CrossXY( ( ptS2 - ptS1), vtDir1) / dCrossXY ;
|
||||
// calcolo i punti sulle due linee (possono differire in Z)
|
||||
m_Info[0].Ici[0].ptI = ptS1 + m_Info[0].Ici[0].dU * vtDir1 ;
|
||||
m_Info[0].Ici[1].ptI = ptS2 + m_Info[0].Ici[1].dU * vtDir2 ;
|
||||
// calcolo tipo di intersezione
|
||||
m_Info[0].Ici[0].nTy = ICCT_RESET ;
|
||||
m_Info[0].Ici[1].nTy = ICCT_RESET ;
|
||||
// si incontrano alle estremità, non si può dire alcunché
|
||||
if ( ( nPos1 == IP_START || nPos1 == IP_END) &&
|
||||
( nPos2 == IP_START || nPos2 == IP_END)) {
|
||||
m_Info[0].Ici[0].nTy = ICCT_PNULL + ICCT_NNULL ; // NULL + NULL
|
||||
m_Info[0].Ici[1].nTy = ICCT_PNULL + ICCT_NNULL ; // NULL + NULL
|
||||
m_Info.IciA[0].ptI = ptS1 + m_Info.IciA[0].dU * vtDir1 ;
|
||||
m_Info.IciB[0].ptI = ptS2 + m_Info.IciB[0].dU * vtDir2 ;
|
||||
// si intersecano sempre nel mezzo
|
||||
if ( CrossXY( ( ptS1 - ptS2), vtDir2) > 0) {
|
||||
m_Info.IciA[0].nPrevTy = ICCT_OUT ;
|
||||
m_Info.IciA[0].nNextTy = ICCT_IN ;
|
||||
}
|
||||
// l'inizio di 1 interseca il mezzo di 2
|
||||
else if ( nPos1 == IP_START) {
|
||||
if ( dCrossXY > 0)
|
||||
m_Info[0].Ici[0].nTy = ICCT_PNULL + ICCT_NOUT ; // NULL + OUT
|
||||
else
|
||||
m_Info[0].Ici[0].nTy = ICCT_PNULL + ICCT_NIN ; // NULL + IN
|
||||
m_Info[0].Ici[1].nTy = ICCT_PNULL + ICCT_NNULL ; // NULL + NULL
|
||||
}
|
||||
// la fine di 1 interseca il mezzo di 2
|
||||
else if ( nPos1 == IP_END) {
|
||||
if ( dCrossXY < 0)
|
||||
m_Info[0].Ici[0].nTy = ICCT_POUT + ICCT_NNULL ; // OUT + NULL
|
||||
else
|
||||
m_Info[0].Ici[0].nTy = ICCT_PIN + ICCT_NNULL ; // IN + NULL
|
||||
m_Info[0].Ici[1].nTy = ICCT_PNULL + ICCT_NNULL ; // NULL + NULL
|
||||
}
|
||||
// l'inizio di 2 interseca il mezzo di 1
|
||||
else if ( nPos2 == IP_START) {
|
||||
m_Info[0].Ici[0].nTy = ICCT_PNULL + ICCT_NNULL ; // NULL + NULL
|
||||
if ( - dCrossXY > 0)
|
||||
m_Info[0].Ici[1].nTy = ICCT_PNULL + ICCT_NOUT ; // NULL + OUT
|
||||
else
|
||||
m_Info[0].Ici[1].nTy = ICCT_PNULL + ICCT_NIN ; // NULL + IN
|
||||
}
|
||||
// la fine di 2 interseca il mezzo di 1
|
||||
else if ( nPos2 == IP_END) {
|
||||
m_Info[0].Ici[0].nTy = ICCT_PNULL + ICCT_NNULL ; // NULL + NULL
|
||||
if ( - dCrossXY < 0)
|
||||
m_Info[0].Ici[1].nTy = ICCT_POUT + ICCT_NNULL ; // OUT + NULL
|
||||
else
|
||||
m_Info[0].Ici[1].nTy = ICCT_PIN + ICCT_NNULL ; // IN + NULL
|
||||
}
|
||||
// si intersecano nel mezzo
|
||||
else {
|
||||
if ( CrossXY( ( ptS1 - ptS2), vtDir2) > 0)
|
||||
m_Info[0].Ici[0].nTy = ICCT_POUT + ICCT_NIN ; // OUT + IN
|
||||
else
|
||||
m_Info[0].Ici[0].nTy = ICCT_PIN + ICCT_NOUT ; // IN + OUT
|
||||
if ( CrossXY( ( ptS2 - ptS1), vtDir1) > 0)
|
||||
m_Info[0].Ici[1].nTy = ICCT_POUT + ICCT_NIN ; // OUT + IN
|
||||
else
|
||||
m_Info[0].Ici[1].nTy = ICCT_PIN + ICCT_NOUT ; // IN + OUT
|
||||
m_Info.IciA[0].nPrevTy = ICCT_IN ;
|
||||
m_Info.IciA[0].nNextTy = ICCT_OUT ;
|
||||
}
|
||||
if ( CrossXY( ( ptS2 - ptS1), vtDir1) > 0) {
|
||||
m_Info.IciB[0].nPrevTy = ICCT_OUT ;
|
||||
m_Info.IciB[0].nNextTy = ICCT_IN ;
|
||||
}
|
||||
else {
|
||||
m_Info.IciB[0].nPrevTy = ICCT_IN ;
|
||||
m_Info.IciB[0].nNextTy = ICCT_OUT ;
|
||||
}
|
||||
m_Info.bOverlap = false ;
|
||||
m_bOverlaps = false ;
|
||||
m_nNumInters = 1 ; // una intersezione
|
||||
return ;
|
||||
}
|
||||
|
||||
// se le linee sono parallele e non coincidenti
|
||||
if ( fabs( CrossXY( ( ptS2 - ptS1), vtDir1)) > EPS_SMALL * vtDir1.LenXY())
|
||||
if ( fabs( CrossXY( ( ptS2 - ptS1), vtDir1)) > EPS_SMALL * dLen1XY)
|
||||
return ; // non ci sono intersezioni
|
||||
|
||||
// le linee sono parallele e coincidenti e sono infinite
|
||||
if ( ! bFinites) {
|
||||
m_bOverlaps = true ;
|
||||
m_nNumInters = 0 ; // non esistono estremi del tratto sovrapposto
|
||||
m_bOverlaps = true ;
|
||||
m_nNumInters = 0 ; // non esistono estremi del tratto sovrapposto
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
IntersLineLine::IntersFiniteLines( const ICurveLine& Line1, const ICurveLine& Line2)
|
||||
{
|
||||
// verifico sovrapposizione box
|
||||
BBox3d boxL1 ;
|
||||
if ( ! Line1.GetLocalBBox( boxL1))
|
||||
return ;
|
||||
BBox3d boxL2 ;
|
||||
if ( ! Line2.GetLocalBBox( boxL2))
|
||||
return ;
|
||||
if ( ! boxL1.OverlapsXY( boxL2))
|
||||
return ;
|
||||
|
||||
// linea 1 : Start, End, Direzione e Lunghezza
|
||||
Point3d ptS1 = Line1.GetStart() ;
|
||||
Point3d ptE1 = Line1.GetEnd() ;
|
||||
Vector3d vtDir1 = ptE1 - ptS1 ;
|
||||
double dLen1XY = vtDir1.LenXY() ;
|
||||
if ( dLen1XY < EPS_SMALL)
|
||||
return ;
|
||||
// linea 2 : Start, Direzione e Lunghezza
|
||||
Point3d ptS2 = Line2.GetStart() ;
|
||||
Point3d ptE2 = Line2.GetEnd() ;
|
||||
Vector3d vtDir2 = ptE2 - ptS2 ;
|
||||
double dLen2XY = vtDir2.LenXY() ;
|
||||
if ( dLen2XY < EPS_SMALL)
|
||||
return ;
|
||||
// prodotto vettoriale nel piano XY tra le direzioni delle linee
|
||||
double dCrossXY = CrossXY( vtDir1, vtDir2) ;
|
||||
// flag per linee parallele
|
||||
bool bParallel = ( fabs( dCrossXY) < SIN_EPS_ANG_ZERO * ( dLen1XY * dLen2XY)) ;
|
||||
// flag per segmenti che si allontanano significativamente
|
||||
bool bFarEnds = ( IsPointOutFatSegment( ptS1, ptS2, vtDir2, dLen2XY, EPS_SMALL) ||
|
||||
IsPointOutFatSegment( ptE1, ptS2, vtDir2, dLen2XY, EPS_SMALL) ||
|
||||
IsPointOutFatSegment( ptS2, ptS1, vtDir1, dLen1XY, EPS_SMALL) ||
|
||||
IsPointOutFatSegment( ptE2, ptS1, vtDir1, dLen1XY, EPS_SMALL)) ;
|
||||
|
||||
// se non sono paralleli e si allontanano tra loro abbastanza
|
||||
if ( ! bParallel && bFarEnds) {
|
||||
// posizioni parametriche dell'intersezione sulle linee
|
||||
m_Info.IciA[0].dU = CrossXY( ( ptS2 - ptS1), vtDir2) / dCrossXY ;
|
||||
m_Info.IciB[0].dU = CrossXY( ( ptS2 - ptS1), vtDir1) / dCrossXY ;
|
||||
// tipo di posizione
|
||||
enum IntPos { IP_NULL = 0, IP_START = 1, IP_MID = 2, IP_END = 3} ;
|
||||
// verifica posizione intersezione su prima linea
|
||||
int nPos1 = IP_NULL ; // fuori
|
||||
if ( ( m_Info.IciA[0].dU * vtDir1).IsSmall())
|
||||
nPos1 = IP_START ; // vicino a inizio
|
||||
else if ( (( 1 - m_Info.IciA[0].dU) * vtDir1).IsSmall())
|
||||
nPos1 = IP_END ; // vicino a fine
|
||||
else if ( m_Info.IciA[0].dU > 0 && m_Info.IciA[0].dU < 1)
|
||||
nPos1 = IP_MID ; // nell'interno
|
||||
// verifica posizione intersezione su seconda linea
|
||||
int nPos2 = IP_NULL ; // fuori
|
||||
if ( ( m_Info.IciB[0].dU * vtDir2).IsSmall())
|
||||
nPos2 = IP_START ; // vicino a inizio
|
||||
else if ( (( 1 - m_Info.IciB[0].dU) * vtDir2).IsSmall())
|
||||
nPos2 = IP_END ; // vicino a fine
|
||||
else if ( m_Info.IciB[0].dU > 0 && m_Info.IciB[0].dU < 1)
|
||||
nPos2 = IP_MID ; // nell'interno
|
||||
// se soluzione non accettata, esco
|
||||
if ( nPos1 == IP_NULL || nPos2 == IP_NULL)
|
||||
return ;
|
||||
// limito i parametri a stare sui segmenti (0...1)
|
||||
m_Info.IciA[0].dU = min( max( m_Info.IciA[0].dU, 0.), 1.) ;
|
||||
m_Info.IciB[0].dU = min( max( m_Info.IciB[0].dU, 0.), 1.) ;
|
||||
// calcolo i punti sulle due linee (possono differire in Z)
|
||||
m_Info.IciA[0].ptI = ptS1 + m_Info.IciA[0].dU * vtDir1 ;
|
||||
m_Info.IciB[0].ptI = ptS2 + m_Info.IciB[0].dU * vtDir2 ;
|
||||
// calcolo tipo di intersezione
|
||||
m_Info.IciA[0].nPrevTy = ICCT_NULL ;
|
||||
m_Info.IciA[0].nNextTy = ICCT_NULL ;
|
||||
m_Info.IciB[0].nPrevTy = ICCT_NULL ;
|
||||
m_Info.IciB[0].nNextTy = ICCT_NULL ;
|
||||
// si incontrano alle estremità, non si può dire alcunché
|
||||
if ( ( nPos1 == IP_START || nPos1 == IP_END) &&
|
||||
( nPos2 == IP_START || nPos2 == IP_END)) {
|
||||
; // rimangono tutti NULL
|
||||
}
|
||||
// l'inizio di 1 interseca il mezzo di 2
|
||||
else if ( nPos1 == IP_START) {
|
||||
if ( dCrossXY > 0)
|
||||
m_Info.IciA[0].nNextTy = ICCT_OUT ; // NULL + OUT
|
||||
else
|
||||
m_Info.IciA[0].nNextTy = ICCT_IN ; // NULL + IN
|
||||
// curva B NULL + NULL
|
||||
}
|
||||
// la fine di 1 interseca il mezzo di 2
|
||||
else if ( nPos1 == IP_END) {
|
||||
if ( dCrossXY < 0)
|
||||
m_Info.IciA[0].nPrevTy = ICCT_OUT ; // OUT + NULL
|
||||
else
|
||||
m_Info.IciA[0].nPrevTy = ICCT_IN ; // IN + NULL
|
||||
// curva B NULL + NULL
|
||||
}
|
||||
// l'inizio di 2 interseca il mezzo di 1
|
||||
else if ( nPos2 == IP_START) {
|
||||
// curva A NULL + NULL
|
||||
if ( - dCrossXY > 0)
|
||||
m_Info.IciB[0].nNextTy = ICCT_OUT ; // NULL + OUT
|
||||
else
|
||||
m_Info.IciB[0].nNextTy = ICCT_IN ; // NULL + IN
|
||||
}
|
||||
// la fine di 2 interseca il mezzo di 1
|
||||
else if ( nPos2 == IP_END) {
|
||||
// curva A NULL + NULL
|
||||
if ( - dCrossXY < 0)
|
||||
m_Info.IciB[0].nPrevTy = ICCT_OUT ; // OUT + NULL
|
||||
else
|
||||
m_Info.IciB[0].nPrevTy = ICCT_IN ; // IN + NULL
|
||||
}
|
||||
// si intersecano nel mezzo
|
||||
else {
|
||||
if ( CrossXY( ( ptS1 - ptS2), vtDir2) > 0) {
|
||||
m_Info.IciA[0].nPrevTy = ICCT_OUT ;
|
||||
m_Info.IciA[0].nNextTy = ICCT_IN ;
|
||||
}
|
||||
else {
|
||||
m_Info.IciA[0].nPrevTy = ICCT_IN ;
|
||||
m_Info.IciA[0].nNextTy = ICCT_OUT ;
|
||||
}
|
||||
if ( CrossXY( ( ptS2 - ptS1), vtDir1) > 0) {
|
||||
m_Info.IciB[0].nPrevTy = ICCT_OUT ;
|
||||
m_Info.IciB[0].nNextTy = ICCT_IN ;
|
||||
}
|
||||
else {
|
||||
m_Info.IciB[0].nPrevTy = ICCT_IN ;
|
||||
m_Info.IciB[0].nNextTy = ICCT_OUT ;
|
||||
}
|
||||
}
|
||||
m_Info.bOverlap = false ;
|
||||
m_bOverlaps = false ;
|
||||
m_nNumInters = 1 ;
|
||||
return ;
|
||||
}
|
||||
|
||||
// le linee sono parallele e coincidenti e sono segmenti, si cercano eventuali sovrapposizioni
|
||||
// determino se sono equiverse o controverse
|
||||
// se le linee sono parallele e non coincidenti
|
||||
//if ( fabs( CrossXY( ( ptS2 - ptS1), vtDir1)) > EPS_SMALL * dLen1XY)
|
||||
if ( bParallel && bFarEnds)
|
||||
return ; // non ci sono intersezioni
|
||||
|
||||
// le linee sono parallele e coincidenti, si cercano eventuali sovrapposizioni
|
||||
// determino se sono equiversi o controversi
|
||||
bool bEqVers = ( ScalarXY( vtDir1, vtDir2) > 0) ;
|
||||
// calcolo dei valori parametrici degli estremi del secondo segmento sul primo
|
||||
double dUmin = ScalarXY( ( ptS2 - ptS1), vtDir1) / vtDir1.SqLenXY() ;
|
||||
double dUmax = ScalarXY( ( ptS2 + vtDir2 - ptS1), vtDir1) / vtDir1.SqLenXY() ;
|
||||
double dUmax = ScalarXY( ( ptE2 - ptS1), vtDir1) / vtDir1.SqLenXY() ;
|
||||
if ( ! bEqVers)
|
||||
swap( dUmin, dUmax) ;
|
||||
// estremo inferiore del primo coincide con superiore del secondo -> un punto estremo
|
||||
if ( ( dUmax * vtDir1).IsSmall()) {
|
||||
m_Info[0].Ici[0].dU = 0 ;
|
||||
m_Info[0].Ici[1].dU = ( bEqVers ? 1 : 0) ;
|
||||
m_Info[0].Ici[0].ptI = ptS1 + m_Info[0].Ici[0].dU * vtDir1 ;
|
||||
m_Info[0].Ici[1].ptI = ptS2 + m_Info[0].Ici[1].dU * vtDir2 ;
|
||||
m_Info[0].Ici[0].nTy = ICCT_PNULL + ICCT_NNULL ; // NULL + NULL
|
||||
m_Info[0].Ici[1].nTy = ICCT_PNULL + ICCT_NNULL ; // NULL + NULL
|
||||
m_Info.IciA[0].dU = 0 ;
|
||||
m_Info.IciB[0].dU = ( bEqVers ? 1 : 0) ;
|
||||
m_Info.IciA[0].ptI = ptS1 + m_Info.IciA[0].dU * vtDir1 ;
|
||||
m_Info.IciB[0].ptI = ptS2 + m_Info.IciB[0].dU * vtDir2 ;
|
||||
m_Info.IciA[0].nPrevTy = ICCT_NULL ;
|
||||
m_Info.IciA[0].nNextTy = ICCT_NULL ;
|
||||
m_Info.IciB[0].nPrevTy = ICCT_NULL ;
|
||||
m_Info.IciB[0].nNextTy = ICCT_NULL ;
|
||||
m_Info.bOverlap = false ;
|
||||
m_bOverlaps = false ;
|
||||
m_nNumInters = 1 ; // una intersezione
|
||||
m_nNumInters = 1 ;
|
||||
return ;
|
||||
}
|
||||
// estremo superiore del primo coincide con inferiore del secondo -> un punto estremo
|
||||
else if ( ( ( 1 - dUmin) * vtDir1).IsSmall()) {
|
||||
m_Info[0].Ici[0].dU = 1 ;
|
||||
m_Info[0].Ici[1].dU = ( bEqVers ? 0 : 1) ;
|
||||
m_Info[0].Ici[0].ptI = ptS1 + m_Info[0].Ici[0].dU * vtDir1 ;
|
||||
m_Info[0].Ici[1].ptI = ptS2 + m_Info[0].Ici[1].dU * vtDir2 ;
|
||||
m_Info[0].Ici[0].nTy = ICCT_PNULL + ICCT_NNULL ; // NULL + NULL
|
||||
m_Info[0].Ici[1].nTy = ICCT_PNULL + ICCT_NNULL ; // NULL + NULL
|
||||
m_Info.IciA[0].dU = 1 ;
|
||||
m_Info.IciB[0].dU = ( bEqVers ? 0 : 1) ;
|
||||
m_Info.IciA[0].ptI = ptS1 + m_Info.IciA[0].dU * vtDir1 ;
|
||||
m_Info.IciB[0].ptI = ptS2 + m_Info.IciB[0].dU * vtDir2 ;
|
||||
m_Info.IciA[0].nPrevTy = ICCT_NULL ;
|
||||
m_Info.IciA[0].nNextTy = ICCT_NULL ;
|
||||
m_Info.IciB[0].nPrevTy = ICCT_NULL ;
|
||||
m_Info.IciB[0].nNextTy = ICCT_NULL ;
|
||||
m_Info.bOverlap = false ;
|
||||
m_bOverlaps = false ;
|
||||
m_nNumInters = 1 ; // una intersezione
|
||||
m_nNumInters = 1 ;
|
||||
return ;
|
||||
}
|
||||
// esterni -> nessuna intersezione
|
||||
@@ -183,38 +303,50 @@ IntersLineLine::IntersLineLine( const ICurveLine& Line1, const ICurveLine& Line2
|
||||
else {
|
||||
// devo prendere il massimo dei minimi
|
||||
if ( dUmin > 0) {
|
||||
m_Info[0].Ici[0].dU = dUmin ;
|
||||
m_Info[0].Ici[1].dU = ( bEqVers ? 0 : 1) ;
|
||||
m_Info.IciA[0].dU = dUmin ;
|
||||
m_Info.IciB[0].dU = ( bEqVers ? 0 : 1) ;
|
||||
}
|
||||
else {
|
||||
m_Info[0].Ici[0].dU = 0 ;
|
||||
m_Info[0].Ici[1].dU = ScalarXY( ( ptS1 - ptS2), vtDir2) / vtDir2.SqLenXY() ;
|
||||
m_Info.IciA[0].dU = 0 ;
|
||||
m_Info.IciB[0].dU = ScalarXY( ( ptS1 - ptS2), vtDir2) / vtDir2.SqLenXY() ;
|
||||
}
|
||||
m_Info.IciA[0].ptI = ptS1 + m_Info.IciA[0].dU * vtDir1 ;
|
||||
m_Info.IciB[0].ptI = ptS2 + m_Info.IciB[0].dU * vtDir2 ;
|
||||
m_Info.IciA[0].nPrevTy = ICCT_NULL ;
|
||||
m_Info.IciA[0].nNextTy = ICCT_ON ;
|
||||
if ( bEqVers) {
|
||||
m_Info.IciB[0].nPrevTy = ICCT_NULL ;
|
||||
m_Info.IciB[0].nNextTy = ICCT_ON ;
|
||||
}
|
||||
else {
|
||||
m_Info.IciB[0].nPrevTy = ICCT_ON ;
|
||||
m_Info.IciB[0].nNextTy = ICCT_NULL ;
|
||||
}
|
||||
m_Info[0].Ici[0].ptI = ptS1 + m_Info[0].Ici[0].dU * vtDir1 ;
|
||||
m_Info[0].Ici[1].ptI = ptS2 + m_Info[0].Ici[1].dU * vtDir2 ;
|
||||
m_Info[0].Ici[0].nTy = ICCT_PNULL + ICCT_NON ; // NULL + ON
|
||||
if ( bEqVers)
|
||||
m_Info[0].Ici[1].nTy = ICCT_PNULL + ICCT_NON ; // NULL + ON
|
||||
else
|
||||
m_Info[0].Ici[1].nTy = ICCT_PON + ICCT_NNULL ; // ON + NULL
|
||||
// e il minimo dei massimi
|
||||
if ( dUmax < 1) {
|
||||
m_Info[1].Ici[0].dU = dUmax ;
|
||||
m_Info[1].Ici[1].dU = ( bEqVers ? 1 : 0) ;
|
||||
m_Info.IciA[1].dU = dUmax ;
|
||||
m_Info.IciB[1].dU = ( bEqVers ? 1 : 0) ;
|
||||
}
|
||||
else {
|
||||
m_Info[1].Ici[0].dU = 1 ;
|
||||
m_Info[1].Ici[1].dU = ScalarXY( ( ptS1 + vtDir1 - ptS2), vtDir2) / vtDir2.SqLenXY() ;
|
||||
m_Info.IciA[1].dU = 1 ;
|
||||
m_Info.IciB[1].dU = ScalarXY( ( ptS1 + vtDir1 - ptS2), vtDir2) / vtDir2.SqLenXY() ;
|
||||
}
|
||||
m_Info[1].Ici[0].ptI = ptS1 + m_Info[1].Ici[0].dU * vtDir1 ;
|
||||
m_Info[1].Ici[1].ptI = ptS2 + m_Info[1].Ici[1].dU * vtDir2 ;
|
||||
m_Info[1].Ici[0].nTy = ICCT_PON + ICCT_NNULL ; // ON + NULL
|
||||
if ( bEqVers)
|
||||
m_Info[1].Ici[1].nTy = ICCT_PON + ICCT_NNULL ; // ON + NULL
|
||||
else
|
||||
m_Info[1].Ici[1].nTy = ICCT_PNULL + ICCT_NON ; // NULL + ON
|
||||
m_Info.IciA[1].ptI = ptS1 + m_Info.IciA[1].dU * vtDir1 ;
|
||||
m_Info.IciB[1].ptI = ptS2 + m_Info.IciB[1].dU * vtDir2 ;
|
||||
m_Info.IciA[1].nPrevTy = ICCT_ON ;
|
||||
m_Info.IciA[1].nNextTy = ICCT_NULL ;
|
||||
if ( bEqVers) {
|
||||
m_Info.IciB[1].nPrevTy = ICCT_ON ;
|
||||
m_Info.IciB[1].nNextTy = ICCT_NULL ;
|
||||
}
|
||||
else {
|
||||
m_Info.IciB[1].nPrevTy = ICCT_NULL ;
|
||||
m_Info.IciB[1].nNextTy = ICCT_ON ;
|
||||
}
|
||||
m_Info.bOverlap = true ;
|
||||
m_Info.bCBOverEq = bEqVers ;
|
||||
m_bOverlaps = true ;
|
||||
m_nNumInters = 2 ; // estremi del tratto di sovrapposizione
|
||||
m_nNumInters = 1 ;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user