EgtGeomKernel 1.5j1 :
- modifica sui punti medi (ora sempre a metà lunghezza) - correzioni a GetParamAtLength delle curve.
This commit is contained in:
+1
-1
@@ -895,7 +895,7 @@ CurveArc::GetParamAtLength( double dLen, double& dU) const
|
||||
return false ;
|
||||
|
||||
// fine
|
||||
if ( dLen < dTotLen - EPS_SMALL) {
|
||||
if ( dLen > dTotLen - EPS_SMALL) {
|
||||
dU = 1 ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+24
-4
@@ -597,11 +597,29 @@ CurveBezier::GetMidPoint( Point3d& ptMid) const
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// determino il valore del parametro a metà lunghezza
|
||||
double dLen, dMid ;
|
||||
if ( ! GetLength( dLen) || ! GetParamAtLength( 0.5 * dLen, dMid))
|
||||
return false ;
|
||||
// calcolo il punto
|
||||
return GetPointD1D2( 0.5, ptMid) ;
|
||||
return GetPointD1D2( dMid, ptMid) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::GetMidDir( Vector3d& vtDir) const
|
||||
{
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// determino il valore del parametro a metà lunghezza
|
||||
double dLen, dMid ;
|
||||
if ( ! GetLength( dLen) || ! GetParamAtLength( 0.5 * dLen, dMid))
|
||||
return false ;
|
||||
// calcolo la direzione
|
||||
return ::GetTang( *this, dMid, FROM_MINUS, vtDir) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::GetPointD1D2( double dU, Side nS, Point3d& ptPos, Vector3d* pvtDer1, Vector3d* pvtDer2) const
|
||||
@@ -1177,8 +1195,10 @@ CurveBezier::GetParamAtLength( double dLen, double& dU) const
|
||||
double dCurrLen = 0 ;
|
||||
double dUIni = 0 ;
|
||||
double dUFin = 1 ;
|
||||
while ( ( bOk = GetSegmentParam( dLen, dCurrLen, dSegLen, dUIni, dUFin)) && dSegLen > MIN_SEG_LEN)
|
||||
;
|
||||
while ( ( bOk = GetSegmentParam( dLen, dCurrLen, dSegLen, dUIni, dUFin)) && dSegLen > MIN_SEG_LEN) {
|
||||
// allungo di un poco l'intervallo di ricerca per compensare l'approssimazione della lunghezza
|
||||
dUFin = min( dUFin + ( dUFin - dUIni) * 0.05, 1) ;
|
||||
}
|
||||
// aggiustamento finale parametro
|
||||
if ( bOk)
|
||||
dU = dUIni + ( dLen - dCurrLen) / dSegLen * ( dUFin - dUIni) ;
|
||||
|
||||
+1
-2
@@ -66,8 +66,7 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
||||
{ return ::GetTang( *this, 0, FROM_PLUS, vtDir) ; }
|
||||
virtual bool GetEndDir( Vector3d& vtDir) const
|
||||
{ return ::GetTang( *this, 1, FROM_MINUS, vtDir) ; }
|
||||
virtual bool GetMidDir( Vector3d& vtDir) const
|
||||
{ return ::GetTang( *this, 0.5, FROM_MINUS, vtDir) ; }
|
||||
virtual bool GetMidDir( Vector3d& vtDir) const ;
|
||||
virtual bool GetExtrusion( Vector3d& vtExtr) const
|
||||
{ vtExtr = m_VtExtr ; return ( m_nStatus == OK) ; }
|
||||
virtual bool GetThickness( double& dThick) const
|
||||
|
||||
+20
-7
@@ -869,16 +869,29 @@ CurveComposite::GetMidPoint( Point3d& ptMid) const
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// determino il valore medio del parametro della curva
|
||||
double dStart, dEnd, dMid ;
|
||||
GetDomain( dStart, dEnd) ;
|
||||
dMid = 0.5 * ( dStart + dEnd) ;
|
||||
|
||||
// determino il valore del parametro a metà lunghezza
|
||||
double dLen, dMid ;
|
||||
if ( ! GetLength( dLen) || ! GetParamAtLength( 0.5 * dLen, dMid))
|
||||
return false ;
|
||||
// calcolo il punto
|
||||
return GetPointD1D2( dMid, FROM_MINUS, ptMid) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::GetMidDir( Vector3d& vtDir) const
|
||||
{
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// determino il valore del parametro a metà lunghezza
|
||||
double dLen, dMid ;
|
||||
if ( ! GetLength( dLen) || ! GetParamAtLength( 0.5 * dLen, dMid))
|
||||
return false ;
|
||||
// calcolo la direzione
|
||||
return ::GetTang( *this, 0.5 * m_nCounter, FROM_MINUS, vtDir) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::GetDomain( double& dStart, double& dEnd) const
|
||||
@@ -1064,7 +1077,7 @@ CurveComposite::GetParamAtLength( double dLen, double& dU) const
|
||||
}
|
||||
}
|
||||
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+1
-2
@@ -66,8 +66,7 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
{ return ::GetTang( *this, 0, FROM_PLUS, vtDir) ; }
|
||||
virtual bool GetEndDir( Vector3d& vtDir) const
|
||||
{ return ::GetTang( *this, m_nCounter, FROM_MINUS, vtDir) ; }
|
||||
virtual bool GetMidDir( Vector3d& vtDir) const
|
||||
{ return ::GetTang( *this, 0.5 * m_nCounter, FROM_MINUS, vtDir) ; }
|
||||
virtual bool GetMidDir( Vector3d& vtDir) const ;
|
||||
virtual bool GetExtrusion( Vector3d& vtExtr) const
|
||||
{ vtExtr = m_VtExtr ; return ( m_nStatus == OK) ; }
|
||||
virtual bool GetThickness( double& dThick) const
|
||||
|
||||
+1
-1
@@ -424,7 +424,7 @@ CurveLine::GetParamAtLength( double dLen, double& dU) const
|
||||
return false ;
|
||||
|
||||
// fine
|
||||
if ( dLen < dTotLen - EPS_SMALL) {
|
||||
if ( dLen > dTotLen - EPS_SMALL) {
|
||||
dU = 1 ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user