diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc
index f990cc1..0eaa179 100644
Binary files a/EgtGeomKernel.rc and b/EgtGeomKernel.rc differ
diff --git a/EgtGeomKernel.vcxproj b/EgtGeomKernel.vcxproj
index bcbc746..49d880c 100644
--- a/EgtGeomKernel.vcxproj
+++ b/EgtGeomKernel.vcxproj
@@ -338,6 +338,7 @@ copy $(TargetPath) \EgtProg\Dll64
+
@@ -363,12 +364,11 @@ copy $(TargetPath) \EgtProg\Dll64
-
-
-
-
+
+
+
+
-
@@ -514,6 +514,7 @@ copy $(TargetPath) \EgtProg\Dll64
+
diff --git a/EgtGeomKernel.vcxproj.filters b/EgtGeomKernel.vcxproj.filters
index 7fc8049..947df79 100644
--- a/EgtGeomKernel.vcxproj.filters
+++ b/EgtGeomKernel.vcxproj.filters
@@ -339,21 +339,6 @@
File di origine\GeoCollision
-
- File di origine\Geo
-
-
- File di origine\Geo
-
-
- File di origine\Geo
-
-
- File di origine\Geo
-
-
- File di origine\Geo
-
File di origine\GeoInters
@@ -372,6 +357,21 @@
File di origine\GeoDist
+
+ File di origine\Geo
+
+
+ File di origine\Geo
+
+
+ File di origine\Geo
+
+
+ File di origine\Geo
+
+
+ File di origine\Base
+
@@ -842,6 +842,9 @@
File di intestazione\Include
+
+ File di intestazione
+
diff --git a/VolZmapTool.cpp b/Tool.cpp
similarity index 60%
rename from VolZmapTool.cpp
rename to Tool.cpp
index b70ecd7..07f4cce 100644
--- a/VolZmapTool.cpp
+++ b/Tool.cpp
@@ -2,7 +2,7 @@
// EgalTech 2015-2016
//----------------------------------------------------------------------------
// File : VolZmap.cpp Data : 22.01.15 Versione : 1.6a4
-// Contenuto : Implementazione della classe Volume Zmap (utensili)
+// Contenuto : Implementazione della classe Tool
//
//
//
@@ -15,18 +15,31 @@
#include "stdafx.h"
#include "CurveLine.h"
#include "CurveArc.h"
-#include "VolZmap.h"
+#include "Tool.h"
#include "GeoConst.h"
#include "/EgtDev/Include/EGKLinePntTgCurve.h"
#include "/EgtDev/Include/EGKFilletChamfer.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
+#include
using namespace std ;
+//----------------------------------------------------------------------------
+Tool::Tool( void)
+ : m_dLinTol( LIN_TOL_STD), m_dAngTolDeg( ANG_TOL_APPROX_DEG), m_nType( UNDEF), m_nCurrentNum( 0), m_dHeigth( 0),
+ m_dTipHeigth( 0), m_dRadius( 0), m_dRCorner( 0), m_dTipRadius( 0), m_dMrtChsWidth( 0), m_dMrtChsThickness( 0)
+{
+}
+
+//----------------------------------------------------------------------------
+Tool::~Tool( void)
+{
+}
+
//---------- Tolleranza nell'approssimazione di curve profilo ----------------
//----------------------------------------------------------------------------
bool
-VolZmap::SetTolerances( double dLinTol, double dAngTolDeg)
+Tool::SetTolerances( double dLinTol, double dAngTolDeg)
{
m_dLinTol = max( dLinTol, LIN_TOL_MIN) ;
m_dAngTolDeg = max( dAngTolDeg, ANG_TOL_MIN_DEG) ;
@@ -35,72 +48,73 @@ VolZmap::SetTolerances( double dLinTol, double dAngTolDeg)
//----------------------------------------------------------------------------
bool
-VolZmap::SetStdTool( const string& sToolName, double dH, double dR, double dCornR)
+Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR, int nToolNum)
{
- // reset nome
- m_sToolName.clear() ;
- // verifica minime dimensioni globali
+ // assegno il nome
+ m_sName = sToolName ;
+ // Aggiorno il numero dell'utensile corrente
+ m_nCurrentNum = nToolNum ;
+ // Imposto il tipo di utensile a indefinito
+ m_nType = UNDEF ;
+ // verifica sulle minime dimensioni globali
if ( dH < EPS_SMALL || dR < EPS_SMALL)
return false ;
// utensile cilindrico
if ( dCornR < EPS_SMALL) {
- m_nToolType = CYLMILL ;
- m_dHeight = dH ;
+ m_nType = CYLMILL ;
+ m_dHeigth = dH ;
m_dRadius = dR ;
- m_dTipHeight = 0 ;
+ m_dTipHeigth = 0 ;
m_dTipRadius = m_dRadius ;
m_dRCorner = 0 ;
}
// utensile naso di toro
- else if ( dCornR < dR - EPS_SMALL) {
- m_nToolType = BULLNOSEMILL ;
- m_dHeight = dH ;
+ else if ( dCornR < dR - EPS_SMALL) {
+ m_dHeigth = dH ;
m_dRadius = dR ;
- m_dTipHeight = dCornR ;
+ m_dTipHeigth = dCornR ;
m_dTipRadius = dR - dCornR ;
m_dRCorner = dCornR ;
- // come profilo
- m_nToolType = GENTOOL ;
+ // come profilo
Point3d pt0( 0, 0, 0) ;
Point3d pt1( m_dRadius, 0, 0) ;
- Point3d pt2( m_dRadius, - m_dHeight + m_dTipHeight, 0) ;
- Point3d pt3( m_dTipRadius, - m_dHeight, 0) ;
- Point3d pt4( 0, - m_dHeight, 0) ;
- m_ToolOutline.Clear() ;
+ Point3d pt2( m_dRadius, - m_dHeigth + m_dTipHeigth, 0) ;
+ Point3d pt3( m_dTipRadius, - m_dHeigth, 0) ;
+ Point3d pt4( 0, - m_dHeigth, 0) ;
+ m_Outline.Clear() ;
CurveLine Line ;
Line.Set( pt0, pt1) ;
- m_ToolOutline.AddCurve( Line) ;
- m_ToolOutline.AddLine( pt2);
- m_ToolOutline.AddArcTg( pt3) ;
- m_ToolOutline.AddLine( pt4) ;
- return SetGenTool( sToolName, &m_ToolOutline) ;
+ m_Outline.AddCurve( Line) ;
+ m_Outline.AddLine( pt2);
+ m_Outline.AddArcTg( pt3) ;
+ m_Outline.AddLine( pt4) ;
+ return SetGenTool( sToolName, & m_Outline, nToolNum) ;
}
// utensile sferico
else if ( dCornR < dR + EPS_SMALL) {
- m_nToolType = BALLMILL ;
- m_dHeight = dH ;
+ m_nType = BALLMILL ;
+ m_dHeigth = dH ;
m_dRadius = dR ;
- m_dTipHeight = m_dRadius ;
+ m_dTipHeigth = m_dRadius ;
m_dTipRadius = 0 ;
m_dRCorner = m_dRadius ;
}
// impossibile
else
return false ;
- // assegno il nome
- m_sToolName = sToolName ;
- // Aggiorno il numero dell'utensile corrente
- m_nCurrentToolNum = 0 ;
+
return true ;
}
//----------------------------------------------------------------------------
bool
-VolZmap::SetAdvTool( const string& sToolName, double dH, double dR,
- double dTipH, double dTipR, double dCornR)
+Tool::SetAdvTool( const string& sToolName, double dH, double dR,
+ double dTipH, double dTipR, double dCornR, int nToolNum)
{
- // Reset nome
- m_sToolName.clear() ;
+ // Setto il nome
+ m_sName = sToolName ;
+ m_nCurrentNum = nToolNum ;
+ m_nType = UNDEF ;
// Verifica dimensioni globali
if ( dH < EPS_SMALL || dR < EPS_SMALL)
@@ -108,33 +122,29 @@ VolZmap::SetAdvTool( const string& sToolName, double dH, double dR,
// Se altezza punta nulla, ricado nel caso standard
if ( dTipH < EPS_SMALL || abs( dTipR - dR) < EPS_SMALL)
- return SetStdTool( sToolName, dH, dR, dCornR) ;
+ return SetStdTool( sToolName, dH, dR, dCornR, nToolNum) ;
// Caso avanzato
- m_dHeight = dH ;
+ m_dHeigth = dH ;
m_dRadius = dR ;
- m_dTipHeight = dTipH ;
+ m_dTipHeigth = dTipH ;
m_dTipRadius = max( dTipR, 0.) ;
// Se raggio corner nullo, allora utensile conico
if ( dCornR < EPS_SMALL) {
- m_nToolType = CONUSMILL ;
- m_dRCorner = 0 ;
- // assegno nome e identificativo
- m_sToolName = sToolName ;
- m_nCurrentToolNum = 0 ;
+ m_nType = CONUSMILL ;
+ m_dRCorner = 0 ;
return true ;
}
// Altrimenti utensile generico.
- m_nToolType = GENTOOL ;
m_dRCorner = dCornR ;
- m_ToolOutline.Clear() ;
+ m_Outline.Clear() ;
// Definisco il profilo
Point3d pt0( 0, 0, 0) ;
Point3d pt1( m_dRadius, 0, 0) ;
- Point3d pt2( m_dRadius, - m_dHeight + m_dTipHeight, 0) ;
+ Point3d pt2( m_dRadius, - m_dHeigth + m_dTipHeigth, 0) ;
if ( m_dTipRadius < m_dRadius) {
@@ -168,11 +178,11 @@ VolZmap::SetAdvTool( const string& sToolName, double dH, double dR,
CurveArc cvArc ;
cvArc.SetC2P( ptC, pt3, pt4) ;
- m_ToolOutline.AddCurve( LineSt) ;
- m_ToolOutline.AddLine( pt2);
- m_ToolOutline.AddLine( pt3);
- m_ToolOutline.AddCurve( cvArc) ;
- m_ToolOutline.AddLine( ptLast) ;
+ m_Outline.AddCurve( LineSt) ;
+ m_Outline.AddLine( pt2);
+ m_Outline.AddLine( pt3);
+ m_Outline.AddCurve( cvArc) ;
+ m_Outline.AddLine( ptLast) ;
}
else {
@@ -203,35 +213,35 @@ VolZmap::SetAdvTool( const string& sToolName, double dH, double dR,
Point3d pt5( 0, - dH, 0) ;
- m_ToolOutline.AddCurve( LineSt) ;
- m_ToolOutline.AddLine( pt2);
- m_ToolOutline.AddLine( pt3);
- m_ToolOutline.AddCurve( cvArc) ;
- m_ToolOutline.AddLine( pt5) ;
+ m_Outline.AddCurve( LineSt) ;
+ m_Outline.AddLine( pt2);
+ m_Outline.AddLine( pt3);
+ m_Outline.AddCurve( cvArc) ;
+ m_Outline.AddLine( pt5) ;
}
- return SetGenTool( sToolName, &m_ToolOutline) ;
+ return SetGenTool( sToolName, &m_Outline, nToolNum) ;
}
//----------------------------------------------------------------------------
bool
-VolZmap::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline)
+Tool::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline, int nToolNum)
{
// Assegno nome, tipo e id dell'utensile
- m_sToolName = sToolName ;
- m_nToolType = GENTOOL ;
- m_nCurrentToolNum = 0 ;
+ m_sName = sToolName ;
+ m_nType = UNDEF ;
+ m_nCurrentNum = nToolNum ;
// Copio il profilo e garantisco sia di soli archi e rette (converto eventuali curve di Bezier)
- if ( ! m_ToolOutline.CopyFrom( pToolOutline) ||
- ! m_ToolOutline.ArcsBezierCurvesToArcsPerpExtr( m_dLinTol, m_dAngTolDeg))
+ 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_ToolOutline.GetFirstCurve() ;
+ const ICurve* pCurve = m_Outline.GetFirstCurve() ;
while ( pCurve != nullptr) {
// Se la curva è un arco verifico se approssimarlo
@@ -245,8 +255,8 @@ VolZmap::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutlin
bool bCurrApprox = ( abs( ptO.x) > EPS_SMALL) ;
// Se una delle altre curve dista dal centro meno del raggio, devo approssimare
- for ( int nI = 0 ; ! bCurrApprox && nI < m_ToolOutline.GetCurveCount() ; ++ nI) {
- const ICurve* pOtherCrv = m_ToolOutline.GetCurve( nI) ;
+ for ( int nI = 0 ; ! bCurrApprox && nI < m_Outline.GetCurveCount() ; ++ nI) {
+ const ICurve* pOtherCrv = m_Outline.GetCurve( nI) ;
if ( pOtherCrv != pCurve) {
DistPointCurve CalcDist( ptO, *pOtherCrv) ;
double dCurrDist ;
@@ -259,33 +269,36 @@ VolZmap::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutlin
if ( bCurrApprox) {
// Creo la polyline approssimante
PolyLine plyApprox ;
- pCurve->ApproxWithLines( m_dLinTol, m_dAngTolDeg, ICurve::APL_SPECIAL, plyApprox) ;
+ if ( ! pCurve->ApproxWithLines( m_dLinTol, m_dAngTolDeg, ICurve::APL_SPECIAL, plyApprox))
+ return false ;
// Aggiungo i segmenti di retta alla approssimazione
Point3d ptEnd ;
plyApprox.GetFirstPoint( ptEnd) ;
while ( plyApprox.GetNextPoint( ptEnd)) {
- m_ToolArcLineApprox.AddLine( ptEnd) ;
+ m_ArcLineApprox.AddLine( ptEnd) ;
}
bApprox = true ;
}
// altrimenti lo aggiungo semplicemente
else
- m_ToolArcLineApprox.AddCurve( *pCurve, true) ;
+ m_ArcLineApprox.AddCurve( *pCurve, true) ;
}
// altrimenti è segmento e lo aggiungo semplicemente
else
- m_ToolArcLineApprox.AddCurve( *pCurve, true) ;
+ m_ArcLineApprox.AddCurve( *pCurve, true) ;
- pCurve = m_ToolOutline.GetNextCurve() ;
+ pCurve = m_Outline.GetNextCurve() ;
}
// Se non ci sono state approssimazioni, cancello la curva approssimante
if ( ! bApprox)
- m_ToolArcLineApprox.Clear() ;
+ m_ArcLineApprox.Clear() ;
+
+ m_nType = GEN ;
// Dimensioni dell'utensile
BBox3d Bounding ;
- m_ToolOutline.GetLocalBBox( Bounding) ;
+ m_Outline.GetLocalBBox( Bounding) ;
double m_dHeight = Bounding.GetMax().y - Bounding.GetMin().y ;
double m_dRadius = Bounding.GetMax().x - Bounding.GetMin().x ;
@@ -294,44 +307,49 @@ VolZmap::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutlin
//----------------------------------------------------------------------------
bool
-VolZmap::SetMortiserTool( const std::string& sToolName, double dH, double dW, double dTh, double dRc)
+Tool::SetMortiserTool( const std::string& sToolName, double dH, double dW, double dTh, double dRc, int nToolNum)
{
- // Reset nome
- m_sToolName.clear() ;
+ // Setto il nome e il numero dell'utensile
+ m_sName = sToolName ;
+ m_nCurrentNum = nToolNum ;
+ // Imposto a indefinito il tipo
+ m_nType = UNDEF ;
if ( dH < EPS_SMALL || dW < EPS_SMALL ||
dTh < EPS_SMALL || dRc < 0 || dW - 2 * dRc < 0)
return false ;
- m_dHeight = dH ;
+ m_dHeigth = dH ;
m_dRCorner = dRc ;
m_dMrtChsWidth = dW ;
m_dMrtChsThickness = dTh ;
- m_sToolName = sToolName ;
- m_nToolType = MORTISER ;
- m_nCurrentToolNum = 0 ;
+ // Imposto il tipo
+ m_nType = MORTISER ;
return true ;
}
//----------------------------------------------------------------------------
bool
-VolZmap::SetChiselTool( const string& sToolName, double dH, double dW, double dTh) {
+Tool::SetChiselTool( const string& sToolName, double dH, double dW, double dTh, int nToolNum)
+{
- // Reset nome
- m_sToolName.clear() ;
+ // Setto il nome e il numero dell'utensile
+ m_sName = sToolName ;
+ m_nCurrentNum = nToolNum ;
+ // Imposto a indefinito il tipo
+ m_nType = UNDEF ;
if ( dH < EPS_SMALL || dW < EPS_SMALL || dTh < 0)
return false ;
- m_dHeight = dH ;
+ m_dHeigth = dH ;
m_dMrtChsWidth = dW ;
m_dMrtChsThickness = dTh ;
- m_sToolName = sToolName ;
- m_nToolType = CHISEL ;
- m_nCurrentToolNum = 0 ;
-
+ // Imposto il tipo
+ m_nType = CHISEL ;
+
return true ;
-}
\ No newline at end of file
+}
diff --git a/Tool.h b/Tool.h
new file mode 100644
index 0000000..49896e5
--- /dev/null
+++ b/Tool.h
@@ -0,0 +1,86 @@
+//----------------------------------------------------------------------------
+// EgalTech 2017-2017
+//----------------------------------------------------------------------------
+// File : Tool.h Data : 28.11.17 Versione : 1.8l1
+// Contenuto : Dichiarazione della classe Tool.
+//
+//
+//
+// Modifiche : 22.01.15 DS Creazione modulo.
+//
+//
+//----------------------------------------------------------------------------
+
+#pragma once
+
+#include "CurveComposite.h"
+
+//----------------------------------------------------------------------------
+class Tool
+{
+ public :
+ Tool( void) ;
+ ~Tool( void) ;
+
+ public :
+ bool SetTolerances( double dLinTol, double dAngTolDeg = 90) ;
+ bool SetStdTool( const std::string& sToolName, double dH, double dR, double dCornR, int nToolNum) ;
+ bool SetAdvTool( const std::string& sToolName,
+ double dH, double dR, double dTipH, double dTipR, double dCornR, int nToolNum) ;
+ bool SetGenTool( const std::string& sToolName, const ICurveComposite* pToolOutline, int nToolNum) ;
+ bool SetMortiserTool( const std::string& sToolName, double dH, double dW, double dTh, double dRc, int nToolNum) ;
+ bool SetChiselTool( const std::string& sToolName, double dH, double dW, double dTh, int nToolNum) ;
+ int GetType() const
+ { return m_nType ; }
+ int GetCurrentToolNum() const
+ { return m_nCurrentNum ; }
+ double GetHeigth() const
+ { return m_dHeigth ; }
+ double GetTipHeigth() const
+ { return m_dTipHeigth ; }
+ double GetRadius() const
+ { return m_dRadius ; }
+ double GetTipRadius() const
+ { return m_dTipRadius ; }
+ double GetCornRadius() const
+ { return m_dRCorner ; }
+ double GetMrtChsWidth() const
+ { return m_dMrtChsWidth ; }
+ double GetMrtChsThickness() const
+ { return m_dMrtChsThickness ; }
+ const CurveComposite * GetOutline()
+ {
+ // Se l'utensile non è stato approssimato uso l'originale
+ if ( m_ArcLineApprox.GetCurveCount() == 0)
+ return ( & m_Outline) ;
+ // altrimenti uso l'approssimazione
+ else
+ return ( & m_ArcLineApprox) ;
+ }
+
+ public :
+ enum ToolType { UNDEF = 0, // Utensile indefinito
+ GEN = 1, // Generico da profilo -> usare SetTool
+ CYLMILL = 2, // Cilindrica
+ BALLMILL = 3, // Sferica
+ BULLNOSEMILL = 4, // Naso di toro
+ CONUSMILL = 5, // Con parte terminale conica
+ MORTISER = 6, // Mortasatrice
+ CHISEL = 7} ; // Scalpello
+
+ private :
+ double m_dLinTol ; // Dati per utensile
+ double m_dAngTolDeg ;
+ std::string m_sName ;
+ int m_nType ;
+ int m_nCurrentNum ;
+ CurveComposite m_Outline ;
+ CurveComposite m_ArcLineApprox ;
+ double m_dHeigth ;
+ double m_dTipHeigth ;
+ double m_dRadius ;
+ double m_dRCorner ;
+ double m_dTipRadius ;
+ double m_dMrtChsWidth ;
+ double m_dMrtChsThickness ;
+} ;
diff --git a/VolZmap.cpp b/VolZmap.cpp
index ac17387..81edb10 100644
--- a/VolZmap.cpp
+++ b/VolZmap.cpp
@@ -29,8 +29,7 @@ GEOOBJ_REGISTER( VOL_ZMAP, NGE_V_ZMP, VolZmap) ;
//----------------------------------------------------------------------------
VolZmap::VolZmap(void)
- : m_nStatus( TO_VERIFY), m_dStep( EPS_SMALL), m_nTempProp( 0), m_dLinTol( LIN_TOL_STD), m_dAngTolDeg( ANG_TOL_APPROX_DEG),
- m_nVoxNumPerBlock( N_VOXBLOCK)
+ : m_nStatus( TO_VERIFY), m_dStep( EPS_SMALL), m_nTempProp( 0), m_nVoxNumPerBlock( N_VOXBLOCK)
{
m_nMapNum = 0 ;
m_nNumBlock = 0 ;
@@ -68,9 +67,7 @@ VolZmap::Clear( void)
m_Values[i].clear() ;
}
m_dStep = EPS_SMALL ;
- m_dLinTol = LIN_TOL_STD ;
- m_dAngTolDeg = ANG_TOL_APPROX_DEG;
-
+
m_nTempProp = 0 ;
// imposto ricalcolo della grafica
@@ -1142,3 +1139,45 @@ VolZmap::RemovePart( int nPart)
return true ;
}
+//----------------------------------------------------------------------------
+bool
+VolZmap::SetTolerances( double dLinTol, double dAngTolDeg)
+{
+ return m_Tool.SetTolerances( dLinTol, dAngTolDeg) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+VolZmap::SetStdTool( const std::string& sToolName, double dH, double dR, double dCornR)
+{
+ return m_Tool.SetStdTool( sToolName, dH, dR, dCornR, 1) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+VolZmap::SetAdvTool( const std::string& sToolName,
+ double dH, double dR, double dTipH, double dTipR, double dCornR)
+{
+ return m_Tool.SetAdvTool( sToolName, dH, dR, dTipH, dTipR, dCornR, 1) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+VolZmap::SetGenTool( const std::string& sToolName, const ICurveComposite* pToolOutline)
+{
+ return m_Tool.SetGenTool( sToolName, pToolOutline, 1) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+VolZmap::SetMortiserTool( const std::string& sToolName, double dH, double dW, double dTh, double dRc)
+{
+ return m_Tool.SetMortiserTool( sToolName, dH, dW, dTh, dRc, 1) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+VolZmap::SetChiselTool( const std::string& sToolName, double dH, double dW, double dTh)
+{
+ return m_Tool.SetChiselTool( sToolName, dH, dW, dTh, 1) ;
+}
diff --git a/VolZmap.h b/VolZmap.h
index c6b591c..b59b7c4 100644
--- a/VolZmap.h
+++ b/VolZmap.h
@@ -18,6 +18,7 @@
#include "CurveComposite.h"
#include "SurfFlatRegion.h"
#include "CurveLine.h"
+#include "Tool.h"
#include "/EgtDev/Include/EGkVolZmap.h"
#include "/EgtDev/Include/EGkPoint3d.h"
#include "/EgtDev/Include/EGkVector3d.h"
@@ -126,14 +127,7 @@ class VolZmap : public IVolZmap, public IGeoObjRW
LOG_ERROR( GetEGkLogger(), "VolZmap : copy error")
return *this ; }
- private :
- enum ToolType { GENTOOL = 0, // generico da profilo -> usare SetTool
- CYLMILL = 1, // cilindrica
- BALLMILL = 2, // sferica
- BULLNOSEMILL = 3, // naso di toro
- CONUSMILL = 4, // con parte terminale conica
- MORTISER = 5, // mortasatrice
- CHISEL = 6} ; // scalpello
+ private :
enum CubeType { VOX_EXTERN = 1,
VOX_ON_BOUNDARY = 0,
VOX_INNER = -1} ;
@@ -355,23 +349,10 @@ class VolZmap : public IVolZmap, public IGeoObjRW
int m_nConnectedCompoCount ; // Se == - 1 il numero di componenti non è noto
// Se >= 0 è il numero di componenti connesse
-
- double m_dLinTol ; // Dati per utensile
- double m_dAngTolDeg ;
- std::string m_sToolName ;
- unsigned int m_nToolType ;
- unsigned int m_nCurrentToolNum ;
- CurveComposite m_ToolOutline ;
- CurveComposite m_ToolArcLineApprox ;
- double m_dHeight ;
- double m_dTipHeight ;
- double m_dRadius ;
- double m_dRCorner ;
- double m_dTipRadius ;
- double m_dMrtChsWidth ;
- double m_dMrtChsThickness ;
+
+ mutable TriaMatrix m_InterBlockTria ;
- mutable TriaMatrix m_InterBlockTria ;
+ Tool m_Tool ;
} ;
diff --git a/VolTriZmapCalculus.cpp b/VolZmapCalculus.cpp
similarity index 100%
rename from VolTriZmapCalculus.cpp
rename to VolZmapCalculus.cpp
diff --git a/VolTriZmapCreation.cpp b/VolZmapCreation.cpp
similarity index 100%
rename from VolTriZmapCreation.cpp
rename to VolZmapCreation.cpp
diff --git a/VolTriZmapGraphics.cpp b/VolZmapGraphics.cpp
similarity index 100%
rename from VolTriZmapGraphics.cpp
rename to VolZmapGraphics.cpp
diff --git a/VolTriZmapVolume.cpp b/VolZmapVolume.cpp
similarity index 88%
rename from VolTriZmapVolume.cpp
rename to VolZmapVolume.cpp
index 79b11b4..c8189f5 100644
--- a/VolTriZmapVolume.cpp
+++ b/VolZmapVolume.cpp
@@ -87,7 +87,7 @@ VolZmap::SubtractIntervals( unsigned int nGrid, unsigned int nI, unsigned int nJ
// Aggiornamento dati del tratto di dexel
m_Values[nGrid][nPos][i].dMin = dMax ;
m_Values[nGrid][nPos][i].vtMinN = vtNma ;
- m_Values[nGrid][nPos][i].nToolMin = m_nCurrentToolNum ;
+ m_Values[nGrid][nPos][i].nToolMin = m_Tool.GetCurrentToolNum() ;
}
// L'intervallo si divide in due intervalli
else {
@@ -120,13 +120,13 @@ VolZmap::SubtractIntervals( unsigned int nGrid, unsigned int nI, unsigned int nJ
m_Values[nGrid][nPos][i + 1].nToolMax = m_Values[nGrid][nPos][i].nToolMax ;
m_Values[nGrid][nPos][i + 1].dMin = dMax ;
m_Values[nGrid][nPos][i + 1].vtMinN = vtNma ;
- m_Values[nGrid][nPos][i + 1].nToolMin = m_nCurrentToolNum ;
+ m_Values[nGrid][nPos][i + 1].nToolMin = m_Tool.GetCurrentToolNum() ;
m_Values[nGrid][nPos][i + 1].nCompo = m_Values[nGrid][nPos][i].nCompo ;
// Parte inferiore
m_Values[nGrid][nPos][i].dMax = dMin ;
m_Values[nGrid][nPos][i].vtMaxN = vtNmi ;
- m_Values[nGrid][nPos][i].nToolMax = m_nCurrentToolNum ;
+ m_Values[nGrid][nPos][i].nToolMax = m_Tool.GetCurrentToolNum() ;
i = i + 1 ;
}
@@ -161,7 +161,7 @@ VolZmap::SubtractIntervals( unsigned int nGrid, unsigned int nI, unsigned int nJ
bModified = true ;
m_Values[nGrid][nPos][i].dMax = dMin ;
m_Values[nGrid][nPos][i].vtMaxN = vtNmi ;
- m_Values[nGrid][nPos][i].nToolMax = m_nCurrentToolNum ;
+ m_Values[nGrid][nPos][i].nToolMax = m_Tool.GetCurrentToolNum() ;
}
// L'intervallo da sottrarre è tutto a destra di quello corrente, non vi è intersezione
else {
@@ -650,57 +650,57 @@ VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d&
// Foratura
if ( vtMove.SqLenXY() < EPS_SMALL) {
- switch ( m_nToolType) {
- case GENTOOL :
+ switch ( m_Tool.GetType()) {
+ case Tool::GEN :
GenTool_ZDrilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CYLMILL :
- case BALLMILL :
+ case Tool::CYLMILL :
+ case Tool::BALLMILL :
CylBall_ZDrilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CONUSMILL :
+ case Tool::CONUSMILL :
Conus_ZDrilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case MORTISER :
+ case Tool::MORTISER :
Mrt_ZDrilling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
break ;
- case CHISEL :
+ case Tool::CHISEL :
Chs_ZDrilling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
break ;
}
}
// Fresatura con vettore movimento perpendicolare all'utensile
else if ( abs( vtMove.z) < EPS_SMALL) {
- switch ( m_nToolType) {
- case GENTOOL :
+ switch ( m_Tool.GetType()) {
+ case Tool::GEN :
GenTool_ZMilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CYLMILL :
- case BALLMILL :
+ case Tool::CYLMILL :
+ case Tool::BALLMILL :
CylBall_ZPerp( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CONUSMILL :
+ case Tool::CONUSMILL :
Conus_ZPerp( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case MORTISER :
+ case Tool::MORTISER :
Mrt_ZMilling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
break ;
- case CHISEL :
+ case Tool::CHISEL :
Chs_ZMilling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
break ;
}
}
// Fresatura con vettore movimento generico rispetto all'utensile
else {
- switch ( m_nToolType) {
- case GENTOOL :
+ switch ( m_Tool.GetType()) {
+ case Tool::GEN :
GenTool_ZMilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CYLMILL :
- case BALLMILL :
+ case Tool::CYLMILL :
+ case Tool::BALLMILL :
CylBall_ZMilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CONUSMILL :
+ case Tool::CONUSMILL :
Conus_ZMilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
}
}
@@ -716,57 +716,57 @@ VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d&
// Foratura
if ( dSqLOrt < EPS_SMALL * EPS_SMALL) {
- switch ( m_nToolType) {
- case GENTOOL :
+ switch ( m_Tool.GetType()) {
+ case Tool::GEN :
GenTool_Drilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CYLMILL :
- case BALLMILL :
+ case Tool::CYLMILL :
+ case Tool::BALLMILL :
CylBall_XYDrilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CONUSMILL :
+ case Tool::CONUSMILL :
Conus_XYDrilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case MORTISER :
+ case Tool::MORTISER :
Mrt_Drilling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
break ;
- case CHISEL :
+ case Tool::CHISEL :
Chs_Drilling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
break ;
}
}
// Fresatura con vettore movimento perpendicolare all'utensile
else if ( 1 - dSqLOrt < EPS_SMALL * EPS_SMALL) {
- switch ( m_nToolType) {
- case GENTOOL :
+ switch ( m_Tool.GetType()) {
+ case Tool::GEN :
GenTool_Milling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CYLMILL :
- case BALLMILL :
+ case Tool::CYLMILL :
+ case Tool::BALLMILL :
CylBall_XYPerp( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CONUSMILL :
+ case Tool::CONUSMILL :
Conus_XYPerp( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case MORTISER :
+ case Tool::MORTISER :
Mrt_Milling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
break ;
- case CHISEL :
+ case Tool::CHISEL :
Chs_Milling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
break ;
}
}
// Fresatura con vettore movimento generico rispetto all'utensile
else {
- switch ( m_nToolType) {
- case GENTOOL :
+ switch ( m_Tool.GetType()) {
+ case Tool::GEN :
GenTool_Milling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CYLMILL :
- case BALLMILL :
+ case Tool::CYLMILL :
+ case Tool::BALLMILL :
CylBall_XYMilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CONUSMILL :
+ case Tool::CONUSMILL :
Conus_XYMilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
}
@@ -783,42 +783,42 @@ VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d&
// Foratura
if ( dSqLOrt < EPS_SMALL * EPS_SMALL) {
- switch ( m_nToolType) {
- case GENTOOL :
+ switch ( m_Tool.GetType()) {
+ case Tool::GEN :
GenTool_Drilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CYLMILL :
- case BALLMILL :
+ case Tool::CYLMILL :
+ case Tool::BALLMILL :
CylBall_Drilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CONUSMILL :
+ case Tool::CONUSMILL :
Conus_Drilling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case MORTISER :
+ case Tool::MORTISER :
Mrt_Drilling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
break ;
- case CHISEL :
+ case Tool::CHISEL :
Chs_Drilling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
break ;
}
}
else {
- switch ( m_nToolType) {
- case GENTOOL :
+ switch ( m_Tool.GetType()) {
+ case Tool::GEN :
GenTool_Milling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CYLMILL :
- case BALLMILL :
+ case Tool::CYLMILL :
+ case Tool::BALLMILL :
CylBall_Milling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case CONUSMILL :
+ case Tool::CONUSMILL :
Conus_Milling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
- case MORTISER :
+ case Tool::MORTISER :
Mrt_Milling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
break ;
- case CHISEL :
+ case Tool::CHISEL :
Chs_Milling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
break ;
}
@@ -854,8 +854,8 @@ VolZmap::CylBall_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point
Point3d ptSxy( ptS.x, ptS.y, 0) ;
// Parametri geometrici dell'utensile
- double dStemHeigth = m_dHeight - m_dTipHeight ;
- double dSqRad = m_dRadius * m_dRadius ;
+ double dStemHeigth = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
+ double dSqRad = m_Tool.GetRadius() * m_Tool.GetRadius() ;
// Punte del gambo
Point3d ptTStemS = ptS - vtToolDir * dStemHeigth ;
@@ -875,12 +875,12 @@ VolZmap::CylBall_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point
double dSqLen = vtC.SqLen() ;
// Se il punto si trova dentro il cerchio taglio
- if ( dSqLen < dSqRad - 2 * m_dRadius * EPS_SMALL)
+ if ( dSqLen < dSqRad - 2 * m_Tool.GetRadius() * EPS_SMALL)
// utensile cilindrico
- if ( m_nToolType == CYLMILL)
+ if ( m_Tool.GetType() == Tool::CYLMILL)
SubtractIntervals( nGrid, i, j, dMinStemZ, dMaxStemZ, Z_AX, - Z_AX) ;
// utensile sferico
- else if ( m_nToolType == BALLMILL) {
+ else if ( m_Tool.GetType() == Tool::BALLMILL) {
double dH = sqrt( dSqRad - dSqLen) ;
@@ -914,9 +914,9 @@ VolZmap::CylBall_ZPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& p
return true ;
// Parametri geometrici dell'utensile
- double dStemHeigth = m_dHeight - m_dTipHeight ;
- double dSqRad = m_dRadius * m_dRadius ;
- double dSafeRad = m_dRadius - EPS_SMALL ;
+ double dStemHeigth = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
+ double dSqRad = m_Tool.GetRadius() * m_Tool.GetRadius() ;
+ double dSafeRad = m_Tool.GetRadius() - EPS_SMALL ;
double dSafeSqRad = dSafeRad * dSafeRad ;
// Punte del gambo
@@ -945,7 +945,7 @@ VolZmap::CylBall_ZPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& p
double dP1 = vtC * vtV1 ; double dP2 = vtC * vtV2 ;
// Utensile cilindrico
- if ( m_nToolType == CYLMILL) {
+ if ( m_Tool.GetType() == Tool::CYLMILL) {
// Se il punto cade nella zona di interesse taglio
if ( ( dP1 * dP1 + dP2 * dP2 < dSafeSqRad) ||
( ( dP1 - dLen) * ( dP1 - dLen) + dP2 * dP2) < dSafeSqRad ||
@@ -955,7 +955,7 @@ VolZmap::CylBall_ZPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& p
}
// Utensile sferico
- else if ( m_nToolType == BALLMILL) {
+ else if ( m_Tool.GetType() == Tool::BALLMILL) {
if ( abs( dP2) < dSafeRad) {
@@ -1039,10 +1039,10 @@ VolZmap::CylBall_ZMilling( unsigned int nGrid, const Point3d & ptS, const Point3
return true ;
// Parametri geometrici dell'utensile
- double dStemHeigth = m_dHeight - m_dTipHeight ;
- double dSafeRadius = m_dRadius - EPS_SMALL ;
- double dSqRad = m_dRadius * m_dRadius ;
- double dSafeSqRad = dSqRad - 2 * m_dRadius * EPS_SMALL ;
+ double dStemHeigth = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
+ double dSafeRadius = m_Tool.GetRadius() - EPS_SMALL ;
+ double dSqRad = m_Tool.GetRadius() * m_Tool.GetRadius() ;
+ double dSafeSqRad = dSqRad - 2 * m_Tool.GetRadius() * EPS_SMALL ;
// Studio delle simmetrie
Point3d ptI = ( ptS.z < ptE.z ? ptS : ptE) ;
@@ -1072,7 +1072,7 @@ VolZmap::CylBall_ZMilling( unsigned int nGrid, const Point3d & ptS, const Point3
// Parametri per determinare l'ellisse proiettata
double dCos = vtToolDir * vtMove ;
double dSin = ( abs( dCos) < 1 ? 1 - dCos * dCos : 0) ;
- double dSemiAxMin = m_dRadius * dCos ; // x1^2 = a^2 - (a / b)^2 x2^2 ; a = r dCos e b = r;
+ double dSemiAxMin = m_Tool.GetRadius() * dCos ; // x1^2 = a^2 - (a / b)^2 x2^2 ; a = r dCos e b = r;
double dSqSemiAxMin = dSemiAxMin * dSemiAxMin ; // da cui si ottiene x1^2 = a^2 - dCos^2 x2^2
double dSqRatio = dSqSemiAxMin / dSqRad ;
@@ -1156,9 +1156,9 @@ VolZmap::CylBall_ZMilling( unsigned int nGrid, const Point3d & ptS, const Point3
}
}
- if ( m_nToolType == 2)
+ if ( m_Tool.GetType() == Tool::BALLMILL)
- CompBall_Milling( nGrid, ptIT, ptFT, m_dRadius) ;
+ CompBall_Milling( nGrid, ptIT, ptFT, m_Tool.GetRadius()) ;
return true ;
}
@@ -1177,9 +1177,9 @@ VolZmap::Conus_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d
return true ;
// Parametri geometrici dell'utensile
- double dStemHeigth = m_dHeight - m_dTipHeight ;
- double dMinRad = min( m_dRadius, m_dTipRadius) ;
- double dMaxRad = max( m_dRadius, m_dTipRadius) ;
+ double dStemHeigth = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
+ double dMinRad = min( m_Tool.GetRadius(), m_Tool.GetTipRadius()) ;
+ double dMaxRad = max( m_Tool.GetRadius(), m_Tool.GetTipRadius()) ;
double dDeltaRad = dMaxRad - dMinRad ;
double dSqMinRad = dMinRad * dMinRad ;
double dSqMaxRad = dMaxRad * dMaxRad ;
@@ -1188,15 +1188,17 @@ VolZmap::Conus_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d
Point3d ptO( ptS.x, ptS.y, 0) ;
// Quote massime e minime dell'utensile durante il moto
- double dZMax = max( max( ptS.z, ptS.z - vtToolDir.z * m_dHeight), max( ptE.z, ptE.z - vtToolDir.z * m_dHeight)) ;
- double dZMin = min( min( ptS.z, ptS.z - vtToolDir.z * m_dHeight), min( ptE.z, ptE.z - vtToolDir.z * m_dHeight)) ;
+ double dZMax = max( max( ptS.z, ptS.z - vtToolDir.z * m_Tool.GetHeigth()),
+ max( ptE.z, ptE.z - vtToolDir.z * m_Tool.GetHeigth())) ;
+ double dZMin = min( min( ptS.z, ptS.z - vtToolDir.z * m_Tool.GetHeigth()),
+ min( ptE.z, ptE.z - vtToolDir.z * m_Tool.GetHeigth())) ;
// Parametri geometrici per
// determinare il vettore normale
- double dL = m_dTipHeight * dMaxRad / dDeltaRad ;
+ double dL = m_Tool.GetTipHeigth() * dMaxRad / dDeltaRad ;
// Trapano
- if ( m_dTipRadius < m_dRadius) {
+ if ( m_Tool.GetTipRadius() < m_Tool.GetRadius()) {
// Ciclo sui punti
for ( unsigned int i = nStartI ; i <= nEndI ; ++ i) {
@@ -1221,7 +1223,7 @@ VolZmap::Conus_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d
if ( vtToolDir.z > 0) {
- double dMin = dZMin + m_dTipHeight * ( dr - dMinRad) / dDeltaRad ;
+ double dMin = dZMin + m_Tool.GetTipHeigth() * ( dr - dMinRad) / dDeltaRad ;
double dMax = dZMax ;
Point3d ptInt( dX, dY, dMin) ;
@@ -1235,7 +1237,7 @@ VolZmap::Conus_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d
else {
double dMin = dZMin ;
- double dMax = dZMax - m_dTipHeight * ( dr - dMinRad) / dDeltaRad ;
+ double dMax = dZMax - m_Tool.GetTipHeigth() * ( dr - dMinRad) / dDeltaRad ;
Point3d ptInt( dX, dY, dMax) ;
Point3d ptPn( ptO.x, ptO.y, dMax - dl) ;
@@ -1276,7 +1278,7 @@ VolZmap::Conus_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d
if ( vtToolDir.z > 0) {
double dMin = dZMin ;
- double dMax = dZMax - dStemHeigth - m_dTipHeight * ( dr - dMinRad) / dDeltaRad ;
+ double dMax = dZMax - dStemHeigth - m_Tool.GetTipHeigth() * ( dr - dMinRad) / dDeltaRad ;
Point3d ptInt( dX, dY, dMax) ;
Point3d ptPn( ptO.x, ptO.y, dMax - dl) ;
@@ -1288,7 +1290,7 @@ VolZmap::Conus_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d
}
else {
- double dMin = dZMin + dStemHeigth + m_dTipHeight * ( dr - dMinRad) / dDeltaRad ;
+ double dMin = dZMin + dStemHeigth + m_Tool.GetTipHeigth() * ( dr - dMinRad) / dDeltaRad ;
double dMax = dZMax ;
Point3d ptInt( dX, dY, dMin) ;
@@ -1318,9 +1320,9 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
return true ;
// Parametri geometrici dell'utensile
- double dStemHeigth = m_dHeight - m_dTipHeight ;
- double dMinRad = min( m_dRadius, m_dTipRadius) ;
- double dMaxRad = max( m_dRadius, m_dTipRadius) ;
+ double dStemHeigth = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
+ double dMinRad = min( m_Tool.GetRadius(), m_Tool.GetTipRadius()) ;
+ double dMaxRad = max( m_Tool.GetRadius(), m_Tool.GetTipRadius()) ;
double dDeltaRad = dMaxRad - dMinRad ;
double dSqMinRad = dMinRad * dMinRad ;
double dSqMaxRad = dMaxRad * dMaxRad ;
@@ -1343,13 +1345,13 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
double dBaseZ = ptS.z ;
double dStemZ = ptS.z - vtToolDir.z * dStemHeigth ;
- double dTipZ = ptS.z - vtToolDir.z * m_dHeight ;
+ double dTipZ = ptS.z - vtToolDir.z * m_Tool.GetHeigth() ;
// Lunghezza cono
- double dL = m_dTipHeight * dMaxRad / dDeltaRad ;
+ double dL = m_Tool.GetTipHeigth() * dMaxRad / dDeltaRad ;
// Punta a trapano
- if ( m_dTipRadius < m_dRadius) {
+ if ( m_Tool.GetTipRadius() < m_Tool.GetRadius()) {
double dMin, dMax ;
@@ -1401,7 +1403,7 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
Point3d ptInt( dX, dY, dMin) ;
Vector3d vtU = ( ptInt - ptVS) - ( ptInt - ptVS) * vtV * vtV ;
vtU.Normalize() ;
- vtNmin = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmin = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmin.Normalize() ;
vtNmax = - Z_AX ;
}
@@ -1411,7 +1413,7 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
Vector3d vtU = ( ptInt - ptVS) - ( ptInt - ptVS) * vtV * vtV ;
vtU.Normalize() ;
vtNmin = Z_AX ;
- vtNmax = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmax = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmax.Normalize() ;
}
@@ -1428,7 +1430,7 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
Point3d ptInt( dX, dY, dMin) ;
Vector3d vtU = ( ptInt - ptVtemp) - ( ptInt - ptVtemp) * vtV * vtV ;
vtU.Normalize() ;
- vtNmin = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmin = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmin.Normalize() ;
vtNmax = - Z_AX ;
}
@@ -1438,7 +1440,7 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
Vector3d vtU = ( ptInt - ptVtemp) - ( ptInt - ptVtemp) * vtV * vtV ;
vtU.Normalize() ;
vtNmin = Z_AX ;
- vtNmax = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmax = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmax.Normalize() ;
}
@@ -1456,7 +1458,7 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
Point3d ptInt( dX, dY, dMin) ;
Vector3d vtU = ( ptInt - ptVE) - ( ptInt - ptVE) * vtV * vtV ;
vtU.Normalize() ;
- vtNmin = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmin = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmin.Normalize() ;
vtNmax = -Z_AX ;
}
@@ -1466,7 +1468,7 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
Vector3d vtU = ( ptInt - ptVE) - ( ptInt - ptVE) * vtV * vtV ;
vtU.Normalize() ;
vtNmin = Z_AX ;
- vtNmax = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmax = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmax.Normalize() ;
}
@@ -1484,8 +1486,8 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
Vector3d vtV = - vtToolDir ;
- Point3d ptVS = ptS - vtToolDir * ( m_dHeight - dL) ;
- Point3d ptVE = ptE - vtToolDir * ( m_dHeight - dL) ;
+ Point3d ptVS = ptS - vtToolDir * ( m_Tool.GetHeigth() - dL) ;
+ Point3d ptVE = ptE - vtToolDir * ( m_Tool.GetHeigth() - dL) ;
for ( unsigned int i = nStartI ; i <= nEndI ; ++ i) {
for( unsigned int j = nStartJ ; j <= nEndJ ; ++ j) {
@@ -1527,7 +1529,7 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
Vector3d vtU = ( ptInt - ptVS) - ( ptInt - ptVS) * vtV * vtV ;
vtU.Normalize() ;
vtNmin = Z_AX ;
- vtNmax = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmax = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmax.Normalize() ;
}
@@ -1536,7 +1538,7 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
Vector3d vtU = ( ptInt - ptVS) - ( ptInt - ptVS) * vtV * vtV ;
vtU.Normalize() ;
vtNmax = -Z_AX ;
- vtNmin = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmin = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmin.Normalize() ;
}
@@ -1555,7 +1557,7 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
Vector3d vtU = ( ptInt - ptVtemp) - ( ptInt - ptVtemp) * vtV * vtV ;
vtU.Normalize() ;
vtNmin = Z_AX ;
- vtNmax = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmax = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmax.Normalize() ;
}
@@ -1564,7 +1566,7 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
Vector3d vtU = ( ptInt - ptVtemp) - ( ptInt - ptVtemp) * vtV * vtV ;
vtU.Normalize() ;
vtNmax = -Z_AX ;
- vtNmin = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmin = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmin.Normalize() ;
}
@@ -1581,7 +1583,7 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
Vector3d vtU = ( ptInt - ptVE) - ( ptInt - ptVE) * vtV * vtV ;
vtU.Normalize() ;
vtNmin = Z_AX ;
- vtNmax = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmax = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmax.Normalize() ;
}
@@ -1590,7 +1592,7 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
Vector3d vtU = ( ptInt - ptVE) - ( ptInt - ptVE) * vtV * vtV ;
vtU.Normalize() ;
vtNmax = -Z_AX ;
- vtNmin = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmin = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmin.Normalize() ;
}
@@ -1608,20 +1610,20 @@ VolZmap::Conus_ZPerp( unsigned int nGrid, const Point3d & ptS, const Point3d & p
bool
VolZmap::Conus_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir)
{
- double dStemH = m_dHeight - m_dTipHeight ;
+ double dStemH = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
- CompCyl_ZMilling( nGrid, ptS, ptE, vtToolDir, dStemH, m_dRadius) ;
+ CompCyl_ZMilling( nGrid, ptS, ptE, vtToolDir, dStemH, m_Tool.GetRadius()) ;
- if ( m_dTipRadius < m_dRadius) {
+ if ( m_Tool.GetTipRadius() < m_Tool.GetRadius()) {
Point3d ptSC = ptS - vtToolDir * dStemH ;
Point3d ptEC = ptE - vtToolDir * dStemH ;
- CompConus_ZMilling( nGrid, ptSC, ptEC, vtToolDir, m_dTipHeight, m_dRadius, m_dTipRadius) ;
+ CompConus_ZMilling( nGrid, ptSC, ptEC, vtToolDir, m_Tool.GetTipHeigth(), m_Tool.GetRadius(), m_Tool.GetTipRadius()) ;
}
else {
- Point3d ptSC = ptS - vtToolDir * m_dHeight ;
- Point3d ptEC = ptE - vtToolDir * m_dHeight ;
- CompConus_ZMilling( nGrid, ptSC, ptEC, - vtToolDir, m_dTipHeight, m_dTipRadius, m_dRadius) ;
+ Point3d ptSC = ptS - vtToolDir * m_Tool.GetHeigth() ;
+ Point3d ptEC = ptE - vtToolDir * m_Tool.GetHeigth() ;
+ CompConus_ZMilling( nGrid, ptSC, ptEC, - vtToolDir, m_Tool.GetTipHeigth(), m_Tool.GetTipRadius(), m_Tool.GetRadius()) ;
}
return true ;
@@ -1640,21 +1642,21 @@ VolZmap::Mrt_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d& p
// Scompongo la mortasatrice in solidi semplici
// Parallelepipedo di base
- double dLenX = m_dMrtChsWidth ;
- double dLenY = m_dMrtChsThickness ;
- double dLenZ = m_dHeight - m_dRCorner ;
+ double dLenX = m_Tool.GetMrtChsWidth() ;
+ double dLenY = m_Tool.GetMrtChsThickness() ;
+ double dLenZ = m_Tool.GetHeigth() - m_Tool.GetCornRadius() ;
CompPar_ZDrilling( nGrid, dLenX, dLenY, dLenZ, ptS, ptEOnP, vtToolDir, vtAux) ;
// Se la punta è di tipo bull-nose
- if ( abs( m_dMrtChsWidth - 2 * m_dRCorner) > EPS_SMALL) {
+ if ( abs( m_Tool.GetMrtChsWidth() - 2 * m_Tool.GetCornRadius()) > EPS_SMALL) {
// Parallelepipedo di punta
Point3d ptTipS = ptS - dLenZ * vtToolDir ;
Point3d ptTipE = ptEOnP - dLenZ * vtToolDir ;
- dLenX = abs( m_dMrtChsWidth - 2 * m_dRCorner) ;
- dLenZ = m_dRCorner ;
+ dLenX = abs( m_Tool.GetMrtChsWidth() - 2 * m_Tool.GetCornRadius()) ;
+ dLenZ = m_Tool.GetCornRadius() ;
CompPar_ZDrilling( nGrid, dLenX, dLenY, dLenZ, ptTipS, ptTipE, vtToolDir, vtAux) ;
@@ -1666,8 +1668,8 @@ VolZmap::Mrt_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d& p
Point3d ptSplus = ptTipS + ( 0.5 * dLenX) * vtVOnP + 0.5 * dLenY * vtAux ;
Point3d ptEplus = ptTipE + ( 0.5 * dLenX) * vtVOnP + 0.5 * dLenY * vtAux ;
- CompCyl_Milling( nGrid, ptSminus, ptEminus, vtAux, dLenY, m_dRCorner, false, false) ;
- CompCyl_Milling( nGrid, ptSplus, ptEplus, vtAux, dLenY, m_dRCorner, false, false) ;
+ CompCyl_Milling( nGrid, ptSminus, ptEminus, vtAux, dLenY, m_Tool.GetCornRadius(), false, false) ;
+ CompCyl_Milling( nGrid, ptSplus, ptEplus, vtAux, dLenY, m_Tool.GetCornRadius(), false, false) ;
}
// se la punta è di tipo sfera
@@ -1676,7 +1678,7 @@ VolZmap::Mrt_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d& p
Point3d ptCylS = ptS - dLenZ * vtToolDir + 0.5 * dLenY * vtAux ;
Point3d ptCylE = ptEOnP - dLenZ * vtToolDir + 0.5 * dLenY * vtAux ;
- CompCyl_ZMilling( nGrid, ptCylS, ptCylE, vtAux, dLenY, m_dRCorner) ;
+ CompCyl_ZMilling( nGrid, ptCylS, ptCylE, vtAux, dLenY, m_Tool.GetCornRadius()) ;
}
return true ;
@@ -1698,27 +1700,27 @@ VolZmap::Mrt_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
// Scompongo la mortasatrice in solidi semplici
// Parallelepipedo di base
- double dLenX = m_dMrtChsWidth ;
- double dLenY = m_dMrtChsThickness ;
- double dLenZ = m_dHeight - m_dRCorner ;
+ double dLenX = m_Tool.GetMrtChsWidth() ;
+ double dLenY = m_Tool.GetMrtChsThickness() ;
+ double dLenZ = m_Tool.GetHeigth() - m_Tool.GetCornRadius() ;
CompPar_ZMilling( nGrid, dLenX, dLenY, dLenZ, ptPlS, ptPlE, vtToolDir, vtAux) ;
// Se la punta è di tipo bull-nose
- if ( abs( m_dMrtChsWidth - 2 * m_dRCorner) > EPS_SMALL) {
+ if ( abs( m_Tool.GetMrtChsWidth() - 2 * m_Tool.GetCornRadius()) > EPS_SMALL) {
// Parallelepipedo di punta
Point3d ptTipS = ptPlS - dLenZ * vtToolDir ;
Point3d ptTipE = ptPlE - dLenZ * vtToolDir ;
- dLenX = abs( m_dMrtChsWidth - 2 * m_dRCorner) ;
- dLenZ = m_dRCorner ;
+ dLenX = abs( m_Tool.GetMrtChsWidth() - 2 * m_Tool.GetCornRadius()) ;
+ dLenZ = m_Tool.GetCornRadius() ;
// Cilindro ( il moto dei due cilindri si sovrappone, quindi è inutile
// eseguire due volte il conto
Point3d ptSminus = ptTipS - ( 0.5 * dLenX) * vtPlV + 0.5 * dLenY * vtAux ;
Point3d ptEplus = ptTipE + ( 0.5 * dLenX) * vtPlV + 0.5 * dLenY * vtAux ;
- CompCyl_Milling( nGrid, ptSminus, ptEplus, vtAux, dLenY, m_dRCorner, false, false) ;
+ CompCyl_Milling( nGrid, ptSminus, ptEplus, vtAux, dLenY, m_Tool.GetCornRadius(), false, false) ;
}
// se la punta è di tipo sfera
@@ -1727,7 +1729,7 @@ VolZmap::Mrt_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
Point3d ptCylS = ptPlS - dLenZ * vtToolDir + 0.5 * dLenY * vtAux ;
Point3d ptCylE = ptPlE - dLenZ * vtToolDir + 0.5 * dLenY * vtAux ;
- CompCyl_ZMilling( nGrid, ptCylS, ptCylE, vtAux, dLenY, m_dRCorner) ;
+ CompCyl_ZMilling( nGrid, ptCylS, ptCylE, vtAux, dLenY, m_Tool.GetCornRadius()) ;
}
return true ;
@@ -1739,7 +1741,7 @@ VolZmap::Mrt_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
bool
VolZmap::Chs_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux)
{
- CompPar_ZDrilling( nGrid, m_dMrtChsWidth, m_dMrtChsThickness, m_dHeight,
+ CompPar_ZDrilling( nGrid, m_Tool.GetMrtChsWidth(), m_Tool.GetMrtChsThickness(), m_Tool.GetHeigth(),
ptS, ptE, vtToolDir, vtAux) ;
return true ;
}
@@ -1753,7 +1755,7 @@ VolZmap::Chs_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
Vector3d vtMoveOnP = ( ptE - ptS) - ( ptE - ptS) * vtToolDir * vtToolDir ;
Point3d ptEp = ptS + vtMoveOnP ;
- CompPar_ZMilling( nGrid, m_dMrtChsWidth, m_dMrtChsThickness, m_dHeight,
+ CompPar_ZMilling( nGrid, m_Tool.GetMrtChsWidth(), m_Tool.GetMrtChsThickness(), m_Tool.GetHeigth(),
ptSp, ptEp, vtToolDir, vtAux) ;
return true ;
}
@@ -1772,14 +1774,7 @@ VolZmap::GenTool_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point
Vector3d vtMove = ptE - ptS ;
// Settaggio profilo
- CurveComposite* pToolProfile ;
- if ( m_ToolArcLineApprox.GetCurveCount() == 0)
- // Se l'utensile non è stato approssimato uso l'originale
- pToolProfile = &m_ToolOutline ;
-
- else
- // altrimenti usi l'approssimazione
- pToolProfile = &m_ToolArcLineApprox ;
+ const CurveComposite* pToolProfile = m_Tool.GetOutline() ;
// Ciclo sulle curve
const ICurve* pCurve = pToolProfile->GetFirstCurve() ;
@@ -1877,13 +1872,7 @@ VolZmap::GenTool_ZMilling( unsigned int nGrid, const Point3d & ptS, const Point3
Vector3d vtMove = ptE - ptS ;
// Settaggio profilo
- CurveComposite* pToolProfile ;
- if ( m_ToolArcLineApprox.GetCurveCount() == 0)
- // Se l'utensile non è stato approssimato uso l'originale
- pToolProfile = &m_ToolOutline ;
- else
- // altrimenti usi l'approssimazione
- pToolProfile = &m_ToolArcLineApprox ;
+ const CurveComposite* pToolProfile = m_Tool.GetOutline() ;
// Ciclo sulle curve
const ICurve* pCurve = pToolProfile->GetFirstCurve() ;
@@ -1983,8 +1972,8 @@ VolZmap::CylBall_XYDrilling( unsigned int nGrid, const Point3d& ptS, const Point
return true ;
// Parametri geometrici dell'utensile e quota Z del movimento
- double dStemHeigth = m_dHeight - m_dTipHeight ;
- double dSqRad = m_dRadius * m_dRadius ;
+ double dStemHeigth = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
+ double dSqRad = m_Tool.GetRadius() * m_Tool.GetRadius() ;
double dZ = ptS.z ;
// Vettore movimento e sua lunghezza
@@ -2012,7 +2001,7 @@ VolZmap::CylBall_XYDrilling( unsigned int nGrid, const Point3d& ptS, const Point
// Zona lavorata dalla parte cilindrica
if ( dP1 > EPS_SMALL && dP1 < dStemHeigth + dLen - EPS_SMALL &&
- abs( dP2) < m_dRadius ) {
+ abs( dP2) < m_Tool.GetRadius()) {
double dH = sqrt( dSqRad - dP2 * dP2) ;
double dMin = dZ - dH ;
@@ -2033,7 +2022,7 @@ VolZmap::CylBall_XYDrilling( unsigned int nGrid, const Point3d& ptS, const Point
}
// Se l'utensile è sferico sottraggo anche la punta
- if ( m_nToolType == BALLMILL)
+ if ( m_Tool.GetType() == Tool::BALLMILL)
if ( dSqLen < dSqRad) { // LA SOLUZIONE MOMENTANEA è CREARE UTENSILE GENERICO SE LO STELO è PIù CORTO DEL RAGGIO
double dH = sqrt( dSqRad - dSqLen) ;
@@ -2064,9 +2053,9 @@ VolZmap::CylBall_XYPerp( unsigned int nGrid, const Point3d & ptS, const Point3d
return true ;
// Parametri geometrici dell'utensile
- double dStemHeigth = m_dHeight - m_dTipHeight ;
- double dSqRad = m_dRadius * m_dRadius ;
- double dSafeSqRad = dSqRad - 2 * m_dRadius * EPS_SMALL ;
+ double dStemHeigth = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
+ double dSqRad = m_Tool.GetRadius() * m_Tool.GetRadius() ;
+ double dSafeSqRad = dSqRad - 2 * m_Tool.GetRadius() * EPS_SMALL ;
// Studio simmetrie del problema
Point3d ptI = ( ptS.z <= ptE.z ? ptS : ptE) ;
@@ -2097,20 +2086,20 @@ VolZmap::CylBall_XYPerp( unsigned int nGrid, const Point3d & ptS, const Point3d
// Vettori e punti determinanti i piani
Vector3d vtP = vtMove ; // Se dLen < EPS_SMALL non si usa
vtP.Rotate( vtToolDir, 90) ;
- Point3d ptUp = ptI + m_dRadius * ( vtP.z > 0 ? vtP : - vtP) ;
- Point3d ptDw = ptI + m_dRadius * ( vtP.z > 0 ? - vtP : vtP) ;
+ Point3d ptUp = ptI + m_Tool.GetRadius() * ( vtP.z > 0 ? vtP : - vtP) ;
+ Point3d ptDw = ptI + m_Tool.GetRadius() * ( vtP.z > 0 ? - vtP : vtP) ;
Vector3d vtPXY( vtP.x, vtP.y, 0) ;
Vector3d vtUp = ptUp - ORIG ; double dDotUp = vtUp * vtP ;
Vector3d vtDw = ptDw - ORIG ; double dDotDw = vtDw * vtP ;
- double dSmall = m_dRadius * vtPXY.LenXY() ;
+ double dSmall = m_Tool.GetRadius() * vtPXY.LenXY() ;
// Parte sferica
double dCos = vtMove.z ; // vtMove.z > 0 : ptF.z >= ptI.z
double dSin = ( dCos < 1 ? sqrt( 1 - dCos * dCos) : 0) ;
- double dSemiAxMin = m_dRadius * dCos ;
+ double dSemiAxMin = m_Tool.GetRadius() * dCos ;
double dInfZ, dSupZ ;
@@ -2131,8 +2120,8 @@ VolZmap::CylBall_XYPerp( unsigned int nGrid, const Point3d & ptS, const Point3d
Vector3d vtNmin, vtNmax ;
if ( dP1 > EPS_SMALL && dP1 < dStemHeigth - EPS_SMALL &&
- dP2 > - m_dRadius + EPS_SMALL &&
- dP2 < m_dRadius - EPS_SMALL) {
+ dP2 > - m_Tool.GetRadius() + EPS_SMALL &&
+ dP2 < m_Tool.GetRadius() - EPS_SMALL) {
dInfZ = ptI.z - sqrt( dSqRad - dP2 * dP2) ;
dSupZ = ptF.z + sqrt( dSqRad - dP2 * dP2) ;
@@ -2149,7 +2138,7 @@ VolZmap::CylBall_XYPerp( unsigned int nGrid, const Point3d & ptS, const Point3d
SubtractIntervals( nGrid, i, j, dInfZ, dSupZ, vtNmin, vtNmax) ;
}
- if ( m_nToolType == BALLMILL) {
+ if ( m_Tool.GetType() == Tool::BALLMILL) {
if ( dP1 > dStemHeigth - 2 * EPS_SMALL && ( dP1 - dStemHeigth) * ( dP1 - dStemHeigth) + dP2 * dP2 < dSafeSqRad) {
@@ -2189,7 +2178,7 @@ VolZmap::CylBall_XYPerp( unsigned int nGrid, const Point3d & ptS, const Point3d
// Parte cilindrica
if ( dP1 > EPS_SMALL && dP1 < dStemHeigth - EPS_SMALL) {
- if ( dP2 > - m_dRadius && dP2 < dLenXY + m_dRadius) {
+ if ( dP2 > - m_Tool.GetRadius() && dP2 < dLenXY + m_Tool.GetRadius()) {
Vector3d vtNmin, vtNmax ;
@@ -2248,11 +2237,11 @@ VolZmap::CylBall_XYPerp( unsigned int nGrid, const Point3d & ptS, const Point3d
}
// Se l'utensile è ball-end sottraggo la punta
- if ( m_nToolType == BALLMILL) {
+ if ( m_Tool.GetType() == Tool::BALLMILL) {
if ( ( ( dP1 - dStemHeigth) * ( dP1 - dStemHeigth) + dP2 * dP2 < dSqRad ||
( dP1 - dStemHeigth) * ( dP1 - dStemHeigth) + ( dP2 - dLenXY) * ( dP2 - dLenXY) < dSqRad ||
- ( dP2 > 0 && dP2 < dLenXY && dP1 < m_dHeight)) && ( dP1 > dStemHeigth - 2 * EPS_SMALL)) {
+ ( dP2 > 0 && dP2 < dLenXY && dP1 < m_Tool.GetHeigth())) && ( dP1 > dStemHeigth - 2 * EPS_SMALL)) {
double dSqRoot = sqrt( dSqRad - ( dP1 - dStemHeigth) * ( dP1 - dStemHeigth)) ;
double dP2_0 = dCos * dSqRoot ;
@@ -2319,13 +2308,13 @@ VolZmap::CylBall_XYPerp( unsigned int nGrid, const Point3d & ptS, const Point3d
bool
VolZmap::CylBall_XYMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir)
{
- if ( m_nToolType == CYLMILL)
- return CompCyl_Milling( nGrid, ptS, ptE, vtToolDir, m_dHeight, m_dRadius, false, false) ;
+ if ( m_Tool.GetType() == Tool::CYLMILL)
+ return CompCyl_Milling( nGrid, ptS, ptE, vtToolDir, m_Tool.GetHeigth(), m_Tool.GetRadius(), false, false) ;
- else if ( m_nToolType == BALLMILL) {
- double dHei = m_dHeight - m_dTipHeight ;
- CompCyl_Milling( nGrid, ptS, ptE, vtToolDir, dHei, m_dRadius, false, false) ;
- CompBall_Milling( nGrid, ptS - dHei * vtToolDir, ptE - dHei * vtToolDir, m_dRadius) ;
+ else if ( m_Tool.GetType() == Tool::BALLMILL) {
+ double dHei = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
+ CompCyl_Milling( nGrid, ptS, ptE, vtToolDir, dHei, m_Tool.GetRadius(), false, false) ;
+ CompBall_Milling( nGrid, ptS - dHei * vtToolDir, ptE - dHei * vtToolDir, m_Tool.GetRadius()) ;
return true ;
}
@@ -2348,9 +2337,9 @@ VolZmap::Conus_XYDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d
return true ;
// Parametri geometrici dell'utensile
- double dStemHeigth = m_dHeight - m_dTipHeight ;
- double dMinRad = min( m_dRadius, m_dTipRadius) ;
- double dMaxRad = max( m_dRadius, m_dTipRadius) ;
+ double dStemHeigth = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
+ double dMinRad = min( m_Tool.GetRadius(), m_Tool.GetTipRadius()) ;
+ double dMaxRad = max( m_Tool.GetRadius(), m_Tool.GetTipRadius()) ;
double dDeltaRad = dMaxRad - dMinRad ;
double dSqMinRad = dMinRad * dMinRad ;
double dSqMaxRad = dMaxRad * dMaxRad ;
@@ -2358,24 +2347,24 @@ VolZmap::Conus_XYDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d
// Geometria del moto
double dLenXY = ( ptE - ptS).LenXY() ;
Point3d ptI = ( vtToolDir * ( ptE - ptS) < 0 ? ptS : ptE) ;
- double dMatStemLen = ( m_dRadius > m_dTipRadius ? dStemHeigth + dLenXY : dStemHeigth) ;
- double dSqTipRad = m_dTipRadius * m_dTipRadius ;
- double dSqRad = m_dRadius * m_dRadius ;
+ double dMatStemLen = ( m_Tool.GetRadius() > m_Tool.GetTipRadius() ? dStemHeigth + dLenXY : dStemHeigth) ;
+ double dSqTipRad = m_Tool.GetTipRadius() * m_Tool.GetTipRadius() ;
+ double dSqRad = m_Tool.GetRadius() * m_Tool.GetRadius() ;
// Determinazione del vertice del cono
- double dL = m_dTipHeight * dMaxRad / dDeltaRad ;
+ double dL = m_Tool.GetTipHeigth() * dMaxRad / dDeltaRad ;
Point3d ptV ; // Vertice
Vector3d vtV ; // Vettore riferimento con origine nel vertice
- if ( m_dRadius > m_dTipRadius) {
+ if ( m_Tool.GetRadius() > m_Tool.GetTipRadius()) {
vtV = vtToolDir ;
ptV = ( vtToolDir * ( ptE - ptS) < 0 ? ptE : ptS) - vtToolDir * ( dStemHeigth + dL) ;//dStemHeigth ;
}
else {
vtV = - vtToolDir ;
- ptV = ( vtToolDir * ( ptE - ptS) < 0 ? ptS : ptE) - vtToolDir * ( m_dHeight - dL) ;//dStemHeigth ;
+ ptV = ( vtToolDir * ( ptE - ptS) < 0 ? ptS : ptE) - vtToolDir * ( m_Tool.GetHeigth() - dL) ;//dStemHeigth ;
}
// Sistema di riferimento sul piano
@@ -2399,9 +2388,9 @@ VolZmap::Conus_XYDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d
double dX1 = vtC * vtV1 ;
double dX2 = vtC * vtV2 ;
- double dr = m_dRadius + ( dX1 - dMatStemLen) * ( m_dTipRadius - m_dRadius) / m_dTipHeight ;
+ double dr = m_Tool.GetRadius() + ( dX1 - dMatStemLen) * ( m_Tool.GetTipRadius() - m_Tool.GetRadius()) / m_Tool.GetTipHeigth() ;
- if ( dX1 > EPS_SMALL && dX1 < dMatStemLen && abs( dX2) < m_dRadius) {
+ if ( dX1 > EPS_SMALL && dX1 < dMatStemLen && abs( dX2) < m_Tool.GetRadius()) {
double dH = sqrt( dSqRad - dX2 * dX2) ;
double dMin = ptI.z - dH ;
@@ -2420,7 +2409,7 @@ VolZmap::Conus_XYDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d
}
else if ( dX1 >= dMatStemLen &&
- dX1 < dMatStemLen + m_dTipHeight - EPS_SMALL &&
+ dX1 < dMatStemLen + m_Tool.GetTipHeigth() - EPS_SMALL &&
abs( dX2) < dr) {
double dH = sqrt( dr * dr - dX2 * dX2) ;
@@ -2433,8 +2422,8 @@ VolZmap::Conus_XYDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d
Vector3d vtUmin = ( ptIntMin - ptV) - ( ptIntMin - ptV) * vtV * vtV ;
Vector3d vtUmax = ( ptIntMax - ptV) - ( ptIntMax - ptV) * vtV * vtV ;
- Vector3d vtNmin = dDeltaRad * vtV - m_dTipHeight * vtUmin ;
- Vector3d vtNmax = dDeltaRad * vtV - m_dTipHeight * vtUmax ;
+ Vector3d vtNmin = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtUmin ;
+ Vector3d vtNmax = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtUmax ;
vtNmin.Normalize() ;
vtNmax.Normalize() ;
@@ -2442,10 +2431,10 @@ VolZmap::Conus_XYDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d
SubtractIntervals( nGrid, i, j, dMin, dMax, vtNmin, vtNmax) ;
}
- if ( m_dTipRadius >= m_dRadius) {
+ if ( m_Tool.GetTipRadius() >= m_Tool.GetRadius()) {
- if ( dX1 > dMatStemLen + m_dTipHeight - 2 * EPS_SMALL &&
- dX1 < dMatStemLen + m_dTipHeight + dLenXY - EPS_SMALL &&
+ if ( dX1 > dMatStemLen + m_Tool.GetTipHeigth() - 2 * EPS_SMALL &&
+ dX1 < dMatStemLen + m_Tool.GetTipHeigth() + dLenXY - EPS_SMALL &&
abs( dX2) < dSqTipRad) {
double dH = sqrt( dSqTipRad - dX2 * dX2) ;
@@ -2481,11 +2470,11 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
return true ;
// Parametri geometrici dell'utensile
- double dStemHeigth = m_dHeight - m_dTipHeight ;
- double dMinRad = min( m_dRadius, m_dTipRadius) ;
- double dMaxRad = max( m_dRadius, m_dTipRadius) ;
- double dSqTipRad = m_dTipRadius * m_dTipRadius ;
- double dSqRad = m_dRadius * m_dRadius ;
+ double dStemHeigth = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
+ double dMinRad = min( m_Tool.GetRadius(), m_Tool.GetTipRadius()) ;
+ double dMaxRad = max( m_Tool.GetRadius(), m_Tool.GetTipRadius()) ;
+ double dSqTipRad = m_Tool.GetTipRadius() * m_Tool.GetTipRadius() ;
+ double dSqRad = m_Tool.GetRadius() * m_Tool.GetRadius() ;
double dDeltaRad = dMaxRad - dMinRad ;
double dSqMinRad = dMinRad * dMinRad ;
double dSqMaxRad = dMaxRad * dMaxRad ;
@@ -2508,10 +2497,10 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
vtMove.Normalize() ;
// Riferimento coni
- double dL = m_dTipHeight * dMaxRad / dDeltaRad ;
- Vector3d vtV = ( m_dRadius > m_dTipRadius ? vtToolDir : - vtToolDir) ;
- Point3d ptVI = ptI - ( m_dRadius > m_dTipRadius ? dStemHeigth + dL : m_dHeight - dL) * vtToolDir ;
- Point3d ptVF = ptF - ( m_dRadius > m_dTipRadius ? dStemHeigth + dL : m_dHeight - dL) * vtToolDir ;
+ double dL = m_Tool.GetTipHeigth() * dMaxRad / dDeltaRad ;
+ Vector3d vtV = ( m_Tool.GetRadius() > m_Tool.GetTipRadius() ? vtToolDir : - vtToolDir) ;
+ Point3d ptVI = ptI - ( m_Tool.GetRadius() > m_Tool.GetTipRadius() ? dStemHeigth + dL : m_Tool.GetHeigth() - dL) * vtToolDir ;
+ Point3d ptVF = ptF - ( m_Tool.GetRadius() > m_Tool.GetTipRadius() ? dStemHeigth + dL : m_Tool.GetHeigth() - dL) * vtToolDir ;
// Movimento verticale
@@ -2539,7 +2528,7 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
// Parte cilindrica
if ( dP1 > EPS_SMALL && dP1 <= dStemHeigth &&
- dP2 > - m_dRadius + EPS_SMALL && dP2 < m_dRadius - EPS_SMALL) {
+ dP2 > - m_Tool.GetRadius() + EPS_SMALL && dP2 < m_Tool.GetRadius() - EPS_SMALL) {
dMin = dZI - sqrt( dSqRad - dP2 * dP2) ;
dMax = dZF + sqrt( dSqRad - dP2 * dP2) ;
@@ -2557,11 +2546,11 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
}
// Parte conica
- else if ( dP1 > dStemHeigth && dP1 < m_dHeight - EPS_SMALL && abs( dP2) < m_dRadius +
- ( m_dTipRadius - m_dRadius) * ( dP1 - dStemHeigth) / m_dTipHeight - EPS_SMALL) {
+ else if ( dP1 > dStemHeigth && dP1 < m_Tool.GetHeigth() - EPS_SMALL && abs( dP2) < m_Tool.GetRadius() +
+ ( m_Tool.GetTipRadius() - m_Tool.GetRadius()) * ( dP1 - dStemHeigth) / m_Tool.GetTipHeigth() - EPS_SMALL) {
double dr = dP2 ;
- double dMr = m_dRadius + ( m_dTipRadius - m_dRadius) * ( dP1 - dStemHeigth) / m_dTipHeight ;
+ double dMr = m_Tool.GetRadius() + ( m_Tool.GetTipRadius() - m_Tool.GetRadius()) * ( dP1 - dStemHeigth) / m_Tool.GetTipHeigth() ;
dMin = dZI - sqrt( dMr * dMr - dr * dr) ;
dMax = dZF + sqrt( dMr * dMr - dr * dr) ;
@@ -2575,8 +2564,8 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
vtUmin.Normalize() ;
vtUmax.Normalize() ;
- vtNmin = dDeltaRad * vtV - m_dTipHeight * vtUmin ;
- vtNmax = dDeltaRad * vtV - m_dTipHeight * vtUmax ;
+ vtNmin = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtUmin ;
+ vtNmax = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtUmax ;
vtNmin.Normalize() ;
vtNmax.Normalize() ;
@@ -2597,19 +2586,19 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
Vector3d vtCross = vtToolDir ^ vtMove ;
if ( vtCross.z < 0) vtCross = - vtCross ;
// Punti di tangenza
- Point3d ptUp = ptI - vtToolDir * dStemHeigth + m_dRadius * vtCross ;
- Point3d ptDw = ptI - vtToolDir * dStemHeigth - m_dRadius * vtCross ;
- double dSmallLength = m_dRadius * vtCross.LenXY() ;
+ Point3d ptUp = ptI - vtToolDir * dStemHeigth + m_Tool.GetRadius() * vtCross ;
+ Point3d ptDw = ptI - vtToolDir * dStemHeigth - m_Tool.GetRadius() * vtCross ;
+ double dSmallLength = m_Tool.GetRadius() * vtCross.LenXY() ;
// Punti di tangenza in corrispondenza della punta
- Point3d ptTipUp = ptI - vtToolDir * m_dHeight + m_dTipRadius * vtCross ;
- Point3d ptTipDw = ptI - vtToolDir * m_dHeight - m_dTipRadius * vtCross ;
+ Point3d ptTipUp = ptI - vtToolDir * m_Tool.GetHeigth() + m_Tool.GetTipRadius() * vtCross ;
+ Point3d ptTipDw = ptI - vtToolDir * m_Tool.GetHeigth() - m_Tool.GetTipRadius() * vtCross ;
Vector3d vtUpTan = ptTipUp - ptUp ;
Vector3d vtDwTan = ptTipDw - ptDw ;
Vector3d vtUpTanXY( vtUpTan.x, vtUpTan.y, 0) ;
double dDeltaSmallAbs = abs( vtUpTanXY * vtV2) ;
- double dDeltaSmall = ( m_dRadius > m_dTipRadius ? dDeltaSmallAbs : - dDeltaSmallAbs) ;
+ double dDeltaSmall = ( m_Tool.GetRadius() > m_Tool.GetTipRadius() ? dDeltaSmallAbs : - dDeltaSmallAbs) ;
vtUpTan.Normalize() ;
vtDwTan.Normalize() ;
@@ -2649,7 +2638,7 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
// Parte cilindrica
if ( dP1 > EPS_SMALL && dP1 <= dStemHeigth && // vedere se conviene dP1 < dStemHeigth + eps oppure dP1 <= dStemHeigth
- dP2 > - m_dRadius && dP2 < dLengthPathXY + m_dRadius) {
+ dP2 > - m_Tool.GetRadius() && dP2 < dLengthPathXY + m_Tool.GetRadius()) {
// Massimi
if ( dP2 < - dSmallLength) {
@@ -2695,16 +2684,16 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
}
// Parte conica
- else if ( dP1 > dStemHeigth && dP1 < m_dHeight - EPS_SMALL &&
- dP2 > - m_dRadius - ( m_dTipRadius - m_dRadius) * ( dP1 - dStemHeigth) / m_dTipHeight &&
- dP2 < m_dRadius + dLengthPathXY +
- ( m_dTipRadius - m_dRadius) * ( dP1 - dStemHeigth) / m_dTipHeight) {
+ else if ( dP1 > dStemHeigth && dP1 < m_Tool.GetHeigth() - EPS_SMALL &&
+ dP2 > - m_Tool.GetRadius() - ( m_Tool.GetTipRadius() - m_Tool.GetRadius()) * ( dP1 - dStemHeigth) / m_Tool.GetTipHeigth() &&
+ dP2 < m_Tool.GetRadius() + dLengthPathXY +
+ ( m_Tool.GetTipRadius() - m_Tool.GetRadius()) * ( dP1 - dStemHeigth) / m_Tool.GetTipHeigth()) {
// Massimi
- if ( dP2 < - dSmallLength + dDeltaSmall * ( dP1 - dStemHeigth) / m_dTipHeight) {
+ if ( dP2 < - dSmallLength + dDeltaSmall * ( dP1 - dStemHeigth) / m_Tool.GetTipHeigth()) {
double dr = dP2 ;
- double dMr = m_dRadius + ( m_dTipRadius - m_dRadius) * ( dP1 - dStemHeigth) / m_dTipHeight ;
+ double dMr = m_Tool.GetRadius() + ( m_Tool.GetTipRadius() - m_Tool.GetRadius()) * ( dP1 - dStemHeigth) / m_Tool.GetTipHeigth() ;
dMax = dZI + sqrt( dMr * dMr - dr * dr) ;
@@ -2714,20 +2703,20 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
vtU.Normalize() ;
- vtNmax = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmax = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmax.Normalize() ;
}
else if ( dP2 < dLengthPathXY - dSmallLength +
- dDeltaSmall * ( dP1 - dStemHeigth) / m_dTipHeight) {
+ dDeltaSmall * ( dP1 - dStemHeigth) / m_Tool.GetTipHeigth()) {
dMax = ( dDotUp - dX * vtUpCross.x - dY * vtUpCross.y) / vtUpCross.z ;
vtNmax = vtUpCross ;
}
else {
double dr = dP2 - dLengthPathXY ;
- double dMr = m_dRadius + ( m_dTipRadius - m_dRadius) * ( dP1 - dStemHeigth) / m_dTipHeight ;
+ double dMr = m_Tool.GetRadius() + ( m_Tool.GetTipRadius() - m_Tool.GetRadius()) * ( dP1 - dStemHeigth) / m_Tool.GetTipHeigth() ;
dMax = dZF + sqrt( dMr * dMr - dr * dr) ;
@@ -2737,16 +2726,16 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
vtU.Normalize() ;
- vtNmax = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmax = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmax.Normalize() ;
}
// Minimi
- if ( dP2 < dSmallLength - dDeltaSmall * ( dP1 - dStemHeigth) / m_dTipHeight) {
+ if ( dP2 < dSmallLength - dDeltaSmall * ( dP1 - dStemHeigth) / m_Tool.GetTipHeigth()) {
double dr = dP2 ;
- double dMr = m_dRadius + ( m_dTipRadius - m_dRadius) * ( dP1 - dStemHeigth) / m_dTipHeight ;
+ double dMr = m_Tool.GetRadius() + ( m_Tool.GetTipRadius() - m_Tool.GetRadius()) * ( dP1 - dStemHeigth) / m_Tool.GetTipHeigth() ;
dMin = dZI - sqrt( dMr * dMr - dr * dr) ;
@@ -2756,12 +2745,12 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
vtU.Normalize() ;
- vtNmin = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmin = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmin.Normalize() ;
}
- else if ( dP2 < dLengthPathXY + dSmallLength - dDeltaSmall * ( dP1 - dStemHeigth) / m_dTipHeight) {
+ else if ( dP2 < dLengthPathXY + dSmallLength - dDeltaSmall * ( dP1 - dStemHeigth) / m_Tool.GetTipHeigth()) {
dMin = ( dDotDw - dX * vtDwCross.x - dY * vtDwCross.y) / vtDwCross.z ;
vtNmin = vtDwCross ;
}
@@ -2769,7 +2758,7 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
else {
double dr = dP2 - dLengthPathXY ;
- double dMr = m_dRadius + ( m_dTipRadius - m_dRadius) * ( dP1 - dStemHeigth) / m_dTipHeight ;
+ double dMr = m_Tool.GetRadius() + ( m_Tool.GetTipRadius() - m_Tool.GetRadius()) * ( dP1 - dStemHeigth) / m_Tool.GetTipHeigth() ;
dMin = dZF - sqrt( dMr * dMr - dr * dr) ;
@@ -2779,7 +2768,7 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
vtU.Normalize() ;
- vtNmin = dDeltaRad * vtV - m_dTipHeight * vtU ;
+ vtNmin = dDeltaRad * vtV - m_Tool.GetTipHeigth() * vtU ;
vtNmin.Normalize() ;
}
@@ -2796,20 +2785,20 @@ VolZmap::Conus_XYPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
bool
VolZmap::Conus_XYMilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir)
{
- double dStemHeigth = m_dHeight - m_dTipHeight ;
+ double dStemHeigth = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
- CompCyl_Milling( nGrid, ptS, ptE, vtToolDir, dStemHeigth, m_dRadius, false, true) ;
+ CompCyl_Milling( nGrid, ptS, ptE, vtToolDir, dStemHeigth, m_Tool.GetRadius(), false, true) ;
- if ( m_dTipRadius < m_dRadius) {
+ if ( m_Tool.GetTipRadius() < m_Tool.GetRadius()) {
Point3d ptSTip = ptS - dStemHeigth * vtToolDir ;
Point3d ptETip = ptE - dStemHeigth * vtToolDir ;
- CompConus_Milling( nGrid, ptSTip, ptETip, vtToolDir, m_dTipHeight, m_dRadius, m_dTipRadius, true, false) ;
+ CompConus_Milling( nGrid, ptSTip, ptETip, vtToolDir, m_Tool.GetTipHeigth(), m_Tool.GetRadius(), m_Tool.GetTipRadius(), true, false) ;
}
else {
- Point3d ptSTip = ptS - m_dHeight * vtToolDir ;
- Point3d ptETip = ptE - m_dHeight * vtToolDir ;
- CompConus_Milling( nGrid, ptSTip, ptETip, - vtToolDir, m_dTipHeight, m_dTipRadius, m_dRadius, false, true) ;
+ Point3d ptSTip = ptS - m_Tool.GetHeigth() * vtToolDir ;
+ Point3d ptETip = ptE - m_Tool.GetHeigth() * vtToolDir ;
+ CompConus_Milling( nGrid, ptSTip, ptETip, - vtToolDir, m_Tool.GetTipHeigth(), m_Tool.GetTipRadius(), m_Tool.GetRadius(), false, true) ;
}
return true ;
@@ -2822,15 +2811,15 @@ VolZmap::Conus_XYMilling( unsigned int nGrid, const Point3d & ptS, const Point3d
bool
VolZmap::CylBall_Drilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir)
{
- double dStemHeigth = m_dHeight - m_dRadius ;
+ double dStemHeigth = m_Tool.GetHeigth() - m_Tool.GetRadius() ;
- CompCyl_Drilling( nGrid, ptS, ptE, vtToolDir, dStemHeigth, m_dRadius, false, false) ;
+ CompCyl_Drilling( nGrid, ptS, ptE, vtToolDir, dStemHeigth, m_Tool.GetRadius(), false, false) ;
// Sfera
- if ( m_nToolType == 2) {
+ if ( m_Tool.GetType() == Tool::BALLMILL) {
Point3d ptSBall = ptS - dStemHeigth * vtToolDir ;
Point3d ptEBall = ptE - dStemHeigth * vtToolDir ;
- CompBall_Milling( nGrid, ptSBall, ptEBall, m_dRadius) ;
+ CompBall_Milling( nGrid, ptSBall, ptEBall, m_Tool.GetRadius()) ;
}
return true ;
@@ -2839,15 +2828,15 @@ VolZmap::CylBall_Drilling( unsigned int nGrid, const Point3d & ptS, const Point3
bool
VolZmap::CylBall_Milling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir)
{
- double dStemHeigth = m_dHeight - m_dTipHeight ;
+ double dStemHeigth = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
- CompCyl_Milling( nGrid, ptS, ptE, vtToolDir, dStemHeigth, m_dRadius, false, false) ;
+ CompCyl_Milling( nGrid, ptS, ptE, vtToolDir, dStemHeigth, m_Tool.GetRadius(), false, false) ;
// Sfera
- if ( m_nToolType == 2) {
+ if ( m_Tool.GetType() == Tool::BALLMILL) {
Point3d ptSBall = ptS - dStemHeigth * vtToolDir ;
Point3d ptEBall = ptE - dStemHeigth * vtToolDir ;
- CompBall_Milling( nGrid, ptSBall, ptEBall, m_dRadius) ;
+ CompBall_Milling( nGrid, ptSBall, ptEBall, m_Tool.GetRadius()) ;
}
return true ;
@@ -2858,21 +2847,21 @@ VolZmap::CylBall_Milling( unsigned int nGrid, const Point3d & ptS, const Point3d
bool
VolZmap::Conus_Drilling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir)
{
- double dStemHeigth = m_dHeight - m_dTipHeight ;
+ double dStemHeigth = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
- CompCyl_Drilling( nGrid, ptS, ptE, vtToolDir, dStemHeigth, m_dRadius, false, true) ;
+ CompCyl_Drilling( nGrid, ptS, ptE, vtToolDir, dStemHeigth, m_Tool.GetRadius(), false, true) ;
// Trapano
- if ( m_dTipRadius < m_dRadius) {
+ if ( m_Tool.GetTipRadius() < m_Tool.GetRadius()) {
Point3d ptSCone = ptS - dStemHeigth * vtToolDir ;
Point3d ptECone = ptE - dStemHeigth * vtToolDir ;
- CompConus_Drilling( nGrid, ptSCone, ptECone, vtToolDir, m_dTipHeight, m_dRadius, m_dTipRadius, true, false) ;
+ CompConus_Drilling( nGrid, ptSCone, ptECone, vtToolDir, m_Tool.GetTipHeigth(), m_Tool.GetRadius(), m_Tool.GetTipRadius(), true, false) ;
}
else {
- Point3d ptSCone = ptS - m_dHeight * vtToolDir ;
- Point3d ptECone = ptE - m_dHeight * vtToolDir ;
- CompConus_Drilling( nGrid, ptSCone, ptECone, - vtToolDir, m_dTipHeight, m_dTipRadius, m_dRadius, false, true) ;
+ Point3d ptSCone = ptS - m_Tool.GetHeigth() * vtToolDir ;
+ Point3d ptECone = ptE - m_Tool.GetHeigth() * vtToolDir ;
+ CompConus_Drilling( nGrid, ptSCone, ptECone, - vtToolDir, m_Tool.GetTipHeigth(), m_Tool.GetTipRadius(), m_Tool.GetRadius(), false, true) ;
}
return true ;
@@ -2882,21 +2871,21 @@ VolZmap::Conus_Drilling( unsigned int nGrid, const Point3d & ptS, const Point3d
bool
VolZmap::Conus_Milling( unsigned int nGrid, const Point3d & ptS, const Point3d & ptE, const Vector3d & vtToolDir)
{
- double dStemHeigth = m_dHeight - m_dTipHeight ;
+ double dStemHeigth = m_Tool.GetHeigth() - m_Tool.GetTipHeigth() ;
- CompCyl_Milling( nGrid, ptS, ptE, vtToolDir, dStemHeigth, m_dRadius, false, true) ;
+ CompCyl_Milling( nGrid, ptS, ptE, vtToolDir, dStemHeigth, m_Tool.GetRadius(), false, true) ;
// Trapano
- if ( m_dTipRadius < m_dRadius) {
+ if ( m_Tool.GetTipRadius() < m_Tool.GetRadius()) {
Point3d ptSBall = ptS - dStemHeigth * vtToolDir ;
Point3d ptEBall = ptE - dStemHeigth * vtToolDir ;
- CompConus_Milling( nGrid, ptSBall, ptEBall, vtToolDir, m_dTipHeight, m_dRadius, m_dTipRadius, true, false) ;
+ CompConus_Milling( nGrid, ptSBall, ptEBall, vtToolDir, m_Tool.GetTipHeigth(), m_Tool.GetRadius(), m_Tool.GetTipRadius(), true, false) ;
}
else {
- Point3d ptSBall = ptS - m_dHeight * vtToolDir ;
- Point3d ptEBall = ptE - m_dHeight * vtToolDir ;
- CompConus_Milling( nGrid, ptSBall, ptEBall, - vtToolDir, m_dTipHeight, m_dTipRadius, m_dRadius, false, true) ;
+ Point3d ptSBall = ptS - m_Tool.GetHeigth() * vtToolDir ;
+ Point3d ptEBall = ptE - m_Tool.GetHeigth() * vtToolDir ;
+ CompConus_Milling( nGrid, ptSBall, ptEBall, - vtToolDir, m_Tool.GetTipHeigth(), m_Tool.GetTipRadius(), m_Tool.GetRadius(), false, true) ;
}
return true ;
@@ -2915,20 +2904,20 @@ VolZmap::Mrt_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
// Scompongo la mortasatrice in solidi semplici
// Parallelepipedo di base
- double dLenX = m_dMrtChsWidth ;
- double dLenY = m_dMrtChsThickness ;
- double dLenZ = m_dHeight - m_dRCorner ;
+ double dLenX = m_Tool.GetMrtChsWidth() ;
+ double dLenY = m_Tool.GetMrtChsThickness() ;
+ double dLenZ = m_Tool.GetHeigth() - m_Tool.GetCornRadius() ;
CompPar_Drilling( nGrid, dLenX, dLenY, dLenZ, ptS, ptEOnP, vtToolDir, vtAux) ;
// Se la punta è di tipo bull-nose
- if ( abs( m_dMrtChsWidth - 2 * m_dRCorner) > EPS_SMALL) {
+ if ( abs( m_Tool.GetMrtChsWidth() - 2 * m_Tool.GetCornRadius()) > EPS_SMALL) {
// Parallelepipedo di punta
Point3d ptTipS = ptS - dLenZ * vtToolDir ;
Point3d ptTipE = ptEOnP - dLenZ * vtToolDir ;
- dLenX = abs( m_dMrtChsWidth - 2 * m_dRCorner) ;
- dLenZ = m_dRCorner ;
+ dLenX = abs( m_Tool.GetMrtChsWidth() - 2 * m_Tool.GetCornRadius()) ;
+ dLenZ = m_Tool.GetCornRadius() ;
CompPar_Drilling( nGrid, dLenX, dLenY, dLenZ, ptTipS, ptTipE, vtToolDir, vtAux) ;
@@ -2940,8 +2929,8 @@ VolZmap::Mrt_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
Point3d ptSplus = ptTipS + ( 0.5 * dLenX) * vtVOnP + 0.5 * dLenY * vtAux ;
Point3d ptEplus = ptTipE + ( 0.5 * dLenX) * vtVOnP + 0.5 * dLenY * vtAux ;
- CompCyl_Milling( nGrid, ptSminus, ptEminus, vtAux, dLenY, m_dRCorner, false, false) ;
- CompCyl_Milling( nGrid, ptSplus, ptEplus, vtAux, dLenY, m_dRCorner, false, false) ;
+ CompCyl_Milling( nGrid, ptSminus, ptEminus, vtAux, dLenY, m_Tool.GetCornRadius(), false, false) ;
+ CompCyl_Milling( nGrid, ptSplus, ptEplus, vtAux, dLenY, m_Tool.GetCornRadius(), false, false) ;
}
// se la punta è di tipo sfera
@@ -2949,7 +2938,7 @@ VolZmap::Mrt_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
// Cilindro
Point3d ptCylS = ptS - dLenZ * vtToolDir + 0.5 * dLenY * vtAux ;
Point3d ptCylE = ptEOnP - dLenZ * vtToolDir + 0.5 * dLenY * vtAux ;
- CompCyl_Milling( nGrid, ptCylS, ptCylE, vtAux, dLenY, m_dRCorner, false, false) ;
+ CompCyl_Milling( nGrid, ptCylS, ptCylE, vtAux, dLenY, m_Tool.GetCornRadius(), false, false) ;
}
return true ;
@@ -2967,21 +2956,21 @@ VolZmap::Mrt_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE
// Scompongo la mortasatrice in solidi semplici
// Parallelepipedo di base
- double dLenX = m_dMrtChsWidth ;
- double dLenY = m_dMrtChsThickness ;
- double dLenZ = m_dHeight - m_dRCorner ;
+ double dLenX = m_Tool.GetMrtChsWidth() ;
+ double dLenY = m_Tool.GetMrtChsThickness() ;
+ double dLenZ = m_Tool.GetHeigth() - m_Tool.GetCornRadius() ;
CompPar_Milling( nGrid, dLenX, dLenY, dLenZ, ptS, ptEp, vtToolDir, vtAux) ;
// Se la punta è di tipo bull-nose
- if ( abs( m_dMrtChsWidth - 2 * m_dRCorner) > EPS_SMALL) {
+ if ( abs( m_Tool.GetMrtChsWidth() - 2 * m_Tool.GetCornRadius()) > EPS_SMALL) {
// Parallelepipedo di punta
Point3d ptTipS = ptS - dLenZ * vtToolDir ;
Point3d ptTipE = ptEp - dLenZ * vtToolDir ;
- dLenX = abs( m_dMrtChsWidth - 2 * m_dRCorner) ;
- dLenZ = m_dRCorner ;
+ dLenX = abs( m_Tool.GetMrtChsWidth() - 2 * m_Tool.GetCornRadius()) ;
+ dLenZ = m_Tool.GetCornRadius() ;
Vector3d vtVOnP = vtToolDir ^ vtAux ;
if ( vtVOnP * ( ptTipE - ptTipS) < 0)
@@ -2992,7 +2981,7 @@ VolZmap::Mrt_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE
Point3d ptEminus = ptTipE - ( 0.5 * dLenX) * vtVOnP + 0.5 * dLenY * vtAux ;
Point3d ptSplus = ptTipS + ( 0.5 * dLenX) * vtVOnP + 0.5 * dLenY * vtAux ;
Point3d ptEplus = ptTipE + ( 0.5 * dLenX) * vtVOnP + 0.5 * dLenY * vtAux ;
- CompCyl_Milling( nGrid, ptSminus, ptEplus, vtAux, dLenY, m_dRCorner, false, false) ;
+ CompCyl_Milling( nGrid, ptSminus, ptEplus, vtAux, dLenY, m_Tool.GetCornRadius(), false, false) ;
}
// se la punta è di tipo sfera
@@ -3000,7 +2989,7 @@ VolZmap::Mrt_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE
// Cilindro
Point3d ptCylS = ptS - dLenZ * vtToolDir + 0.5 * dLenY * vtAux ;
Point3d ptCylE = ptEp - dLenZ * vtToolDir + 0.5 * dLenY * vtAux ;
- CompCyl_Milling( nGrid, ptCylS, ptCylE, vtAux, dLenY, m_dRCorner, false, false) ;
+ CompCyl_Milling( nGrid, ptCylS, ptCylE, vtAux, dLenY, m_Tool.GetCornRadius(), false, false) ;
}
return true ;
@@ -3016,7 +3005,7 @@ VolZmap::Chs_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& pt
// Proiezione della traiettoria sulla varietà del movimento
Point3d ptProjE = ptS + ( ptE - ptS) * vtToolDir * vtToolDir ;
- CompPar_Drilling( nGrid, m_dMrtChsWidth, m_dMrtChsThickness, m_dHeight, ptS, ptProjE, vtToolDir, vtAux) ;
+ CompPar_Drilling( nGrid, m_Tool.GetMrtChsWidth(), m_Tool.GetMrtChsThickness(), m_Tool.GetHeigth(), ptS, ptProjE, vtToolDir, vtAux) ;
return true ;
}
@@ -3030,7 +3019,7 @@ VolZmap::Chs_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE
Vector3d vtMoveOnP = ( ptE - ptS) - ( ptE - ptS) * vtToolDir * vtToolDir ;
Point3d ptProjE = ptS + vtMoveOnP ;
- CompPar_Milling( nGrid, m_dMrtChsWidth, m_dMrtChsThickness, m_dHeight, ptS, ptProjE, vtToolDir, vtAux) ;
+ CompPar_Milling( nGrid, m_Tool.GetMrtChsWidth(), m_Tool.GetMrtChsThickness(), m_Tool.GetHeigth(), ptS, ptProjE, vtToolDir, vtAux) ;
return true ;
}
@@ -3048,14 +3037,7 @@ VolZmap::GenTool_Drilling( unsigned int nGrid, const Point3d & ptS, const Point3
Vector3d vtMove = ptE - ptS ;
// Settaggio profilo
- CurveComposite* pToolProfile ;
-
- if ( m_ToolArcLineApprox.GetCurveCount() == 0)
- // Se l'utensile non è stato approssimato uso l'originale
- pToolProfile = & m_ToolOutline ;
- else
- // altrimenti uso l'approssimazione
- pToolProfile = &m_ToolArcLineApprox ;
+ const CurveComposite* pToolProfile = m_Tool.GetOutline() ;
// Ciclo sulle curve
const ICurve* pCurve = pToolProfile->GetFirstCurve() ;
@@ -3199,16 +3181,9 @@ VolZmap::GenTool_Milling( unsigned int nGrid, const Point3d & ptS, const Point3d
Point3d ptI = ptS ;
Point3d ptF = ptE ;
Vector3d vtMove = ptE - ptS ;
-
- // Settaggio profilo
- CurveComposite* pToolProfile ;
-
- if ( m_ToolArcLineApprox.GetCurveCount() == 0)
- // Se l'utensile non è stato approssimato uso l'originale
- pToolProfile = & m_ToolOutline ;
- else
- // altrimenti uso l'approssimazione
- pToolProfile = &m_ToolArcLineApprox ;
+
+ // Settaggio profilo
+ const CurveComposite* pToolProfile = m_Tool.GetOutline() ;
// Ciclo sulle curve
const ICurve* pCurve = pToolProfile->GetFirstCurve() ;
@@ -5089,11 +5064,11 @@ VolZmap::BoundingBox( unsigned int nGrid, const Point3d& ptP1, const Point3d& pt
double dMaxZValue = m_dMaxZ[nGrid] ;
// Determinazione del raggio massimo dell'utensile
- double dMaxRad = max( m_dRadius, m_dTipRadius) ;
+ 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_dHeight * vtV ;
- Point3d ptP2T = ptP2 - m_dHeight * vtV ;
+ 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 ;