EgtGeomKernel 1.6w3 :
- correzioni nell'intersezione di archi tangenti o quasi - pulizia uso distanze e relative costanti minime.
This commit is contained in:
+70
-8
@@ -235,17 +235,18 @@ IntersArcArc::IntersArcArc( const CurveArc& Arc1, const CurveArc& Arc2)
|
||||
double dSqH = m_Arc1.GetRadius() * m_Arc1.GetRadius() - dA * dA ;
|
||||
|
||||
// cerchi tangenti esterni -> una intersezione
|
||||
if ( dSqH < EPS_SMALL * EPS_SMALL &&
|
||||
fabs( dDist - ( m_Arc1.GetRadius() + m_Arc2.GetRadius())) < EPS_SMALL) {
|
||||
if ( fabs( dDist - ( m_Arc1.GetRadius() + m_Arc2.GetRadius())) < EPS_SMALL) {
|
||||
// tolleranza tangenziale sull'intersezione
|
||||
double dTgTol = ( dSqH > SQ_EPS_SMALL ? sqrt( dSqH) : EPS_SMALL) ;
|
||||
// calcolo il punto di intersezione
|
||||
Point3d ptInt = m_Arc1.GetCenter() + vtDir * m_Arc1.GetRadius() ;
|
||||
// posizione parametrica dell'intersezione sul primo arco
|
||||
int nPos1 ;
|
||||
if ( ! m_Arc1.CalcPointParamPosiz( ptInt, m_Info[0].IciA[0].dU, nPos1))
|
||||
if ( ! m_Arc1.MyCalcPointParamPosiz( ptInt, m_Info[0].IciA[0].dU, nPos1, dTgTol))
|
||||
return ;
|
||||
// posizione parametrica dell'intersezione sul secondo arco
|
||||
int nPos2 ;
|
||||
if ( ! m_Arc2.CalcPointParamPosiz( ptInt, m_Info[0].IciB[0].dU, nPos2))
|
||||
if ( ! m_Arc2.MyCalcPointParamPosiz( ptInt, m_Info[0].IciB[0].dU, nPos2, dTgTol))
|
||||
return ;
|
||||
// se soluzione non accettata, esco
|
||||
if ( nPos1 == ICurve::PP_NULL || nPos2 == ICurve::PP_NULL)
|
||||
@@ -253,6 +254,36 @@ IntersArcArc::IntersArcArc( const CurveArc& Arc1, const CurveArc& Arc2)
|
||||
// calcolo i punti sui due archi (possono differire in Z)
|
||||
m_Arc1.GetPointD1D2( m_Info[0].IciA[0].dU, ICurve::FROM_MINUS, m_Info[0].IciA[0].ptI) ;
|
||||
m_Arc2.GetPointD1D2( m_Info[0].IciB[0].dU, ICurve::FROM_MINUS, m_Info[0].IciB[0].ptI) ;
|
||||
// verifico che non distino in XY più della tolleranza generale
|
||||
if ( ! AreSamePointXYApprox( m_Info[0].IciA[0].ptI, m_Info[0].IciB[0].ptI)) {
|
||||
// se entrambi interni, c'è un errore imprevisto (dovrebbero essere entro la tolleranza)
|
||||
if ( nPos1 == ICurve::PP_MID && nPos2 == ICurve::PP_MID)
|
||||
return ;
|
||||
// se entrambi già agli estremi, non posso spostarli
|
||||
if ( ( nPos1 == ICurve::PP_START || nPos1 == ICurve::PP_END) &&
|
||||
( nPos2 == ICurve::PP_START || nPos2 == ICurve::PP_END))
|
||||
return ;
|
||||
// se primo all'estremo dell'entità, provo a spostare il secondo
|
||||
if ( nPos1 == ICurve::PP_START || nPos1 == ICurve::PP_END) {
|
||||
// ridetermino posizione parametrica del secondo
|
||||
if ( ! m_Arc2.MyCalcPointParamPosiz( m_Info[0].IciA[0].ptI, m_Info[0].IciB[0].dU, nPos2, dTgTol) || nPos2 == ICurve::PP_NULL)
|
||||
return ;
|
||||
// ricalcolo il punto sull'arco e riverifico in XY
|
||||
m_Arc2.GetPointD1D2( m_Info[0].IciB[0].dU, ICurve::FROM_MINUS, m_Info[0].IciB[0].ptI) ;
|
||||
if ( ! AreSamePointXYApprox( m_Info[0].IciA[0].ptI, m_Info[0].IciB[0].ptI))
|
||||
return ;
|
||||
}
|
||||
// altrimenti secondo all'estremo dell'entità, provo a spostare il primo
|
||||
else {
|
||||
// ridetermino posizione parametrica del primo
|
||||
if ( ! m_Arc1.MyCalcPointParamPosiz( m_Info[0].IciB[0].ptI, m_Info[0].IciA[0].dU, nPos1, dTgTol) || nPos1 == ICurve::PP_NULL)
|
||||
return ;
|
||||
// ricalcolo il punto sull'arco e riverifico in XY
|
||||
m_Arc1.GetPointD1D2( m_Info[0].IciA[0].dU, ICurve::FROM_MINUS, m_Info[0].IciA[0].ptI) ;
|
||||
if ( ! AreSamePointXYApprox( m_Info[0].IciA[0].ptI, m_Info[0].IciB[0].ptI))
|
||||
return ;
|
||||
}
|
||||
}
|
||||
// calcolo dati ausiliari
|
||||
bool bCCW1 = (( m_Arc1.GetAngCenter() > 0 && m_Arc1.GetNormVersor().IsZplus()) ||
|
||||
( m_Arc1.GetAngCenter() < 0 && m_Arc1.GetNormVersor().IsZminus())) ;
|
||||
@@ -326,19 +357,20 @@ IntersArcArc::IntersArcArc( const CurveArc& Arc1, const CurveArc& Arc2)
|
||||
}
|
||||
|
||||
// cerchi tangenti interni -> una intersezione
|
||||
if ( dSqH < EPS_SMALL * EPS_SMALL &&
|
||||
fabs( dDist - fabs( m_Arc1.GetRadius() - m_Arc2.GetRadius())) < EPS_SMALL) {
|
||||
if ( fabs( dDist - fabs( m_Arc1.GetRadius() - m_Arc2.GetRadius())) < EPS_SMALL) {
|
||||
// tolleranza tangenziale sull'intersezione
|
||||
double dTgTol = ( dSqH > SQ_EPS_SMALL ? sqrt( dSqH) : EPS_SMALL) ;
|
||||
// determino quale dei due contiene l'altro
|
||||
bool bBiggest1 = ( m_Arc1.GetRadius() > m_Arc2.GetRadius()) ;
|
||||
// calcolo il punto di intersezione
|
||||
Point3d ptInt = m_Arc1.GetCenter() + ( bBiggest1 ? vtDir : - vtDir) * m_Arc1.GetRadius() ;
|
||||
// posizione parametrica dell'intersezione sul primo arco
|
||||
int nPos1 ;
|
||||
if ( ! m_Arc1.CalcPointParamPosiz( ptInt, m_Info[0].IciA[0].dU, nPos1))
|
||||
if ( ! m_Arc1.MyCalcPointParamPosiz( ptInt, m_Info[0].IciA[0].dU, nPos1, dTgTol))
|
||||
return ;
|
||||
// posizione parametrica dell'intersezione sul secondo arco
|
||||
int nPos2 ;
|
||||
if ( ! m_Arc2.CalcPointParamPosiz( ptInt, m_Info[0].IciB[0].dU, nPos2))
|
||||
if ( ! m_Arc2.MyCalcPointParamPosiz( ptInt, m_Info[0].IciB[0].dU, nPos2, dTgTol))
|
||||
return ;
|
||||
// se soluzione non accettata, esco
|
||||
if ( nPos1 == ICurve::PP_NULL || nPos2 == ICurve::PP_NULL)
|
||||
@@ -346,6 +378,36 @@ IntersArcArc::IntersArcArc( const CurveArc& Arc1, const CurveArc& Arc2)
|
||||
// calcolo i punti sui due archi (possono differire in Z)
|
||||
m_Arc1.GetPointD1D2( m_Info[0].IciA[0].dU, ICurve::FROM_MINUS, m_Info[0].IciA[0].ptI) ;
|
||||
m_Arc2.GetPointD1D2( m_Info[0].IciB[0].dU, ICurve::FROM_MINUS, m_Info[0].IciB[0].ptI) ;
|
||||
// verifico che non distino in XY più della tolleranza generale
|
||||
if ( ! AreSamePointXYApprox( m_Info[0].IciA[0].ptI, m_Info[0].IciB[0].ptI)) {
|
||||
// se entrambi interni, c'è un errore imprevisto (dovrebbero essere entro la tolleranza)
|
||||
if ( nPos1 == ICurve::PP_MID && nPos2 == ICurve::PP_MID)
|
||||
return ;
|
||||
// se entrambi già agli estremi, non posso spostarli
|
||||
if ( ( nPos1 == ICurve::PP_START || nPos1 == ICurve::PP_END) &&
|
||||
( nPos2 == ICurve::PP_START || nPos2 == ICurve::PP_END))
|
||||
return ;
|
||||
// se primo all'estremo dell'entità, provo a spostare il secondo
|
||||
if ( nPos1 == ICurve::PP_START || nPos1 == ICurve::PP_END) {
|
||||
// ridetermino posizione parametrica del secondo
|
||||
if ( ! m_Arc2.MyCalcPointParamPosiz( m_Info[0].IciA[0].ptI, m_Info[0].IciB[0].dU, nPos2, dTgTol) || nPos2 == ICurve::PP_NULL)
|
||||
return ;
|
||||
// ricalcolo il punto sull'arco e riverifico in XY
|
||||
m_Arc2.GetPointD1D2( m_Info[0].IciB[0].dU, ICurve::FROM_MINUS, m_Info[0].IciB[0].ptI) ;
|
||||
if ( ! AreSamePointXYApprox( m_Info[0].IciA[0].ptI, m_Info[0].IciB[0].ptI))
|
||||
return ;
|
||||
}
|
||||
// altrimenti secondo all'estremo dell'entità, provo a spostare il primo
|
||||
else {
|
||||
// ridetermino posizione parametrica del primo
|
||||
if ( ! m_Arc1.MyCalcPointParamPosiz( m_Info[0].IciB[0].ptI, m_Info[0].IciA[0].dU, nPos1, dTgTol) || nPos1 == ICurve::PP_NULL)
|
||||
return ;
|
||||
// ricalcolo il punto sull'arco e riverifico in XY
|
||||
m_Arc1.GetPointD1D2( m_Info[0].IciA[0].dU, ICurve::FROM_MINUS, m_Info[0].IciA[0].ptI) ;
|
||||
if ( ! AreSamePointXYApprox( m_Info[0].IciA[0].ptI, m_Info[0].IciB[0].ptI))
|
||||
return ;
|
||||
}
|
||||
}
|
||||
// calcolo dati ausiliari
|
||||
bool bCCW1 = (( m_Arc1.GetAngCenter() > 0 && m_Arc1.GetNormVersor().IsZplus()) ||
|
||||
( m_Arc1.GetAngCenter() < 0 && m_Arc1.GetNormVersor().IsZminus())) ;
|
||||
|
||||
Reference in New Issue
Block a user