EgtGeomKernel :
- in CAvToolSurfTm eliminata SetMoveDir e aggiunto parametro equivalente in TestPosition e TestPath - in VolZmap migliorato calcolo BBox del movimento utensile.
This commit is contained in:
+24
-25
@@ -49,13 +49,6 @@ CAvToolSurfTm::SetSurfTm( const ISurfTriMesh& Stm)
|
||||
return ( m_pSTm != nullptr && m_pSTm->IsValid()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::SetMoveDir( const Vector3d& vtMove)
|
||||
{
|
||||
return m_frMove.Set( ORIG, vtMove) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::SetStdTool( double dH, double dR, double dCornR)
|
||||
@@ -86,8 +79,17 @@ CAvToolSurfTm::SetGenTool( const ICurveComposite* pToolOutline)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::TestPosition( const Point3d& ptT, const Vector3d& vtDir, double& dTotDist)
|
||||
CAvToolSurfTm::TestPosition( const Point3d& ptT, const Vector3d& vtDir, const Vector3d& vtMove, double& dTotDist)
|
||||
{
|
||||
// Se utensile non definito, errore
|
||||
if ( m_Tool.GetType() == Tool::UNDEF)
|
||||
return false ;
|
||||
// Imposto il riferimento di movimento
|
||||
if ( ! AreSameOrOppositeVectorApprox( vtDir, vtMove))
|
||||
m_frMove.Set( ORIG, vtMove, vtDir) ;
|
||||
else
|
||||
m_frMove.Set( ORIG, vtMove, vtDir) ;
|
||||
// Eseguo controllo
|
||||
Point3d ptCurr = ptT ;
|
||||
dTotDist = MyTestPosition( ptCurr, vtDir) ;
|
||||
return ( dTotDist > - EPS_SMALL) ;
|
||||
@@ -95,7 +97,7 @@ CAvToolSurfTm::TestPosition( const Point3d& ptT, const Vector3d& vtDir, double&
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::TestPath( PNTULIST& lPntM, const Vector3d& vtDir, double dLinTol)
|
||||
CAvToolSurfTm::TestPath( PNTULIST& lPntM, const Vector3d& vtDir, const Vector3d& vtMove, double dLinTol)
|
||||
{
|
||||
// Se utensile non definito, errore
|
||||
if ( m_Tool.GetType() == Tool::UNDEF)
|
||||
@@ -103,6 +105,11 @@ CAvToolSurfTm::TestPath( PNTULIST& lPntM, const Vector3d& vtDir, double dLinTol)
|
||||
// Se lista vuota, non devo fare alcunché
|
||||
if ( lPntM.empty())
|
||||
return true ;
|
||||
// Imposto il riferimento di movimento
|
||||
if ( ! AreSameOrOppositeVectorApprox( vtDir, vtMove))
|
||||
m_frMove.Set( ORIG, vtMove, vtDir) ;
|
||||
else
|
||||
m_frMove.Set( ORIG, vtMove) ;
|
||||
// Predispongo Hash Grid
|
||||
if ( ! PrepareHashGrid())
|
||||
return false ;
|
||||
@@ -269,32 +276,24 @@ CAvToolSurfTm::MyTestPositionHG( Point3d& ptT, const Vector3d& vtDir)
|
||||
{
|
||||
// calcolo box utensile nel riferimento di movimento
|
||||
BBox3d b3Tool ;
|
||||
Point3d ptTL = ptT ; ptTL.ToLoc( m_frMove) ;
|
||||
Vector3d vtDirL = vtDir ; vtDirL.ToLoc( m_frMove) ;
|
||||
b3Tool.Add( ptTL) ;
|
||||
b3Tool.Add( ptTL - vtDirL * m_Tool.GetHeigth()) ;
|
||||
if ( AreSameOrOppositeVectorApprox( vtDir, m_frMove.VersX())) {
|
||||
Point3d ptTL = ptT ; ptTL.ToLoc( m_frMove) ;
|
||||
Vector3d vtDirL = vtDir ; vtDirL.ToLoc( m_frMove) ;
|
||||
b3Tool.Add( ptTL) ;
|
||||
b3Tool.Add( ptTL - vtDirL * m_Tool.GetHeigth()) ;
|
||||
b3Tool.Expand( 0, m_Tool.GetRadius(), m_Tool.GetRadius()) ;
|
||||
}
|
||||
else if ( AreSameOrOppositeVectorApprox( vtDir, m_frMove.VersY())) {
|
||||
Point3d ptTL = ptT ; ptTL.ToLoc( m_frMove) ;
|
||||
Vector3d vtDirL = vtDir ; vtDirL.ToLoc( m_frMove) ;
|
||||
b3Tool.Add( ptTL) ;
|
||||
b3Tool.Add( ptTL - vtDirL * m_Tool.GetHeigth()) ;
|
||||
b3Tool.Expand( m_Tool.GetRadius(), 0, m_Tool.GetRadius()) ;
|
||||
}
|
||||
else if ( AreSameOrOppositeVectorApprox( vtDir, m_frMove.VersZ())) {
|
||||
Point3d ptTL = ptT ; ptTL.ToLoc( m_frMove) ;
|
||||
Vector3d vtDirL = vtDir ; vtDirL.ToLoc( m_frMove) ;
|
||||
b3Tool.Add( ptTL) ;
|
||||
b3Tool.Add( ptTL - vtDirL * m_Tool.GetHeigth()) ;
|
||||
b3Tool.Expand( m_Tool.GetRadius(), m_Tool.GetRadius(), 0) ;
|
||||
}
|
||||
else {
|
||||
b3Tool.Add( ptT) ;
|
||||
b3Tool.Add( ptT - vtDir * m_Tool.GetHeigth()) ;
|
||||
b3Tool.Expand( m_Tool.GetRadius(), m_Tool.GetRadius(), 0) ;
|
||||
b3Tool.ToLoc( m_frMove) ;
|
||||
double dExpandX = m_Tool.GetRadius() * sqrt( 1 - vtDirL.x * vtDirL.x) ;
|
||||
double dExpandY = m_Tool.GetRadius() * sqrt( 1 - vtDirL.y * vtDirL.y) ;
|
||||
double dExpandZ = m_Tool.GetRadius() * sqrt( 1 - vtDirL.z * vtDirL.z) ;
|
||||
b3Tool.Expand( dExpandX, dExpandY, dExpandZ) ;
|
||||
}
|
||||
// ciclo sui triangoli che intersecano box in 2d
|
||||
double dTotDist = 0 ;
|
||||
|
||||
+2
-3
@@ -25,7 +25,6 @@ class CAvToolSurfTm : public ICAvToolSurfTm
|
||||
{
|
||||
public : // ICAvToolSurfTm
|
||||
bool SetSurfTm( const ISurfTriMesh& Stm) override ;
|
||||
bool SetMoveDir( const Vector3d& vtrMove) override ;
|
||||
bool SetStdTool( double dH, double dR, double dCornR) override ;
|
||||
bool SetAdvTool( double dH, double dR, double dTipH, double dTipR, double dCornR) override ;
|
||||
bool SetSawTool( double dH, double dR, double dThick, double dStemR, double dCornR) override ;
|
||||
@@ -36,8 +35,8 @@ class CAvToolSurfTm : public ICAvToolSurfTm
|
||||
{ return m_Tool.GetHeigth() ; }
|
||||
const ICurveComposite& GetToolOutline( bool bApprox = false) const override
|
||||
{ return ( bApprox ? m_Tool.GetApproxOutline() : m_Tool.GetOutline()) ;}
|
||||
bool TestPosition( const Point3d& ptT, const Vector3d& vtDir, double& dTotDist) override ;
|
||||
bool TestPath( PNTULIST& lPntM, const Vector3d& vtDir, double dLinTol) override ;
|
||||
bool TestPosition( const Point3d& ptT, const Vector3d& vtDir, const Vector3d& vtMove, double& dTotDist) override ;
|
||||
bool TestPath( PNTULIST& lPntM, const Vector3d& vtDir, const Vector3d& vtMove, double dLinTol) override ;
|
||||
|
||||
public :
|
||||
CAvToolSurfTm( void) ;
|
||||
|
||||
+1
-1
@@ -135,7 +135,7 @@ Frame3d::Set( const Point3d& ptOrig, const Vector3d& vtDirZ, const Vector3d& vtN
|
||||
m_vtVersY = m_vtVersZ ^ vtNearDirX ;
|
||||
if ( ! m_vtVersY.Normalize())
|
||||
return false ;
|
||||
// verzsore X
|
||||
// versore X
|
||||
m_vtVersX = m_vtVersY ^ m_vtVersZ ;
|
||||
if ( ! m_vtVersX.Normalize())
|
||||
return false ;
|
||||
|
||||
@@ -77,6 +77,7 @@ Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR,
|
||||
m_nCurrentNum = nToolNum ;
|
||||
m_nType = UNDEF ;
|
||||
m_Outline.Clear() ;
|
||||
m_ArcLineApprox.Clear() ;
|
||||
|
||||
// verifica sulle minime dimensioni globali
|
||||
if ( dH < EPS_SMALL || dR < EPS_SMALL || dCornR < - EPS_SMALL)
|
||||
@@ -96,7 +97,6 @@ Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR,
|
||||
Point3d pt1( m_dRadius, 0, 0) ;
|
||||
Point3d pt3( m_dRadius, - m_dHeight, 0) ;
|
||||
Point3d pt4( 0, - m_dHeight, 0) ;
|
||||
m_Outline.Clear() ;
|
||||
m_Outline.AddPoint( pt0) ;
|
||||
m_Outline.AddLine( pt1);
|
||||
m_Outline.AddLine( pt3) ;
|
||||
@@ -117,7 +117,6 @@ Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR,
|
||||
Point3d pt2( m_dRadius, - m_dHeight + m_dTipHeight, 0) ;
|
||||
Point3d pt3( m_dTipRadius, - m_dHeight, 0) ;
|
||||
Point3d pt4( 0, - m_dHeight, 0) ;
|
||||
m_Outline.Clear() ;
|
||||
m_Outline.AddPoint( pt0) ;
|
||||
m_Outline.AddLine( pt1);
|
||||
m_Outline.AddLine( pt2);
|
||||
@@ -141,7 +140,6 @@ Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR,
|
||||
Point3d pt1( m_dRadius, 0, 0) ;
|
||||
Point3d pt2( m_dRadius, - m_dHeight + m_dTipHeight, 0) ;
|
||||
Point3d pt4( 0, - m_dHeight, 0) ;
|
||||
m_Outline.Clear() ;
|
||||
m_Outline.AddPoint( pt0) ;
|
||||
m_Outline.AddLine( pt1);
|
||||
m_Outline.AddLine( pt2);
|
||||
@@ -164,6 +162,7 @@ Tool::SetAdvTool( const string& sToolName, double dH, double dR,
|
||||
m_nCurrentNum = nToolNum ;
|
||||
m_nType = UNDEF ;
|
||||
m_Outline.Clear() ;
|
||||
m_ArcLineApprox.Clear() ;
|
||||
|
||||
// Verifica dimensioni globali
|
||||
if ( dH < EPS_SMALL || dR < EPS_SMALL || dTipH < - EPS_SMALL || dTipR < - EPS_SMALL || dCornR < - EPS_SMALL)
|
||||
@@ -314,6 +313,7 @@ Tool::SetSawTool( const string& sToolName, double dH, double dR,
|
||||
m_nType = UNDEF ;
|
||||
m_nCurrentNum = nToolNum ;
|
||||
m_Outline.Clear() ;
|
||||
m_ArcLineApprox.Clear() ;
|
||||
|
||||
// Verifica dimensioni globali
|
||||
if ( dH < EPS_SMALL || dR < EPS_SMALL || dThick < EPS_SMALL || dStemR < - EPS_SMALL || dCornR < - EPS_SMALL)
|
||||
@@ -393,15 +393,13 @@ Tool::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline,
|
||||
m_nCurrentNum = nToolNum ;
|
||||
if ( pToolOutline != &m_Outline)
|
||||
m_Outline.Clear() ;
|
||||
m_ArcLineApprox.Clear() ;
|
||||
|
||||
// Copio il profilo e garantisco sia di soli archi e rette (converto eventuali curve di Bezier)
|
||||
if ( ! m_Outline.CopyFrom( pToolOutline) ||
|
||||
! m_Outline.ArcsBezierCurvesToArcsPerpExtr( m_dLinTol, m_dAngTolDeg))
|
||||
return false ;
|
||||
|
||||
// Flag di avvenuta approssimazione
|
||||
bool bApprox = false ;
|
||||
|
||||
// Ciclo sulle curve componenti
|
||||
const ICurve* pCurve = m_Outline.GetFirstCurve() ;
|
||||
while ( pCurve != nullptr) {
|
||||
@@ -440,7 +438,6 @@ Tool::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline,
|
||||
while ( plyApprox.GetNextPoint( ptEnd)) {
|
||||
m_ArcLineApprox.AddLine( ptEnd) ;
|
||||
}
|
||||
bApprox = true ;
|
||||
}
|
||||
// altrimenti lo aggiungo semplicemente
|
||||
else
|
||||
@@ -453,11 +450,6 @@ Tool::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline,
|
||||
pCurve = m_Outline.GetNextCurve() ;
|
||||
}
|
||||
|
||||
// Se non ci sono state approssimazioni, cancello la curva approssimante
|
||||
if ( ! bApprox)
|
||||
m_ArcLineApprox.Clear() ;
|
||||
|
||||
|
||||
// Il profilo dell'utensile deve stare nel 1° e 4° quadrante del piano XY
|
||||
BBox3d Bounding ;
|
||||
m_Outline.GetLocalBBox( Bounding) ;
|
||||
@@ -486,6 +478,7 @@ Tool::SetMortiserTool( const string& sToolName, double dH, double dW, double dTh
|
||||
m_nCurrentNum = nToolNum ;
|
||||
m_nType = UNDEF ;
|
||||
m_Outline.Clear() ;
|
||||
m_ArcLineApprox.Clear() ;
|
||||
|
||||
// Verifica dimensioni globali
|
||||
if ( dH < EPS_SMALL || dW < EPS_SMALL ||
|
||||
@@ -512,6 +505,7 @@ Tool::SetChiselTool( const string& sToolName, double dH, double dW, double dTh,
|
||||
m_nCurrentNum = nToolNum ;
|
||||
m_nType = UNDEF ;
|
||||
m_Outline.Clear() ;
|
||||
m_ArcLineApprox.Clear() ;
|
||||
|
||||
// Verifica dimensioni globali
|
||||
if ( dH < EPS_SMALL || dW < EPS_SMALL || dTh < 0)
|
||||
|
||||
@@ -267,15 +267,15 @@ class VolZmap : public IVolZmap, public IGeoObjRW
|
||||
const Vector3d& vtToolDir, const Vector3d& vtAux) ; // E' in realtà MillingPerp
|
||||
// Generica traslazione sfera
|
||||
bool CompBall_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, double dRad) ;
|
||||
// BBox per utensili e solidi semplici in movimenti di traslazione pura; in futuro si dovrà implementare le routine che prevedono rotazioni
|
||||
inline bool BoundingBox( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV,
|
||||
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ) ;
|
||||
inline bool BBoxComponent( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV,
|
||||
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ,
|
||||
double dRad, double dTipRad, double dHei) ;
|
||||
inline bool BBoxParaComp( unsigned int nGrid, double dLenX, double dLenY, double dLenZ,
|
||||
const Point3d& ptS, const Point3d& ptE, const Vector3d& vtD, const Vector3d& vtA,
|
||||
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ) ;
|
||||
// BBox per utensili e solidi semplici con movimenti di traslazione
|
||||
inline bool TestToolBBox( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV,
|
||||
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ) ;
|
||||
inline bool TestCompoBBox( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV,
|
||||
double dRad, double dTipRad, double dHei,
|
||||
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ) ;
|
||||
inline bool TestParaBBox( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtD, const Vector3d& vtA,
|
||||
double dLenX, double dLenY, double dLenZ,
|
||||
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ) ;
|
||||
// Intersezioni
|
||||
bool IntersLineBox( const Point3d& ptP, const Vector3d& vtV, const Point3d& ptMin, const Point3d& ptMax) const ;
|
||||
bool IntersLineBox( const Point3d& ptP, const Vector3d& vtV, const Point3d& ptMin, const Point3d& ptMax,
|
||||
|
||||
+96
-157
@@ -763,12 +763,9 @@ VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d&
|
||||
bool
|
||||
VolZmap::CylBall_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir)
|
||||
{
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
|
||||
// Verifica sull'interferenza utensile Zmap
|
||||
bool bTest = BoundingBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ) ;
|
||||
|
||||
if ( ! bTest)
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
if ( ! TestToolBBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Proiezione dei punti sul piano
|
||||
@@ -823,9 +820,7 @@ VolZmap::CylBall_ZPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& p
|
||||
{
|
||||
// Verifica sull'interferenza utensile Zmap
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bTest = BoundingBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ) ;
|
||||
|
||||
if ( ! bTest)
|
||||
if ( ! TestToolBBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Parametri geometrici dell'utensile
|
||||
@@ -951,9 +946,7 @@ VolZmap::CylBall_ZMilling( unsigned int nGrid, const Point3d & ptS, const Point3
|
||||
{
|
||||
// Verifica sull'interferenza utensile Zmap
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bTest = BoundingBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ) ;
|
||||
|
||||
if ( ! bTest)
|
||||
if ( ! TestToolBBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Parametri geometrici dell'utensile
|
||||
@@ -1086,9 +1079,7 @@ VolZmap::Conus_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d
|
||||
{
|
||||
// Verifica sull'interferenza utensile Zmap
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bTest = BoundingBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ) ;
|
||||
|
||||
if ( ! bTest)
|
||||
if ( ! TestToolBBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Parametri geometrici dell'utensile
|
||||
@@ -1229,9 +1220,7 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
|
||||
{
|
||||
// Verifica sull'interferenza utensile Zmap
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bTest = BoundingBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ) ;
|
||||
|
||||
if ( ! bTest)
|
||||
if ( ! TestToolBBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Parametri geometrici dell'utensile
|
||||
@@ -1834,8 +1823,7 @@ VolZmap::CylBall_XYDrilling( unsigned int nGrid, const Point3d& ptS, const Point
|
||||
{
|
||||
// Verifica sull'interferenza utensile Zmap
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bTest = BoundingBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ) ;
|
||||
if ( ! bTest)
|
||||
if ( ! TestToolBBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Parametri geometrici dell'utensile e quota Z del movimento
|
||||
@@ -1917,8 +1905,7 @@ VolZmap::CylBall_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d&
|
||||
{
|
||||
// Verifica sull'interferenza utensile Zmap
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bTest = BoundingBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ) ;
|
||||
if ( ! bTest)
|
||||
if ( ! TestToolBBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Parametri geometrici dell'utensile
|
||||
@@ -2202,8 +2189,7 @@ VolZmap::Conus_XYDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d
|
||||
{
|
||||
// Verifica sull'interferenza utensile Zmap
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bTest = BoundingBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ) ;
|
||||
if ( ! bTest)
|
||||
if ( ! TestToolBBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Parametri geometrici dell'utensile
|
||||
@@ -2332,8 +2318,7 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
|
||||
{
|
||||
// Verifica sull'interferenza utensile Zmap
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bTest = BoundingBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ) ;
|
||||
if ( ! bTest)
|
||||
if ( ! TestToolBBox( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Parametri geometrici dell'utensile
|
||||
@@ -3080,12 +3065,11 @@ VolZmap::GenTool_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d&
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::CompCyl_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir, double dHei, double dRad)
|
||||
VolZmap::CompCyl_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dRad)
|
||||
{
|
||||
// Verifica sull'interferenza con lo Zmap
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bInterf = BBoxComponent( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ, dRad, dRad, dHei) ;
|
||||
if ( ! bInterf)
|
||||
if ( ! TestCompoBBox( nGrid, ptS, ptE, vtToolDir, dRad, dRad, dHei, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Proiezione dei punti sul piano
|
||||
@@ -3124,12 +3108,11 @@ VolZmap::CompCyl_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::CompConus_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir, double dHei, double dMaxRad, double dMinRad)
|
||||
VolZmap::CompConus_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad)
|
||||
{
|
||||
// Verifica sull'interferenza con lo Zmap
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bInterf = BBoxComponent( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ, dMaxRad, dMinRad, dHei) ;
|
||||
if ( ! bInterf)
|
||||
if ( ! TestCompoBBox( nGrid, ptS, ptE, vtToolDir, dMaxRad, dMinRad, dHei, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
Point3d ptO( ptS.x, ptS.y, 0) ;
|
||||
@@ -3230,8 +3213,7 @@ VolZmap::CompPar_ZDrilling( unsigned int nGrid, double dLenX, double dLenY, doub
|
||||
|
||||
// Controllo sull'interferenza utensile-solido
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bInterf = BBoxParaComp( nGrid, dLenX, dLenY, dLenZ, ptMyS, ptMyE, vtToolDir, vtAux, nStartI, nStartJ, nEndI, nEndJ) ;
|
||||
if ( ! bInterf)
|
||||
if ( ! TestParaBBox( nGrid, ptMyS, ptMyE, vtToolDir, vtAux, dLenX, dLenY, dLenZ, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Costruisco un sistema di riferimento nel piano
|
||||
@@ -3267,12 +3249,11 @@ VolZmap::CompPar_ZDrilling( unsigned int nGrid, double dLenX, double dLenY, doub
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::CompCyl_ZMilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir, double dHei, double dRad)
|
||||
VolZmap::CompCyl_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dRad)
|
||||
{
|
||||
// Verifica sull'interferenza con lo Zmap
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bInterf = BBoxComponent( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ, dRad, dRad, dHei) ;
|
||||
if ( ! bInterf)
|
||||
if ( ! TestCompoBBox( nGrid, ptS, ptE, vtToolDir, dRad, dRad, dHei, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Parametri geometrici
|
||||
@@ -3399,8 +3380,7 @@ bool
|
||||
VolZmap::CompConus_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad)
|
||||
{
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bInterf = BBoxComponent( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ, dMaxRad, dMinRad, dHei) ;
|
||||
if ( ! bInterf)
|
||||
if ( ! TestCompoBBox( nGrid, ptS, ptE, vtToolDir, dMaxRad, dMinRad, dHei, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
Point3d ptI = ( vtToolDir * ( ptE - ptS) > 0 ? ptS : ptE) ;
|
||||
@@ -3679,8 +3659,7 @@ VolZmap::CompPar_ZMilling( unsigned int nGrid, double dLenX, double dLenY, doubl
|
||||
|
||||
// Controllo sull'interferenza utensile-solido
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bInterf = BBoxParaComp( nGrid, dLenX, dLenY, dLenZ, ptMyS, ptMyE, vtToolDir, vtAux, nStartI, nStartJ, nEndI, nEndJ) ;
|
||||
if ( ! bInterf)
|
||||
if ( ! TestParaBBox( nGrid, ptMyS, ptMyE, vtToolDir, vtAux, dLenX, dLenY, dLenZ, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Quote estreme Z
|
||||
@@ -3757,9 +3736,7 @@ VolZmap::CompCyl_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d
|
||||
{
|
||||
// Verifico che il cilindro con il suo movimento intersechi la griglia
|
||||
unsigned int nStartI, nEndI, nStartJ, nEndJ ;
|
||||
bool bInterf = BBoxComponent( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ,
|
||||
dRad, dRad, dHei) ;
|
||||
if ( ! bInterf)
|
||||
if ( ! TestCompoBBox( nGrid, ptS, ptE, vtToolDir, dRad, dRad, dHei, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Studio delle simmetrie
|
||||
@@ -3791,9 +3768,7 @@ VolZmap::CompConus_Drilling( unsigned int nGrid, const Point3d& ptS, const Point
|
||||
double dHei, double dMaxRad, double dMinRad, bool bTapB, bool bTapT)
|
||||
{
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bInterf = BBoxComponent( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ,
|
||||
dMaxRad, dMinRad, dHei) ;
|
||||
if ( ! bInterf)
|
||||
if ( ! TestCompoBBox( nGrid, ptS, ptE, vtToolDir, dMaxRad, dMinRad, dHei, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Apertura del cono
|
||||
@@ -3855,8 +3830,7 @@ VolZmap::CompPar_Drilling( unsigned int nGrid, double dLenX, double dLenY, doubl
|
||||
|
||||
// Controllo sull'interferenza utensile-solido
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bInterf = BBoxParaComp( nGrid, dLenX, dLenY, dLenZ, ptMyS, ptMyE, vtToolDir, vtAux, nStartI, nStartJ, nEndI, nEndJ) ;
|
||||
if ( ! bInterf)
|
||||
if ( ! TestParaBBox( nGrid, ptMyS, ptMyE, vtToolDir, vtAux, dLenX, dLenY, dLenZ, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Costruzione di un sistema di riferimento per il volume
|
||||
@@ -3897,9 +3871,7 @@ VolZmap::CompCyl_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d&
|
||||
{
|
||||
// Verifica sull'interferenza utensile Zmap
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bInterf = BBoxComponent( nGrid, ptS, ptE, vtToolDir,
|
||||
nStartI, nStartJ, nEndI, nEndJ, dRad, dRad, dHei) ;
|
||||
if ( ! bInterf)
|
||||
if ( ! TestCompoBBox( nGrid, ptS, ptE, vtToolDir, dRad, dRad, dHei, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Studio delle simmetrie
|
||||
@@ -3985,7 +3957,7 @@ VolZmap::CompConus_Milling( unsigned int nGrid, const Point3d& ptS, const Point3
|
||||
{
|
||||
// Verifico interferenza
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
if ( ! BBoxComponent( nGrid, ptS, ptE, vtToolDir, nStartI, nStartJ, nEndI, nEndJ, dMaxRad, dMinRad, dHei))
|
||||
if ( ! TestCompoBBox( nGrid, ptS, ptE, vtToolDir, dMaxRad, dMinRad, dHei, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Geometria del cono
|
||||
@@ -4281,8 +4253,7 @@ VolZmap::CompPar_Milling( unsigned int nGrid, double dLenX, double dLenY, double
|
||||
|
||||
// Controllo sull'interferenza utensile-solido
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bInterf = BBoxParaComp( nGrid, dLenX, dLenY, dLenZ, ptMyS, ptMyE, vtToolDir, vtAux, nStartI, nStartJ, nEndI, nEndJ) ;
|
||||
if ( ! bInterf)
|
||||
if ( ! TestParaBBox( nGrid, ptMyS, ptMyE, vtToolDir, vtAux, dLenX, dLenY, dLenZ, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
|
||||
// Vettore di movimento
|
||||
@@ -4346,17 +4317,17 @@ VolZmap::CompPar_Milling( unsigned int nGrid, double dLenX, double dLenY, double
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::CompBall_Milling( unsigned int nGrid, const Point3d & ptLs, const Point3d & ptLe, double dRad)
|
||||
VolZmap::CompBall_Milling( unsigned int nGrid, const Point3d& ptLs, const Point3d& ptLe, double dRad)
|
||||
{
|
||||
// Verifico interferisca
|
||||
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
|
||||
bool bInterf = BBoxComponent( nGrid, ptLs, ptLe, V_NULL, nStartI, nStartJ, nEndI, nEndJ, dRad, 0, 0) ;
|
||||
if ( ! bInterf)
|
||||
if ( ! TestCompoBBox( nGrid, ptLs, ptLe, V_NULL, dRad, 0, 0, nStartI, nStartJ, nEndI, nEndJ))
|
||||
return true ;
|
||||
// Vettore modivemnto
|
||||
Vector3d vtV = ptLe - ptLs ;
|
||||
double dLengthPath = vtV.Len() ;
|
||||
vtV.Normalize() ;
|
||||
if ( dLengthPath > EPS_ZERO)
|
||||
vtV /= dLengthPath ;
|
||||
// Riferimento per cilindro inviluppo della sfera lungo il movimento
|
||||
Frame3d CylFrame ;
|
||||
CylFrame.Set( ptLs, vtV) ;
|
||||
@@ -4368,35 +4339,29 @@ VolZmap::CompBall_Milling( unsigned int nGrid, const Point3d & ptLs, const Point
|
||||
|
||||
double dX = ( i + 0.5) * m_dStep ;
|
||||
double dY = ( j + 0.5) * m_dStep ;
|
||||
|
||||
Point3d ptC( dX, dY, 0) ;
|
||||
|
||||
double dStSqDXY = SqDistXY( ptC, ptLs) ;
|
||||
double dEnSqDXY = SqDistXY( ptC, ptLe) ;
|
||||
|
||||
// Sfera in posizione start
|
||||
double dStSqDXY = SqDistXY( ptC, ptLs) ;
|
||||
if ( dStSqDXY < dSqRad) {
|
||||
double dMin = ptLs.z - sqrt( dSqRad - dStSqDXY) ;
|
||||
double dMax = ptLs.z + sqrt( dSqRad - dStSqDXY) ;
|
||||
|
||||
Vector3d vtNmin = ptLs - Point3d( dX, dY, dMin) ;
|
||||
vtNmin.Normalize() ;
|
||||
double dMax = ptLs.z + sqrt( dSqRad - dStSqDXY) ;
|
||||
Vector3d vtNmax = ptLs - Point3d( dX, dY, dMax) ;
|
||||
vtNmax.Normalize() ;
|
||||
|
||||
SubtractIntervals( nGrid, i, j, dMin, dMax, vtNmin, vtNmax) ;
|
||||
}
|
||||
|
||||
// Sfera in posizione end
|
||||
double dEnSqDXY = SqDistXY( ptC, ptLe) ;
|
||||
if ( dEnSqDXY < dSqRad) {
|
||||
double dMin = ptLe.z - sqrt( dSqRad - dEnSqDXY) ;
|
||||
double dMax = ptLe.z + sqrt( dSqRad - dEnSqDXY) ;
|
||||
|
||||
Vector3d vtNmin = ptLe - Point3d( dX, dY, dMin) ;
|
||||
vtNmin.Normalize() ;
|
||||
double dMax = ptLe.z + sqrt( dSqRad - dEnSqDXY) ;
|
||||
Vector3d vtNmax = ptLe - Point3d( dX, dY, dMax) ;
|
||||
vtNmax.Normalize() ;
|
||||
|
||||
SubtractIntervals( nGrid, i, j, dMin, dMax, vtNmin, vtNmax) ;
|
||||
}
|
||||
|
||||
@@ -4404,15 +4369,7 @@ VolZmap::CompBall_Milling( unsigned int nGrid, const Point3d & ptLs, const Point
|
||||
Point3d ptInt1, ptInt2 ;
|
||||
Vector3d vtN1, vtN2 ;
|
||||
if ( IntersLineCylinder( ptC, Z_AX, CylFrame, dLengthPath, dRad, false, false, ptInt1, vtN1, ptInt2, vtN2)) {
|
||||
double dMin = ptInt1.z ;
|
||||
double dMax = ptInt2.z ;
|
||||
Vector3d vtNmin = vtN1 ;
|
||||
Vector3d vtNmax = vtN2 ;
|
||||
if ( ptInt1.z > ptInt2.z) {
|
||||
swap( dMin, dMax) ;
|
||||
swap( vtNmin, vtNmax) ;
|
||||
}
|
||||
SubtractIntervals( nGrid, i, j, dMin, dMax, vtNmin, vtNmax) ;
|
||||
SubtractIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, vtN1, vtN2) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4423,61 +4380,63 @@ VolZmap::CompBall_Milling( unsigned int nGrid, const Point3d & ptLs, const Point
|
||||
// ------------------------- BOUNDING BOX --------------------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline bool
|
||||
VolZmap::BoundingBox( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV,
|
||||
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ)
|
||||
inline BBox3d
|
||||
GetCylMoveBBox( const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV, double dRad, double dH)
|
||||
{
|
||||
// I punti e i vettori devono essere nel sistema di riferimento opportuno
|
||||
// Determinazione delle posizioni della punta del componente nelle posizioni iniziale e finale
|
||||
Point3d ptP1T = ptP1 - dH * vtV ;
|
||||
Point3d ptP2T = ptP2 - dH * vtV ;
|
||||
// Calcolo del box del movimento dell'asse
|
||||
BBox3d b3Box ;
|
||||
b3Box.Add( ptP1) ;
|
||||
b3Box.Add( ptP1T) ;
|
||||
b3Box.Add( ptP2) ;
|
||||
b3Box.Add( ptP2T) ;
|
||||
// Aggiungo ingombro raggio
|
||||
if ( AreSameOrOppositeVectorApprox( vtV, X_AX))
|
||||
b3Box.Expand( 0, dRad, dRad) ;
|
||||
else if ( AreSameOrOppositeVectorApprox( vtV, Y_AX))
|
||||
b3Box.Expand( dRad, 0, dRad) ;
|
||||
else if ( AreSameOrOppositeVectorApprox( vtV, Z_AX))
|
||||
b3Box.Expand( dRad, dRad, 0) ;
|
||||
else {
|
||||
double dExpandX = dRad * sqrt( 1 - vtV.x * vtV.x) ;
|
||||
double dExpandY = dRad * sqrt( 1 - vtV.y * vtV.y) ;
|
||||
double dExpandZ = dRad * sqrt( 1 - vtV.z * vtV.z) ;
|
||||
b3Box.Expand( dExpandX, dExpandY, dExpandZ) ;
|
||||
}
|
||||
// Restituisco il box calcolato
|
||||
return b3Box ;
|
||||
}
|
||||
|
||||
// Controllo sull'ammissibilità del numero di griglia
|
||||
if ( nGrid < 0 || nGrid > 2)
|
||||
return false ;
|
||||
|
||||
unsigned int nMaxNx = m_nNx[nGrid] ;
|
||||
unsigned int nMaxNy = m_nNy[nGrid] ;
|
||||
|
||||
double dMaxXValue = nMaxNx * m_dStep ;
|
||||
double dMaxYValue = nMaxNy * m_dStep ;
|
||||
double dMinZValue = m_dMinZ[nGrid] ;
|
||||
double dMaxZValue = m_dMaxZ[nGrid] ;
|
||||
|
||||
// Determinazione del raggio massimo dell'utensile
|
||||
double dMaxRad = max( m_Tool.GetRadius(), m_Tool.GetTipRadius()) ;
|
||||
|
||||
// Determinazione delle posizioni della punta dell'utensile nelle posizioni iniziale e finale
|
||||
Point3d ptP1T = ptP1 - m_Tool.GetHeigth() * vtV ;
|
||||
Point3d ptP2T = ptP2 - m_Tool.GetHeigth() * vtV ;
|
||||
|
||||
// Determinazione dei limiti del più piccolo parallelepipedo contenente il movimento
|
||||
double dMinX = min( min( ptP1.x, ptP1T.x), min( ptP2.x, ptP2T.x)) - dMaxRad ;
|
||||
double dMinY = min( min( ptP1.y, ptP1T.y), min( ptP2.y, ptP2T.y)) - dMaxRad ;
|
||||
double dMinZ = min( min( ptP1.z, ptP1T.z), min( ptP2.z, ptP2T.z)) - dMaxRad ;
|
||||
double dMaxX = max( max( ptP1.x, ptP1T.x), max( ptP2.x, ptP2T.x)) + dMaxRad ;
|
||||
double dMaxY = max( max( ptP1.y, ptP1T.y), max( ptP2.y, ptP2T.y)) + dMaxRad ;
|
||||
double dMaxZ = max( max( ptP1.z, ptP1T.z), max( ptP2.z, ptP2T.z)) + dMaxRad ;
|
||||
|
||||
// Verifica dell'interferenza dell'utensile con lo Zmap
|
||||
if ( dMaxX < EPS_SMALL || dMinX > dMaxXValue - EPS_SMALL)
|
||||
return false ;
|
||||
if ( dMaxY < EPS_SMALL || dMinY > dMaxYValue - EPS_SMALL)
|
||||
return false ;
|
||||
if ( dMaxZ < dMinZValue + EPS_SMALL || dMinZ > dMaxZValue - EPS_SMALL)
|
||||
return false ;
|
||||
|
||||
// Limiti su indici
|
||||
nStI = ( dMinX < EPS_SMALL ? 0 : static_cast <unsigned int> ( dMinX / m_dStep)) ;
|
||||
nEnI = ( dMaxX > dMaxXValue - EPS_SMALL ? nMaxNx - 1 : static_cast <unsigned int> ( dMaxX / m_dStep)) ;
|
||||
nStJ = ( dMinY < EPS_SMALL ? 0 : static_cast <unsigned int> ( dMinY / m_dStep)) ;
|
||||
nEnJ = ( dMaxY > dMaxYValue - EPS_SMALL ? nMaxNy - 1 : static_cast <unsigned int> ( dMaxY / m_dStep)) ;
|
||||
|
||||
return true ;
|
||||
//----------------------------------------------------------------------------
|
||||
inline BBox3d
|
||||
GetSphereMoveBBox( const Point3d& ptP1, const Point3d& ptP2, double dRad)
|
||||
{
|
||||
// Calcolo del box del movimento del centro
|
||||
BBox3d b3Box ;
|
||||
b3Box.Add( ptP1) ;
|
||||
b3Box.Add( ptP2) ;
|
||||
// Aggiungo ingombro raggio
|
||||
b3Box.Expand( dRad) ;
|
||||
// Restituisco il box calcolato
|
||||
return b3Box ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline bool
|
||||
VolZmap::BBoxComponent( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV,
|
||||
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ,
|
||||
double dRad, double dTipRad, double dHei)
|
||||
VolZmap::TestToolBBox( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV,
|
||||
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ)
|
||||
{
|
||||
return TestCompoBBox( nGrid, ptP1, ptP2, vtV, m_Tool.GetRadius(), m_Tool.GetTipRadius(), m_Tool.GetHeigth(),
|
||||
nStI, nStJ, nEnI, nEnJ) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline bool
|
||||
VolZmap::TestCompoBBox( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV,
|
||||
double dRad, double dTipRad, double dHei,
|
||||
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ)
|
||||
{
|
||||
// I punti e i vettori devono essere nel sistema di riferimento opportuno
|
||||
|
||||
@@ -4485,50 +4444,30 @@ VolZmap::BBoxComponent( unsigned int nGrid, const Point3d& ptP1, const Point3d&
|
||||
if ( nGrid < 0 || nGrid > 2)
|
||||
return false ;
|
||||
|
||||
unsigned int nMaxNx = m_nNx[nGrid] ;
|
||||
unsigned int nMaxNy = m_nNy[nGrid] ;
|
||||
// BBox dello Zmap
|
||||
BBox3d b3Zmap( 0, 0, m_dMinZ[nGrid], m_nNx[nGrid] * m_dStep, m_nNy[nGrid] * m_dStep, m_dMaxZ[nGrid]) ;
|
||||
|
||||
double dMaxXValue = nMaxNx * m_dStep ;
|
||||
double dMaxYValue = nMaxNy * m_dStep ;
|
||||
double dMinZValue = m_dMinZ[nGrid] ;
|
||||
double dMaxZValue = m_dMaxZ[nGrid] ;
|
||||
|
||||
// Determinazione del raggio massimo del componente
|
||||
// BBox dell'utensile nel suo movimento
|
||||
double dMaxRad = max( dRad, dTipRad) ;
|
||||
|
||||
// Determinazione delle posizioni della punta del componente nelle posizioni iniziale e finale
|
||||
Point3d ptP1T = ptP1 - dHei * vtV ;
|
||||
Point3d ptP2T = ptP2 - dHei * vtV ;
|
||||
|
||||
// Determinazione dei limiti del più piccolo parallelepipedo contenente il movimento
|
||||
double dMinX = min( min( ptP1.x, ptP1T.x), min( ptP2.x, ptP2T.x)) - dMaxRad ;
|
||||
double dMinY = min( min( ptP1.y, ptP1T.y), min( ptP2.y, ptP2T.y)) - dMaxRad ;
|
||||
double dMinZ = min( min( ptP1.z, ptP1T.z), min( ptP2.z, ptP2T.z)) - dMaxRad ;
|
||||
double dMaxX = max( max( ptP1.x, ptP1T.x), max( ptP2.x, ptP2T.x)) + dMaxRad ;
|
||||
double dMaxY = max( max( ptP1.y, ptP1T.y), max( ptP2.y, ptP2T.y)) + dMaxRad ;
|
||||
double dMaxZ = max( max( ptP1.z, ptP1T.z), max( ptP2.z, ptP2T.z)) + dMaxRad ;
|
||||
BBox3d b3Box = ( vtV.IsSmall() ? GetSphereMoveBBox( ptP1, ptP2, dRad) : GetCylMoveBBox( ptP1, ptP2, vtV, dMaxRad, dHei)) ;
|
||||
|
||||
// Verifica dell'interferenza dell'utensile con lo Zmap
|
||||
if ( dMaxX < EPS_SMALL || dMinX > dMaxXValue - EPS_SMALL)
|
||||
return false ;
|
||||
if ( dMaxY < EPS_SMALL || dMinY > dMaxYValue - EPS_SMALL)
|
||||
return false ;
|
||||
if ( dMaxZ < dMinZValue + EPS_SMALL || dMinZ > dMaxZValue - EPS_SMALL)
|
||||
if ( ! b3Zmap.FindIntersection( b3Box, b3Box))
|
||||
return false ;
|
||||
|
||||
// Limiti su indici
|
||||
nStI = ( dMinX < EPS_SMALL ? 0 : static_cast <unsigned int> ( dMinX / m_dStep)) ;
|
||||
nEnI = ( dMaxX > dMaxXValue - EPS_SMALL ? nMaxNx - 1 : static_cast <unsigned int> ( dMaxX / m_dStep)) ;
|
||||
nStJ = ( dMinY < EPS_SMALL ? 0 : static_cast <unsigned int> ( dMinY / m_dStep)) ;
|
||||
nEnJ = ( dMaxY > dMaxYValue - EPS_SMALL ? nMaxNy - 1 : static_cast <unsigned int> ( dMaxY / m_dStep)) ;
|
||||
nStI = max( 0, int( b3Box.GetMin().x / m_dStep)) ;
|
||||
nEnI = min( m_nNx[nGrid] - 1, unsigned int( b3Box.GetMax().x / m_dStep)) ;
|
||||
nStJ = max( 0, int( b3Box.GetMin().y / m_dStep)) ;
|
||||
nEnJ = min( m_nNy[nGrid] - 1, unsigned int( b3Box.GetMax().y / m_dStep)) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline bool
|
||||
VolZmap::BBoxParaComp( unsigned int nGrid, double dLenX, double dLenY, double dLenZ,
|
||||
const Point3d& ptS, const Point3d& ptE, const Vector3d& vtD, const Vector3d& vtA,
|
||||
VolZmap::TestParaBBox( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtD, const Vector3d& vtA,
|
||||
double dLenX, double dLenY, double dLenZ,
|
||||
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ)
|
||||
{
|
||||
// I punti e i vettori devono essere nel sistema di riferimento opportuno
|
||||
|
||||
Reference in New Issue
Block a user