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:
+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