EgtGeomKernel 1.5l1 :
- aggiornamento a VS2013 - migliorato SimpleOffset e implementato anche per CurveComposite - il lato di offset ora viene dal segno dello spostamento ( + a destra, - a sinistra) - il vettore estrusione ora è la normale al piano di offset (se non c'è uso Z+) - aggiunto a tutte le entità geometriche membro m_nTempProp intero temporaneo - migliorata DistPointCrvBezier e DistPointArc - corretta IntersLineArc con linee che non giacciono nel piano XY - corretta ModifyStart di CurveArc - a PolyArc aggiunto metodo ParamLinearTransform - aggiunta gestione riferimento di griglia (CPlane).
This commit is contained in:
+75
-19
@@ -48,6 +48,8 @@ DistPointCurve::DistPointCurve( const Point3d& ptP, const ICurve& Curve, bool bI
|
||||
CrvCompositeCalculate( ptP, Curve) ;
|
||||
break ;
|
||||
}
|
||||
// salvo il punto
|
||||
m_ptP = ptP ;
|
||||
// salvo il puntatore alla curva
|
||||
m_pCurve = &Curve ;
|
||||
}
|
||||
@@ -120,10 +122,7 @@ DistPointCurve::GetDist( double& dDist)
|
||||
bool
|
||||
DistPointCurve::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
|
||||
if ( nInd < 0 || nInd >= (int) m_Info.size())
|
||||
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||
return false ;
|
||||
|
||||
ptMinDist = m_Info[nInd].ptQ ;
|
||||
@@ -135,10 +134,7 @@ DistPointCurve::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
bool
|
||||
DistPointCurve::GetMinDistPoint( double dNearParam, Point3d& ptMinDist, int& nFlag)
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
|
||||
if ( m_Info.empty())
|
||||
if ( m_dDist < 0 || m_Info.empty())
|
||||
return false ;
|
||||
|
||||
// verifico se cade in una zona continua
|
||||
@@ -172,10 +168,7 @@ DistPointCurve::GetMinDistPoint( double dNearParam, Point3d& ptMinDist, int& nFl
|
||||
bool
|
||||
DistPointCurve::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
|
||||
if ( nInd < 0 || nInd >= (int) m_Info.size())
|
||||
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||
return false ;
|
||||
|
||||
dParam = m_Info[nInd].dPar ;
|
||||
@@ -187,10 +180,7 @@ DistPointCurve::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
||||
bool
|
||||
DistPointCurve::GetParamAtMinDistPoint( double dNearParam, double& dParam, int& nFlag)
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
|
||||
if ( m_Info.empty())
|
||||
if ( m_dDist < 0 || m_Info.empty())
|
||||
return false ;
|
||||
|
||||
// verifico se cade in una zona continua
|
||||
@@ -219,12 +209,78 @@ DistPointCurve::GetParamAtMinDistPoint( double dNearParam, double& dParam, int&
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetMinDistInfo( int nInd, MinDistPCInfo& aInfo)
|
||||
DistPointCurve::GetSideAtMinDistPoint( int nInd, const Vector3d& vtN, int& nSide)
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||
return false ;
|
||||
|
||||
if ( nInd < 0 || nInd >= (int) m_Info.size())
|
||||
// se distanza nulla, il punto giace sulla curva
|
||||
if ( m_dDist <= EPS_SMALL) {
|
||||
nSide = MDS_ON ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
// determino la tangente nell'intorno del punto
|
||||
Point3d ptQ ;
|
||||
Vector3d vtPreTg, vtPostTg ;
|
||||
if ( m_pCurve == nullptr ||
|
||||
! m_pCurve->GetPointTang( m_Info[nInd].dPar, ICurve::FROM_MINUS, ptQ, vtPreTg) ||
|
||||
! m_pCurve->GetPointTang( m_Info[nInd].dPar, ICurve::FROM_PLUS, ptQ, vtPostTg))
|
||||
return false ;
|
||||
Vector3d vtTg = 0.5 * ( vtPreTg + vtPostTg) ;
|
||||
// se tangenti opposte, si deve ricalcolare spostandosi un poco
|
||||
if ( ! vtTg.Normalize()) {
|
||||
double dDeltaU = 1000 * EPS_PARAM ;
|
||||
if ( ! m_pCurve->GetPointTang( m_Info[nInd].dPar - dDeltaU, ICurve::FROM_MINUS, ptQ, vtPreTg) ||
|
||||
! m_pCurve->GetPointTang( m_Info[nInd].dPar + dDeltaU, ICurve::FROM_PLUS, ptQ, vtPostTg))
|
||||
return false ;
|
||||
vtTg = 0.5 * ( vtPreTg + vtPostTg) ;
|
||||
if ( ! vtTg.Normalize( EPS_ZERO))
|
||||
return false ;
|
||||
}
|
||||
|
||||
// determino la direzione di riferimento
|
||||
Vector3d vtRef = vtN ^ vtTg ;
|
||||
if ( ! vtRef.Normalize())
|
||||
return false ;
|
||||
|
||||
// determino il lato di giacitura del punto
|
||||
double dSide = vtRef * ( m_ptP - ptQ) ;
|
||||
if ( fabs( dSide) < EPS_SMALL)
|
||||
nSide = MDS_ON ;
|
||||
else if ( dSide > 0)
|
||||
nSide = MDS_LEFT ;
|
||||
else
|
||||
nSide = MDS_RIGHT ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetSideAtMinDistPoint( double dNearParam, const Vector3d& vtN, int& nSide)
|
||||
{
|
||||
if ( m_dDist < 0 || m_Info.empty())
|
||||
return false ;
|
||||
|
||||
// cerco punto discreto più vicino (anche estremi di zone continue)
|
||||
int nInd ;
|
||||
double dParam ;
|
||||
for ( int i = 0 ; i < (int) m_Info.size() ; ++ i) {
|
||||
if ( i == 0 ||
|
||||
fabs( m_Info[i].dPar - dNearParam) < fabs( dParam - dNearParam)) {
|
||||
nInd = i ;
|
||||
dParam = m_Info[i].dPar ;
|
||||
}
|
||||
}
|
||||
// mi sono ricondotto al caso precedente
|
||||
return GetSideAtMinDistPoint( nInd, vtN, nSide) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetMinDistInfo( int nInd, MinDistPCInfo& aInfo)
|
||||
{
|
||||
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||
return false ;
|
||||
|
||||
aInfo = m_Info[nInd] ;
|
||||
|
||||
Reference in New Issue
Block a user