Include :

- aggiornamento prototipi.
This commit is contained in:
Dario Sassi
2018-01-16 12:17:00 +00:00
parent 10e82e6303
commit 222f265c9f
5 changed files with 83 additions and 59 deletions
+14
View File
@@ -122,3 +122,17 @@ EGK_EXPORT bool GetStdColor( const std::string& sName, Color& cCol) ;
EGK_EXPORT bool GetNameOfStdColor( Color cCol, std::string& sName) ;
EGK_EXPORT Color GetOppositeColor( Color cCol) ;
EGK_EXPORT Color GetSurfBackColor( Color cCol) ;
//----------------------------------------------------------------------------
struct HSV {
double dHue ;
double dSat ;
double dVal ;
HSV( void) : dHue( 0), dSat( 0), dVal( 0) {}
HSV( double dH, double dS, double dV) : dHue( dH), dSat( dS), dVal( dV) {}
} ;
//----------------------------------------------------------------------------
EGK_EXPORT HSV GetHSVFromColor( const Color& cCol) ;
EGK_EXPORT Color GetColorFromHSV( const HSV& hsv) ;
+56 -48
View File
@@ -1,13 +1,14 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2015
// EgalTech 2014-2018
//----------------------------------------------------------------------------
// File : EGkTria3d.h Data : 07.02.15 Versione : 1.6b2
// File : EGkTria3d.h Data : 15.01.18 Versione : 1.9a1
// Contenuto : Dichiarazione classe triangolo Triangle3d.
//
//
//
// Modifiche : 30.03.14 DS Creazione modulo.
// 07.02.15 DS Agg. GetArea e GetAspectRatio.
// 15.01.18 LM Agg. flag.
//
//----------------------------------------------------------------------------
@@ -22,96 +23,102 @@
class Triangle3d
{
public :
Triangle3d( void)
Triangle3d( void) : m_nFlag( 0)
{}
void Set( const Point3d& ptP0, const Point3d& ptP1, const Point3d& ptP2)
{ ptP[0] = ptP0 ; ptP[1] = ptP1 ; ptP[2] = ptP2 ; vtN.Set( 0, 0, 0) ; }
{ m_ptP[0] = ptP0 ; m_ptP[1] = ptP1 ; m_ptP[2] = ptP2 ; m_vtN.Set( 0, 0, 0) ; }
void Set( const Point3d& ptP0, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV)
{ ptP[0] = ptP0 ; ptP[1] = ptP1 ; ptP[2] = ptP2 ; vtN = vtV ; }
{ m_ptP[0] = ptP0 ; m_ptP[1] = ptP1 ; m_ptP[2] = ptP2 ; m_vtN = vtV ; }
bool SetP( int nId, const Point3d& ptV)
{ if ( nId < 0 || nId >= 3)
return false ;
ptP[nId] = ptV ;
m_ptP[nId] = ptV ;
return true ;
}
bool SetFlag( int nFlag)
{ m_nFlag = nFlag ;
return true ;
}
bool Validate( bool bOverwrite = false)
{ if ( AreSamePointApprox( ptP[0], ptP[1]) || AreSamePointApprox( ptP[0], ptP[2]))
{ if ( AreSamePointApprox( m_ptP[0], m_ptP[1]) || AreSamePointApprox( m_ptP[0], m_ptP[2]))
return false ;
Vector3d vtV = ( ptP[1] - ptP[0]) ^ ( ptP[2] - ptP[0]) ;
Vector3d vtV = ( m_ptP[1] - m_ptP[0]) ^ ( m_ptP[2] - m_ptP[0]) ;
vtV.Normalize() ;
if ( vtN.IsZero() || bOverwrite) {
vtN = vtV ;
if ( m_vtN.IsZero() || bOverwrite) {
m_vtN = vtV ;
return true ;
}
return AreSameVectorApprox( vtV, vtN) ;
return AreSameVectorApprox( vtV, m_vtN) ;
}
bool IsValid( void) const
{ if ( AreSamePointApprox( ptP[0], ptP[1]) || AreSamePointApprox( ptP[0], ptP[2]))
{ if ( AreSamePointApprox( m_ptP[0], m_ptP[1]) || AreSamePointApprox( m_ptP[0], m_ptP[2]))
return false ;
Vector3d vtV = ( ptP[1] - ptP[0]) ^ ( ptP[2] - ptP[0]) ;
Vector3d vtV = ( m_ptP[1] - m_ptP[0]) ^ ( m_ptP[2] - m_ptP[0]) ;
vtV.Normalize() ;
return AreSameVectorApprox( vtV, vtN) ;
return AreSameVectorApprox( vtV, m_vtN) ;
}
void Translate( const Vector3d& vtMove)
{ ptP[0].Translate( vtMove) ;
ptP[1].Translate( vtMove) ;
ptP[2].Translate( vtMove) ;
{ m_ptP[0].Translate( vtMove) ;
m_ptP[1].Translate( vtMove) ;
m_ptP[2].Translate( vtMove) ;
}
bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
{ double dAngRad = dAngDeg * DEGTORAD ;
return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
{ ptP[0].Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
ptP[1].Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
ptP[2].Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
vtN.Rotate( vtAx, dCosAng, dSinAng) ;
{ m_ptP[0].Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
m_ptP[1].Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
m_ptP[2].Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
m_vtN.Rotate( vtAx, dCosAng, dSinAng) ;
}
bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
{ ptP[0].Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
ptP[1].Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
ptP[2].Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
{ m_ptP[0].Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
m_ptP[1].Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
m_ptP[2].Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
Validate( true) ;
}
bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
{ ptP[0].Mirror( ptOn, vtNorm) ;
ptP[1].Mirror( ptOn, vtNorm) ;
ptP[2].Mirror( ptOn, vtNorm) ;
{ m_ptP[0].Mirror( ptOn, vtNorm) ;
m_ptP[1].Mirror( ptOn, vtNorm) ;
m_ptP[2].Mirror( ptOn, vtNorm) ;
Validate( true) ;
}
bool Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff)
{ ptP[0].Shear( ptOn, vtNorm, vtDir, dCoeff) ;
ptP[1].Shear( ptOn, vtNorm, vtDir, dCoeff) ;
ptP[2].Shear( ptOn, vtNorm, vtDir, dCoeff) ;
{ m_ptP[0].Shear( ptOn, vtNorm, vtDir, dCoeff) ;
m_ptP[1].Shear( ptOn, vtNorm, vtDir, dCoeff) ;
m_ptP[2].Shear( ptOn, vtNorm, vtDir, dCoeff) ;
Validate( true) ;
}
bool ToGlob( const Frame3d& frRef)
{ return ( ptP[0].ToGlob( frRef) && ptP[1].ToGlob( frRef) && ptP[2].ToGlob( frRef) && vtN.ToGlob( frRef)) ; }
{ return ( m_ptP[0].ToGlob( frRef) && m_ptP[1].ToGlob( frRef) && m_ptP[2].ToGlob( frRef) && m_vtN.ToGlob( frRef)) ; }
bool ToLoc( const Frame3d& frRef)
{ return ( ptP[0].ToLoc( frRef) && ptP[1].ToLoc( frRef) && ptP[2].ToLoc( frRef) && vtN.ToLoc( frRef)) ; }
{ return ( m_ptP[0].ToLoc( frRef) && m_ptP[1].ToLoc( frRef) && m_ptP[2].ToLoc( frRef) && m_vtN.ToLoc( frRef)) ; }
bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
{ return ( ptP[0].LocToLoc( frOri, frDest) &&
ptP[1].LocToLoc( frOri, frDest) &&
ptP[2].LocToLoc( frOri, frDest) &&
vtN.LocToLoc( frOri, frDest)) ; }
{ return ( m_ptP[0].LocToLoc( frOri, frDest) &&
m_ptP[1].LocToLoc( frOri, frDest) &&
m_ptP[2].LocToLoc( frOri, frDest) &&
m_vtN.LocToLoc( frOri, frDest)) ; }
const Point3d& GetP( int nId) const
{ if ( nId >= 0 && nId < 3)
return ptP[nId] ;
return m_ptP[nId] ;
else if ( nId < 0)
return ptP[0] ;
return m_ptP[0] ;
else
return ptP[2] ;
return m_ptP[2] ;
}
int GetFlag( void) const
{ return m_nFlag ; }
const Vector3d& GetN( void) const
{ return vtN ; }
{ return m_vtN ; }
Point3d GetCentroid( void) const
{ return ( ptP[0] + ptP[1] + ptP[2]) / 3 ; }
{ return ( m_ptP[0] + m_ptP[1] + m_ptP[2]) / 3 ; }
double GetArea( void) const
{ return (( ptP[1] - ptP[0]) ^ ( ptP[2] - ptP[0])).Len() / 2 ; }
{ return (( m_ptP[1] - m_ptP[0]) ^ ( m_ptP[2] - m_ptP[0])).Len() / 2 ; }
double GetAspectRatio( void) const
{ double dSqDistA = SqDist( ptP[0], ptP[1]) ;
double dSqDistB = SqDist( ptP[1], ptP[2]) ;
double dSqDistC = SqDist( ptP[2], ptP[0]) ;
double dTwoArea = (( ptP[1] - ptP[0]) ^ ( ptP[2] - ptP[0])).Len() ;
{ double dSqDistA = SqDist( m_ptP[0], m_ptP[1]) ;
double dSqDistB = SqDist( m_ptP[1], m_ptP[2]) ;
double dSqDistC = SqDist( m_ptP[2], m_ptP[0]) ;
double dTwoArea = (( m_ptP[1] - m_ptP[0]) ^ ( m_ptP[2] - m_ptP[0])).Len() ;
if ( dTwoArea < SQ_EPS_SMALL)
return INFINITO ;
else
@@ -119,8 +126,9 @@ class Triangle3d
}
private :
Point3d ptP[3] ;
Vector3d vtN ;
Point3d m_ptP[3] ;
Vector3d m_vtN ;
int m_nFlag ;
} ;
//----------------------------------------------------------------------------
+7 -6
View File
@@ -38,14 +38,15 @@ class __declspec( novtable) IVolZmap : public IGeoObj
virtual bool GetTriangles( bool bAllBlocks, INTVECTOR& nModifiedBlocks, TRIA3DLISTVECTOR& vLstTria) const ;
virtual bool GetDexelLines( int nDir, int nPos1, int nPos2, POLYLINELIST& lstPL) const = 0 ;
virtual bool SetTolerances( double dLinTol, double dAngTolDeg = 90) = 0 ;
virtual bool SetStdTool( const std::string& sToolName, double dH, double dR, double dCornR) = 0 ;
virtual bool SetStdTool( const std::string& sToolName, double dH, double dR, double dCornR, int nFlag) = 0 ;
virtual bool SetAdvTool( const std::string& sToolName,
double dH, double dR, double dTipH, double dTipR, double dCornR) = 0 ;
virtual bool SetMortiserTool( const std::string& sToolName, double dH, double dW, double dTh, double dRc) = 0 ;
virtual bool SetChiselTool( const std::string& sToolName, double dH, double dW, double dTh) = 0 ;
virtual bool SetGenTool( const std::string& sToolName, const ICurveComposite* pToolOutline) = 0 ;
double dH, double dR, double dTipH, double dTipR, double dCornR, int nFlag) = 0 ;
virtual bool SetGenTool( const std::string& sToolName, const ICurveComposite* pToolOutline, int nFlag) = 0 ;
virtual bool SetMortiserTool( const std::string& sToolName, double dH, double dW, double dTh, double dRc, int nFlag) = 0 ;
virtual bool SetChiselTool( const std::string& sToolName, double dH, double dW, double dTh, int nFlag) = 0 ;
virtual bool MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Point3d& ptPe, const Vector3d& vtDe) = 0 ;
virtual bool MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d& vtAs, const Point3d& ptPe, const Vector3d& vtDe, const Vector3d& vtAe) = 0 ;
virtual bool MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d& vtAs,
const Point3d& ptPe, const Vector3d& vtDe, const Vector3d& vtAe) = 0 ;
virtual bool GetDepth( const Point3d& ptP, const Vector3d& vtDir, double& dInLength, double& dOutLength, bool bExact) const = 0 ;
virtual bool GetPlaneIntersection( const Plane3d& plPlane, POCRVVECTOR& vpLoop) const = 0 ;
virtual bool AvoidBox( const Frame3d& frBox, const Vector3d& vtDiag) const = 0 ;
+2 -1
View File
@@ -182,4 +182,5 @@ enum TxrRepeat { TXR_CLAMP = 0,
//------------------------ Costanti per tipo visualizz. Zmap -----------------
enum ZmapShowMode { ZSM_SURF = 1,
ZSM_LINES = 2,
ZSM_NORMALS = 4} ;
ZSM_NORMALS = 4,
ZSM_COLORS = 8} ;
+4 -4
View File
@@ -478,13 +478,13 @@ EXE_EXPORT bool ExeCutSurfTm( int nId, const Point3d& ptOn, const Vector3d& vtN,
EXE_EXPORT int ExeExplodeVolume( int nId, int* pnCount) ;
EXE_EXPORT int ExeCopyVolZmapPart( int nId, int nPart, int nDestGrpId) ;
EXE_EXPORT bool ExeRemoveVolZmapPart( int nId, int nPart) ;
EXE_EXPORT bool ExeVolZmapSetStdTool( int nId, const std::string& sToolName, double dLen, double dDiam, double dCornR) ;
EXE_EXPORT bool ExeVolZmapSetStdTool( int nId, const std::string& sToolName, double dLen, double dDiam, double dCornR, int nFlag) ;
EXE_EXPORT bool ExeVolZmapSetAdvTool( int nId, const std::string& sToolName,
double dLen, double dDiam, double dTipLen, double dTipDiam, double dCornR) ;
double dLen, double dDiam, double dTipLen, double dTipDiam, double dCornR, int nFlag) ;
EXE_EXPORT bool ExeVolZmapSetMortiserTool( int nId, const std::string& sToolName,
double dLen, double dWidth, double dThick, double dCornR) ;
double dLen, double dWidth, double dThick, double dCornR, int nFlag) ;
EXE_EXPORT bool ExeVolZmapSetChiselTool( int nId, const std::string& sToolName,
double dLen, double dWidth, double dThick) ;
double dLen, double dWidth, double dThick, int nFlag) ;
EXE_EXPORT bool ExeVolZmapMillingStep( int nId, const Point3d& ptPs, const Vector3d& vtDs,
const Point3d& ptPe, const Vector3d& vtD, int nRefTypee) ;
EXE_EXPORT bool ExeVolZmapMillingStep( int nId, const Point3d& ptPs, const Vector3d& vtDs, const Vector3d& vtAs,