EgtMachKernel :
- in svuotature gestione SpiralIn e SpiralOut ottimizzate per cerchi - in svuotatura aggiunti attacchi zigzag e elica e uscita Glide - in contornatura miglioramenti vari.
This commit is contained in:
+90
-17
@@ -22,6 +22,7 @@
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EgkArcSpecial.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EgkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EgkIntersCurves.h"
|
||||
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
|
||||
@@ -239,22 +240,16 @@ Operation::GetElevation( int nPhase, const Point3d& ptP,
|
||||
// considero il punto
|
||||
if ( ! GetElevation( nPhase, ptP, vtDir, dElev))
|
||||
return false ;
|
||||
// considero i 4 punti sulla circonferenza
|
||||
Frame3d frLoc ;
|
||||
frLoc.Set( ptP, vtDir) ;
|
||||
double dElevT ;
|
||||
if ( ! GetElevation( nPhase, ptP + frLoc.VersX() * dRad, vtDir, dElevT))
|
||||
return false ;
|
||||
dElev = max( dElev, dElevT) ;
|
||||
if ( ! GetElevation( nPhase, ptP - frLoc.VersX() * dRad, vtDir, dElevT))
|
||||
return false ;
|
||||
dElev = max( dElev, dElevT) ;
|
||||
if ( ! GetElevation( nPhase, ptP + frLoc.VersY() * dRad, vtDir, dElevT))
|
||||
return false ;
|
||||
dElev = max( dElev, dElevT) ;
|
||||
if ( ! GetElevation( nPhase, ptP - frLoc.VersY() * dRad, vtDir, dElevT))
|
||||
return false ;
|
||||
dElev = max( dElev, dElevT) ;
|
||||
// considero 8 punti sulla circonferenza
|
||||
const int N_STEP = 8 ;
|
||||
Vector3d vtRad = FromUprightOrtho( vtDir) * dRad ;
|
||||
for ( int i = 0 ; i < N_STEP ; ++ i) {
|
||||
double dElevT ;
|
||||
vtRad.Rotate( vtDir, ANG_FULL / N_STEP) ;
|
||||
if ( ! GetElevation( nPhase, ptP + vtRad, vtDir, dElevT))
|
||||
return false ;
|
||||
dElev = max( dElev, dElevT) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -326,7 +321,6 @@ Operation::GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double& dDist, Vector3d& vtDir)
|
||||
@@ -454,6 +448,85 @@ Operation::GetRawGlobBox( int nPhase, int nPathId, double dToler, BBox3d& b3Raw)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::ApproxWithArcsIfUseful( ICurveComposite* pCompo)
|
||||
{
|
||||
// costanti di approssimazione
|
||||
const double LIN_TOL_MID = 0.05 ;
|
||||
const double ANG_TOL_STD_DEG = 15 ;
|
||||
const double LIN_FEA_STD = 20 ;
|
||||
// recupero estrusione e spessore
|
||||
Vector3d vtExtr = Z_AX ;
|
||||
pCompo->GetExtrusion( vtExtr) ;
|
||||
double dThick = 0 ;
|
||||
pCompo->GetThickness( dThick) ;
|
||||
// verifico se sono tante linee
|
||||
double dLen = 0 ;
|
||||
pCompo->GetLength( dLen) ;
|
||||
int nCrvs = pCompo->GetCurveCount() ;
|
||||
if ( nCrvs < 5 || dLen > nCrvs * LIN_FEA_STD)
|
||||
return true ;
|
||||
// calcolo approssimazione con archi
|
||||
PolyArc PA ;
|
||||
if ( ! pCompo->ApproxWithArcsEx( LIN_TOL_MID, ANG_TOL_STD_DEG, LIN_FEA_STD, PA))
|
||||
return false ;
|
||||
// sostituisco gli archi alle curve originali
|
||||
pCompo->Clear() ;
|
||||
if ( ! pCompo->FromPolyArc( PA))
|
||||
return false ;
|
||||
// riassegno estrusione e spessore
|
||||
pCompo->SetExtrusion( vtExtr) ;
|
||||
pCompo->SetThickness( dThick) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::ApproxWithLines( ICurveComposite* pCompo)
|
||||
{
|
||||
// recupero estrusione e spessore
|
||||
Vector3d vtExtr = Z_AX ;
|
||||
pCompo->GetExtrusion( vtExtr) ;
|
||||
double dThick = 0 ;
|
||||
pCompo->GetThickness( dThick) ;
|
||||
// calcolo approssimazione lineare
|
||||
const double ANG_TOL_MAX_DEG = 90 ;
|
||||
PolyLine PL ;
|
||||
if ( ! pCompo->ApproxWithLines( 50 * EPS_SMALL, ANG_TOL_MAX_DEG, ICurve::APL_SPECIAL, PL))
|
||||
return false ;
|
||||
// sostituisco le linee alle curve originali
|
||||
pCompo->Clear() ;
|
||||
pCompo->FromPolyLine( PL) ;
|
||||
// riassegno estrusione e spessore
|
||||
pCompo->SetExtrusion( vtExtr) ;
|
||||
pCompo->SetThickness( dThick) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::VerifyArcs( ICurveComposite* pCompo)
|
||||
{
|
||||
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
|
||||
const double MAX_ANG_CEN = 150 + EPS_ANG_SMALL ;
|
||||
int nMaxInd = pCompo->GetCurveCount() - 1 ;
|
||||
for ( int i = 0 ; i <= nMaxInd ; ) {
|
||||
// se arco con angolo al centro oltre il limite, lo divido a metà
|
||||
const ICurveArc* pArc = GetCurveArc( pCompo->GetCurve( i)) ;
|
||||
if ( pArc != nullptr && abs( pArc->GetAngCenter()) > MAX_ANG_CEN) {
|
||||
pCompo->AddJoint( i + 0.5) ;
|
||||
++ nMaxInd ;
|
||||
}
|
||||
else
|
||||
++ i ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
|
||||
Reference in New Issue
Block a user