EgtExchange 1.8j2 :
- correzione in lettura STL ASCII con più spazi - correzioni e migliorie varie in lettura BTL.
This commit is contained in:
+52
-10
@@ -235,7 +235,7 @@ BtlGeom::TrimOutline( int nProcSurfId)
|
||||
-- i ;
|
||||
}
|
||||
}
|
||||
// elimino tratti allineati
|
||||
// unisco tratti allineati
|
||||
for ( int i = 0 ; i < int( vPL.size()) ; ++ i)
|
||||
vPL[i].RemoveAlignedPoints( EPS_SMALL) ;
|
||||
// Divido le curve sulle varie facce del box del pezzo
|
||||
@@ -519,9 +519,10 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPVECTOR& vCrvP)
|
||||
}
|
||||
// se curva aperta, la completo con il contorno della faccia
|
||||
if ( ! pCrvCompo->IsClosed()) {
|
||||
const double EXTRA_LEN = 5 * EPS_SMALL ;
|
||||
// per sicurezza allungo gli estremi
|
||||
pCrvCompo->ExtendStartByLen( 5 * EPS_SMALL) ;
|
||||
pCrvCompo->ExtendEndByLen( 5 * EPS_SMALL) ;
|
||||
pCrvCompo->ExtendStartByLen( EXTRA_LEN) ;
|
||||
pCrvCompo->ExtendEndByLen( EXTRA_LEN) ;
|
||||
// intersezione della curva col contorno
|
||||
IntersCurveCurve intCC( *pCrvCompo, *pFaceCnt) ;
|
||||
int nIntCount = intCC.GetIntersCount() ;
|
||||
@@ -642,18 +643,59 @@ BtlGeom::IsPointOnFaceContour( const Point3d& ptP, bool bPtLocal, int nSide)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::IsPointOnOrNearFaceContour( const Point3d& ptP, bool bPtLocal, int nSide)
|
||||
BtlGeom::IsPointNearFaceContour( const Point3d& ptP, bool bPtLocal, int nSide)
|
||||
{
|
||||
// Punto in riferimento faccia
|
||||
Point3d ptPl = ptP ;
|
||||
if ( ! bPtLocal)
|
||||
ptPl.ToLoc( GetSideFrame( nSide)) ;
|
||||
// Verifico se sta sul contorno o fuori
|
||||
const double EPS_NEAR = 1.0 ;
|
||||
// Verifico se sta vicino al contorno o fuori
|
||||
const double EPS_IN_NEAR = 0.2 ;
|
||||
const double EPS_OUT_NEAR = 1.0 ;
|
||||
double dL = GetSideLength( nSide) ;
|
||||
double dW = GetSideWidth( nSide) ;
|
||||
return ( ( ptPl.x > - EPS_NEAR && ptPl.x < EPS_SMALL) ||
|
||||
( ptPl.x > dL - EPS_SMALL && ptPl.x < dL + EPS_NEAR) ||
|
||||
( ptPl.y > - EPS_NEAR && ptPl.y < EPS_SMALL) ||
|
||||
( ptPl.y > dW - EPS_SMALL && ptPl.y < dW + EPS_NEAR)) ;
|
||||
return ( ( ptPl.x > - EPS_OUT_NEAR && ptPl.x < EPS_IN_NEAR) ||
|
||||
( ptPl.x > dL - EPS_IN_NEAR && ptPl.x < dL + EPS_OUT_NEAR) ||
|
||||
( ptPl.y > - EPS_OUT_NEAR && ptPl.y < EPS_IN_NEAR) ||
|
||||
( ptPl.y > dW - EPS_IN_NEAR && ptPl.y < dW + EPS_OUT_NEAR)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::SetPointOnFaceContour( Point3d& ptP, bool bPtLocal, int nSide)
|
||||
{
|
||||
// Punto in riferimento faccia
|
||||
Point3d ptPl = ptP ;
|
||||
if ( ! bPtLocal)
|
||||
ptPl.ToLoc( GetSideFrame( nSide)) ;
|
||||
// Dimensioni della faccia
|
||||
double dL = GetSideLength( nSide) ;
|
||||
double dW = GetSideWidth( nSide) ;
|
||||
// Sistemazioni per punto esterno
|
||||
if ( ptPl.x < 0)
|
||||
ptPl.x = 0 ;
|
||||
else if ( ptPl.x > dL)
|
||||
ptPl.x = dL ;
|
||||
if ( ptPl.y < 0)
|
||||
ptPl.y = 0 ;
|
||||
else if ( ptPl.y > dW)
|
||||
ptPl.y = dW ;
|
||||
// Sistemazioni per punto interno
|
||||
double vDist[4] = { abs( ptPl.x), abs( ptPl.x - dL), abs( ptPl.y), abs( ptPl.y - dW)} ;
|
||||
int nMinDistSide = 0 ;
|
||||
for ( int i = 1 ; i < 4 ; ++i) {
|
||||
if ( vDist[i] < vDist[nMinDistSide])
|
||||
nMinDistSide = i ;
|
||||
}
|
||||
switch ( nMinDistSide) {
|
||||
case 0 : ptPl.x = 0 ; break ;
|
||||
case 1 : ptPl.x = dL ; break ;
|
||||
case 2 : ptPl.y = 0 ; break ;
|
||||
case 3 : ptPl.y = dW ; break ;
|
||||
}
|
||||
// Riporto punto nel suo riferimento
|
||||
if ( ! bPtLocal)
|
||||
ptPl.ToGlob( GetSideFrame( nSide)) ;
|
||||
ptP = ptPl ;
|
||||
return true ;
|
||||
}
|
||||
Reference in New Issue
Block a user