EgtInterface 1.6c7 :

- aggiunto richiamo di EgtMachKernel
- possibilità di estendere curva in EgtCurveLengthAtPoint.
This commit is contained in:
Dario Sassi
2015-03-23 11:41:00 +00:00
parent 0966f86f9d
commit a7a5ed461c
4 changed files with 36 additions and 8 deletions
+26 -4
View File
@@ -761,7 +761,7 @@ __stdcall EgtCurveLength( int nId, double* pdLen)
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveLengthAtPoint( int nId, double ptOn[3], double* pdLen)
__stdcall EgtCurveLengthAtPoint( int nId, double ptOn[3], double dExtend, double* pdLen)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
@@ -769,7 +769,7 @@ __stdcall EgtCurveLengthAtPoint( int nId, double ptOn[3], double* pdLen)
if ( pdLen == nullptr)
return FALSE ;
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
if ( pCurve == nullptr)
return FALSE ;
// determino la posizione parametrica del punto sulla curva (con tolleranza)
@@ -777,8 +777,30 @@ __stdcall EgtCurveLengthAtPoint( int nId, double ptOn[3], double* pdLen)
double dU ;
if ( ! DistPointCurve( ptOn, *pCurve).GetParamAtMinDistPoint( 0, dU, nFlag) || nFlag != MDPCI_NORMAL)
return FALSE ;
// recupero la lunghezza alla posizione parametrica
return ( pCurve->GetLengthAtParam( dU, *pdLen) ? TRUE : FALSE) ;
// se non richiesta estensione o punto interno alla curva, recupero la lunghezza alla posizione parametrica
if ( dExtend < EPS_SMALL ||
( ! pCurve->IsStartParam( dU) && ! pCurve->IsEndParam( dU)))
return ( pCurve->GetLengthAtParam( dU, *pdLen) ? TRUE : FALSE) ;
// allungo la curva dalla parte del punto
PtrOwner<ICurve> pCopy( pCurve->Clone()) ;
if ( IsNull( pCopy))
return FALSE ;
double dDeltaIni ;
if ( pCopy->IsStartParam( dU)) {
pCopy->ExtendStartByLen( dExtend) ;
dDeltaIni = dExtend ;
}
else {
pCopy->ExtendEndByLen( dExtend) ;
dDeltaIni = 0 ;
}
if ( ! DistPointCurve( ptOn, *pCopy).GetParamAtMinDistPoint( 0, dU, nFlag) || nFlag != MDPCI_NORMAL)
return FALSE ;
if ( pCopy->GetLengthAtParam( dU, *pdLen)) {
*pdLen -= dDeltaIni ;
return TRUE ;
}
return FALSE ;
}
//----------------------------------------------------------------------------