From 6005c6b238f6d65aa7b42bfa6718060d237bcb3e Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 7 Dec 2020 08:16:44 +0000 Subject: [PATCH] Include : - aggiornamento costanti Mach - aggiunta classe BBox1d. --- EGkBBox1d.h | 96 ++++++++++++++++++++++++++++++++++++++++++ EMkMachiningGeoConst.h | 6 +++ 2 files changed, 102 insertions(+) create mode 100644 EGkBBox1d.h diff --git a/EGkBBox1d.h b/EGkBBox1d.h new file mode 100644 index 0000000..74b48fc --- /dev/null +++ b/EGkBBox1d.h @@ -0,0 +1,96 @@ +//---------------------------------------------------------------------------- +// EgalTech 2020-2020 +//---------------------------------------------------------------------------- +// File : EGkBBox1d.h Data : 06.12.20 Versione : 2.2l1 +// Contenuto : Dichiarazione della classe bounding box BBox1d. +// +// +// +// Modifiche : 06.12.20 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "/EgtDev/Include/EGkGeoConst.h" +#include + +//---------------------------------------------------------------------------- +class BBox1d +{ + public : + BBox1d( void) // Box vuoto (min > MAX) + : m_dMin( +INFINITO), m_dMax( -INFINITO) {} + BBox1d( double dX) + : m_dMin( dX), m_dMax( dX) {} + BBox1d( double dX1, double dX2) + : m_dMin( std::min( dX1, dX2)), m_dMax( std::max( dX1, dX2)) {} + void Reset( void) + { m_dMin = +INFINITO ; + m_dMax = -INFINITO ; } + void Set( double dX) + { m_dMin = dX ; m_dMax = m_dMin ; } + void Set( double dX1, double dX2) + { m_dMin = std::min( dX1, dX2) ; m_dMax = std::max( dX1, dX2) ; } + + public : + bool IsEmpty( void) const + { return ( ! IsValid()) ; } + bool IsSmall( void) const + { return ( ! IsValid() || m_dMax - m_dMin < EPS_SMALL) ; } + bool IsEpsilon( double dToler) const + { return ( ! IsValid() || m_dMax - m_dMin < dToler) ; } + void Add( double dX) + { m_dMin = std::min( dX, m_dMin) ; + m_dMax = std::max( dX, m_dMax) ; } + void Add( const BBox1d& b1Box) + { m_dMin = std::min( b1Box.m_dMin, m_dMin) ; + m_dMax = std::max( b1Box.m_dMax, m_dMax) ; } + void Expand( double dDelta) + { if ( ! IsValid()) + return ; + m_dMin -= dDelta ; + m_dMax += dDelta ; } + double GetMin( void) const + { return m_dMin ; } + double GetMax( void) const + { return m_dMax ; } + bool GetMinMax( double& dMin, double& dMax) const + { if ( ! IsValid()) + return false ; + dMin = m_dMin ; + dMax = m_dMax ; + return true ; } + bool GetMinDim( double& dMin, double& dDim) const + { if ( ! IsValid()) + return false ; + dMin = m_dMin ; + dDim = m_dMax - m_dMin ; + return true ; } + bool GetCenterExtent( double& dCen, double& dRad) const + { if ( ! IsValid()) + return false ; + dCen = ( m_dMin + m_dMax) / 2 ; + dRad = ( m_dMax - m_dMin) / 2 ; + return true ; } + bool Encloses( double dVal) const + { return ( IsValid() && dVal > m_dMin - EPS_SMALL && dVal < m_dMax + EPS_SMALL) ; } + bool Encloses( const BBox1d& b1Box) const + { return ( IsValid() && b1Box.IsValid() && b1Box.m_dMin > m_dMin - EPS_SMALL && b1Box.m_dMax < m_dMax + EPS_SMALL) ; } + bool Overlaps( const BBox1d& b1Box) const + { return ( IsValid() && b1Box.IsValid() && b1Box.m_dMin < m_dMax + EPS_SMALL && b1Box.m_dMax > m_dMin - EPS_SMALL) ; } + bool FindIntersection( const BBox1d& b1Box, BBox1d& b1Int) const + { if ( ! Overlaps( b1Box)) + return false ; + b1Int.Set( std::max( m_dMin, b1Box.m_dMin), std::min( m_dMax, b1Box.m_dMax)) ; + return true ; } + + private : + bool IsValid( void) const + { return ( m_dMin < ( m_dMax + EPS_SMALL)) ; } + + private : + double m_dMin ; + double m_dMax ; +} ; diff --git a/EMkMachiningGeoConst.h b/EMkMachiningGeoConst.h index 9e633b3..f9e80c1 100644 --- a/EMkMachiningGeoConst.h +++ b/EMkMachiningGeoConst.h @@ -89,6 +89,9 @@ static std::string KEY_END = "END" ; // Chiavi info in sottogruppo di CL per punti minimo e massimo di ingombro di singolo percorso static std::string KEY_PMIN = "PMIN" ; static std::string KEY_PMAX = "PMAX" ; +// Chiavi info in sottogruppo di CL per punti assi minimo e massimo di ingombro di singolo percorso +static std::string KEY_PAXMIN = "PAXMIN" ; +static std::string KEY_PAXMAX = "PAXMAX" ; // Chiave info in sottogruppo di CL per massima elevazione static std::string KEY_ELEV = "ELEV" ; // Chiavi info in sottogruppo di CL per dati ausiliari @@ -99,6 +102,9 @@ static std::string KEY_AE = "AE" ; // Chiavi info in gruppo CL per punti minimo e massimo di ingombro di tutta la lavorazione static std::string KEY_MMIN = "MMIN" ; static std::string KEY_MMAX = "MMAX" ; +// Chiavi info in gruppo CL per punti assi minimo e massimo di ingombro di tutta la lavorazione +static std::string KEY_MAXMIN = "MAXMIN" ; +static std::string KEY_MAXMAX = "MAXMAX" ; //----------------- Costanti posizione per preview utensile in lavorazione ------ enum MchToolShow { MCH_TPM_CURR = 0,