Files
EgtGeomKernel/VolZmap.h
T
Dario Sassi 3bbdfc4a74 EgtGeomKernel 1.6r9 :
- inseriti sviluppi Zmap.
2016-06-13 07:10:18 +00:00

184 lines
10 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : VolZmap.h Data : 22.01.15 Versione : 1.6a4
// Contenuto : Dichiarazione della classe Volume Zmap.
//
//
//
// Modifiche : 22.01.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "ObjGraphicsMgr.h"
#include "DllMain.h"
#include "GeoObjRW.h"
#include "/EgtDev/Include/EGkVolZmap.h"
#include "/EgtDev/Include/EGkPoint3d.h"
#include "/EgtDev/Include/EGkVector3d.h"
#include "CurveComposite.h"
#include <vector>
#include <string>
// Tipi utensile
enum ToolType { GenericTool = 0, CylindricalMill = 1, BallEndMill = 2, BullNoseMill = 3, ConusMill = 4} ;
//----------------------------------------------------------------------------
class VolZmap : public IVolZmap, public IGeoObjRW
{
public : // IGeoObj
virtual ~VolZmap( void) ;
virtual VolZmap* Clone( void) const ;
virtual GeoObjType GetType( void) const ;
virtual bool IsValid( void) const
{ return ( m_nStatus == OK) ; }
virtual const std::string& GetTitle( void) const ;
virtual bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const ;
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
virtual bool Translate( const Vector3d& vtMove) ;
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
{ double dAngRad = dAngDeg * DEGTORAD ;
return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) ;
virtual bool Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ;
virtual bool ToGlob( const Frame3d& frRef) ;
virtual bool ToLoc( const Frame3d& frRef) ;
virtual bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest) ;
virtual void SetObjGraphics( IObjGraphics* pOGr)
{ m_OGrMgr.SetObjGraphics( pOGr) ; }
virtual IObjGraphics* GetObjGraphics( void)
{ return m_OGrMgr.GetObjGraphics() ; }
virtual const IObjGraphics* GetObjGraphics( void) const
{ return m_OGrMgr.GetObjGraphics() ; }
virtual void SetTempProp( int nProp)
{ m_nTempProp = nProp ; }
virtual int GetTempProp( void)
{ return m_nTempProp ; }
public : // IVolZmap
virtual bool CopyFrom( const IGeoObj* pGObjSrc) ;
virtual bool GetAllTriangles( TRIA3DLIST& lstTria) const ;
virtual bool GetDexelLines( int nDir, int nPos1, int nPos2, POLYLINELIST& lstPL) const ;
bool CreateMap( const Point3d& ptO, double dPrec, double dLengthX, double dLengthY, double dLengthZ) ;
bool SubtractIntervals( unsigned int nI, unsigned int nJ, double dMin, double dMax) ;
bool SubtractIntervals( const Point3d& ptP, double dMin, double dMax) ;
bool AddIntervals( unsigned int nI, unsigned int nJ, double dMin, double dMax) ;
bool AddIntervals( const Point3d& ptP, double dMin, double dMax) ;
bool SetTool( const std::string& pToolName, const CurveComposite* pToolOutline) ;
bool SetStdTool( const std::string& pToolName, unsigned int nToolType, double dH, double dTH, double dR, double dTR, double dRc = 0) ;
bool MillingStep( const Point3d& ptPs, const Point3d& ptPe, Vector3d& vtDs, Vector3d& vtDe) ;
public : // IGeoObjRW
virtual int GetNgeId( void) const ;
virtual bool Save( NgeWriter& ngeOut) const ;
virtual bool Load( NgeReader& ngeIn) ;
public :
VolZmap( void) ;
VolZmap( const VolZmap& stSrc)
{ if ( ! CopyFrom( stSrc))
LOG_ERROR( GetEGkLogger(), "VolZmap : copy constructor error") }
VolZmap& operator =( const VolZmap& stSrc)
{ if ( ! CopyFrom( stSrc))
LOG_ERROR( GetEGkLogger(), "VolZmap : copy error")
return *this ; }
private :
bool CopyFrom( const VolZmap& clSrc) ;
bool GetChunkPrisms( int nPos1, int nPos2, int nDim1, int nDim2, TRIA3DLIST& lstTria) const ;
bool CalcChunkPrisms( int nPos1, int nPos2, int nDim1, int nDim2, TRIA3DLIST& lstTria) const ;
bool CalcDexelPrisms( int nPos1, int nPos2, TRIA3DLIST& lstTria) const ;
bool AddDexelSideFace( int nPos, int nPosAdj, const Point3d& ptP, const Point3d& ptQ,
const Vector3d& vtZ, const Vector3d& vtNorm, TRIA3DLIST& lstTria) const ;
// frese: cylindrical, ball-end e bull-nose
// Versore utensile parallelo all'asse Z
bool MillingDrillZ( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
bool MillingPerpZ( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
bool MillingZ( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
inline bool GetMinMaxZ( unsigned int nI, unsigned int nJ, double dZCutBase, double dDeltaZ, double dSqDist, const Vector3d& vtToolDir) ;
inline bool GetMinMaxZGen( unsigned int nI, unsigned int nJ, double dProj, double dSqd, double dLenPath, double dZheight, double dDelta, const Vector3d& vtToolDir) ;
// Versore utensile nel piano XY
bool MillingDrillXY( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
bool MillingPerpXY( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
bool MillingXYPlaneGen( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
bool MillingXYCyl( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
bool MillingXYBall( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
bool MillingXYPlusCyl( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
bool MillingXYPlusBall( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
bool MillingXYLongVert( const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir) ;
inline bool GetMinMaxXY( unsigned int nI, unsigned int nJ, double dProj, double dZheight, double dSqD, double dPathPerp, double dPathPar, double dScProd) ;
inline bool GetMMPlaneGenCyl( unsigned int i, unsigned int j, double dZ, double dLen1, double dLen2, double dProj1, double dProj2) ;
inline bool GetMMPlaneGenBall( unsigned int i, unsigned int j, double dZ, double dLen1, double dLen2, Point3d ptIxy, Vector3d vtMove, Vector3d vtV1, Vector3d vtV2) ;
// frese: conus
// Versore utensile parallelo all'asse Z
bool ConusDrillingZ( const Point3d ptLs, const Point3d ptLe, const Vector3d vtToolDir) ;
bool ConusPerpZ( const Point3d ptLs, const Point3d ptLe, const Vector3d vtToolDir) ;
//bool ConusMillingZDr( const Point3d ptLs, const Point3d ptLe, const Vector3d vtToolDir) ;
//bool ConusMillingZDrP( const Point3d ptLs, const Point3d ptLe, const Vector3d vtToolDir) ;
//bool ConusMillingZDrPnew( const Point3d ptLs, const Point3d ptLe, const Vector3d vtToolDir) ;
//bool ConusMillingZDrPnew2( const Point3d ptLs, const Point3d ptLe, const Vector3d vtToolDir) ;
bool ConusMillingZDr( const Point3d ptLs, const Point3d ptLe, const Vector3d vtToolDir) ;
bool ConusMillingZSw( const Point3d ptLs, const Point3d ptLe, const Vector3d vtToolDir) ;
inline bool GetMinMaxZSw( const Point3d ptO, unsigned int nStartI, unsigned int nEndI, unsigned int nStartJ, unsigned int nEndJ, double dMinZ, double dMaxZ, double dMinRad, double dMaxRad, double dDir, double dDeltaZ) ;
inline bool GetMinMaxZDr( const Point3d ptO, unsigned int nStartI, unsigned int nEndI, unsigned int nStartJ, unsigned int nEndJ, double dMinZ, double dMaxZ, double dMinRad, double dMaxRad, double dDir, double dDeltaZ) ;
// utensile generico
inline bool GetMinMaxZGenTool( unsigned int nI, unsigned int nJ, double dZCutBase, double dDeltaZ, double dSqDist, const Vector3d& vtToolDir) ;
private :
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
private :
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
Status m_nStatus ; // stato
int m_nTempProp ; // proprietà temporanea
Frame3d m_LocalFrame ;//////FORSE E' MEGLIO CHIAMARLO INTRINSECO? E IN VISTA DEGLI ALTRI FORSE E' BENE AGGIUNGERE UN IDENTIFICATIVO?
double m_dStep ;
unsigned int m_nNx ; // i = 0, 1, ..., m_nNx - 1
unsigned int m_nNy ; // j = 0, 1, ..., m_nNy - 1
unsigned int m_nDim ;
double m_dMinZ ;
double m_dMaxZ ;
std::vector <std::vector<double>> m_ZValues ;
std::string m_sToolName ;
unsigned int m_nToolType ;
CurveComposite m_ToolOutline ;
double m_dHeight ;
double m_dTipHeight ;
double m_dRadius ;
double m_dRCorner ;
double m_dTipRadius ;
} ;
//-----------------------------------------------------------------------------
inline VolZmap* CreateBasicVolZmap( void)
{ return (static_cast<VolZmap*>( CreateGeoObj( VOL_ZMAP))) ; }
inline VolZmap* CloneBasicVolZmap( const IGeoObj* pGObj)
{ if ( pGObj == nullptr || pGObj->GetType() != VOL_ZMAP)
return nullptr ;
return (static_cast<VolZmap*>(pGObj->Clone())) ; }
inline const VolZmap* GetBasicVolZmap( const IGeoObj* pGObj)
{ if ( pGObj == nullptr || pGObj->GetType() != VOL_ZMAP)
return nullptr ;
return (static_cast<const VolZmap*>(pGObj)) ; }
inline VolZmap* GetBasicVolZmap( IGeoObj* pGObj)
{ if ( pGObj == nullptr || pGObj->GetType() != VOL_ZMAP)
return nullptr ;
return (static_cast<VolZmap*>(pGObj)) ; }