Include :

- modifiche a Vector3d e Point3d
- migliorie a FromString
- aggiunta struttura Plane3d
- migliorie varie.
This commit is contained in:
Dario Sassi
2014-04-09 13:02:22 +00:00
parent 3fbf6de599
commit fcd7fab8a8
9 changed files with 98 additions and 27 deletions
+24
View File
@@ -0,0 +1,24 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : EGkPlane3d.h Data : 08.04.14 Versione : 1.5d2
// Contenuto : Dichiarazione classe piano Plane3d.
//
//
//
// Modifiche : 08.04.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EGkPoint3d.h"
//-----------------------------------------------------------------------------
class Plane3d
{
public :
Vector3d vtN ;
double dDist ;
} ;
+8 -3
View File
@@ -66,9 +66,14 @@ class EGK_EXPORT Point3d
{ return ( ToGlob( frOri) && ToLoc( frDest)) ; }
public :
double x ;
double y ;
double z ;
union {
struct {
double x ;
double y ;
double z ;
} ;
double v[3] ;
} ;
} ;
//----------------------------------------------------------------------------
+16 -2
View File
@@ -16,6 +16,8 @@
#include "/EgtDev/Include/EGkPoint3d.h"
#include "/EgtDev/Include/EGkGeoCollection.h"
class Plane3d ;
//----------------------- Macro per import/export ----------------------------
#undef EGK_EXPORT
#if defined( I_AM_EGK) // da definirsi solo nella DLL
@@ -30,10 +32,13 @@ class PolyLine
public :
EGK_EXPORT PolyLine( void) ;
EGK_EXPORT ~PolyLine( void) ;
EGK_EXPORT bool Clear( void) ;
EGK_EXPORT bool AddUPoint( double dPar, const Point3d& ptP) ;
EGK_EXPORT bool EraseFirstUPoint( void) ;
EGK_EXPORT bool EraseLastUPoint( void) ;
EGK_EXPORT bool AddOffsetToU( double dOffset) ;
EGK_EXPORT bool Splice( PolyLine& PL) ;
EGK_EXPORT bool IsClosed( void) const ;
EGK_EXPORT int GetPointNbr( void) const
{ return m_nCount ; }
EGK_EXPORT bool GetFirstUPoint( double* pdPar, Point3d* pptP) const ;
@@ -47,10 +52,15 @@ class PolyLine
EGK_EXPORT bool GetNextPoint( Point3d& ptP) const
{ return GetNextUPoint( nullptr, &ptP) ; }
EGK_EXPORT bool GetLastUPoint( double* pdPar, Point3d* pptP) const ;
EGK_EXPORT bool GetLastU( double& dPar)
EGK_EXPORT bool GetPrevUPoint( double* pdPar, Point3d* pptP) const ;
EGK_EXPORT bool GetLastU( double& dPar) const
{ return GetLastUPoint( &dPar, nullptr) ; }
EGK_EXPORT bool GetLastPoint( Point3d& ptP)
EGK_EXPORT bool GetPrevU( double& dPar) const
{ return GetPrevUPoint( &dPar, nullptr) ; }
EGK_EXPORT bool GetLastPoint( Point3d& ptP) const
{ return GetLastUPoint( nullptr, &ptP) ; }
EGK_EXPORT bool GetPrevPoint( Point3d& ptP) const
{ return GetPrevUPoint( nullptr, &ptP) ; }
EGK_EXPORT int GetLineNbr( void) const
{ return ( m_nCount > 1 ? ( m_nCount - 1) : 0) ; }
EGK_EXPORT bool GetFirstULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin) const ;
@@ -59,6 +69,10 @@ class PolyLine
{ return GetFirstULine( nullptr, &ptIni, nullptr, &ptFin) ; }
EGK_EXPORT bool GetNextLine( Point3d& ptIni, Point3d& ptFin) const
{ return GetNextULine( nullptr, &ptIni, nullptr, &ptFin) ; }
EGK_EXPORT bool IsPlanar( Plane3d& plPlane, double dToler = EPS_SMALL) const ;
private :
bool NewellPlane( Plane3d& plPlane) const ;
private :
int m_nCount ;
+4 -2
View File
@@ -26,8 +26,10 @@
#endif
//----------------------------------------------------------------------------
EGK_EXPORT bool FromString( const std::string& sVal, Vector3d& vtVal) ;
EGK_EXPORT bool FromString( const std::string& sVal, Point3d& ptVal) ;
inline bool FromString( const std::string& sVal, Vector3d& vtVal)
{ return FromString( sVal, vtVal.v) ; }
inline bool FromString( const std::string& sVal, Point3d& ptVal)
{ return FromString( sVal, ptVal.v) ; }
EGK_EXPORT bool FromString( const std::string& sVal, Point3d& ptVal, double& dW) ;
EGK_EXPORT bool FromString( const std::string& sVal, Frame3d& frFrame) ;
EGK_EXPORT bool FromString( const std::string& sVal, Color& cCol) ;
+6
View File
@@ -51,3 +51,9 @@ class Triangle3d
Vector3d vtN ;
} ;
//-----------------------------------------------------------------------------
class TriNormals3d
{
public :
Vector3d vtN[3] ;
} ;
+8 -3
View File
@@ -85,9 +85,14 @@ class EGK_EXPORT Vector3d
bool GetRotation( const Vector3d& vtEnd, const Vector3d& vtAx, double& dAngDeg, bool& bDet) const ;
public :
double x ;
double y ;
double z ;
union {
struct {
double x ;
double y ;
double z ;
} ;
double v[3] ;
} ;
} ;
//----------------------------------------------------------------------------
+25 -16
View File
@@ -63,10 +63,9 @@ ToLower( std::string& sString)
//----------------------------------------------------------------------------
inline bool
FromString( const std::string& sVal, int& nVal)
{ const char* pStart ;
{ const char* pStart = sVal.c_str() ;
char* pStop ;
errno = 0 ;
pStart = sVal.c_str() ;
nVal = strtol( pStart, &pStop, 10) ;
return ( pStop != pStart && *pStop == '\0' && errno == 0) ; }
inline bool
@@ -78,26 +77,36 @@ FromString( const std::string& sVal, bool& bVal)
return true ; }
inline bool
FromString( const std::string& sVal, double& dVal)
{ const char* pStart ;
{ const char* pStart = sVal.c_str() ;
char* pStop ;
errno = 0 ;
pStart = sVal.c_str() ;
dVal = strtod( pStart, &pStop) ;
return ( pStop != pStart && *pStop == '\0' && errno == 0) ; }
template <size_t size>
bool FromString( const std::string& sVal, int (&nVal)[size])
{ // divido la stringa in parametri
STRVECTOR vsParams ;
Tokenize( sVal, ",", vsParams) ;
// devono essere size parametri
if ( vsParams.size() != size)
return false ;
// recupero il punto
for ( int i = 0 ; i < size ; ++ i) {
if ( ! FromString( vsParams[i], nVal[i]))
return false ;
}
return true ;
{ const char* pStart = sVal.c_str() ;
char* pStop ;
errno = 0 ;
for ( int i = 0 ; i < size ; ++ i) {
nVal[i] = strtol( pStart, &pStop, 10) ;
if ( ( i < size - 1 && *pStop != ',') || errno != 0)
return false ;
pStart = pStop + 1 ;
}
return ( *pStop == '\0' && errno == 0) ;
}
template <size_t size>
bool FromString( const std::string& sVal, double (&dVal)[size])
{ const char* pStart = sVal.c_str() ;
char* pStop ;
errno = 0 ;
for ( int i = 0 ; i < size ; ++ i) {
dVal[i] = strtod( pStart, &pStop) ;
if ( ( i < size - 1 && *pStop != ',') || errno != 0)
return false ;
pStart = pStop + 1 ;
}
return ( *pStop == '\0' && errno == 0) ;
}
EGN_EXPORT const std::string ToString( int nVal, int nPrec = 1) ;
inline const std::string
+2 -1
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : EgkSurf.h Data : 26.03.14 Versione : 1.5c9
// File : EgkSurf.h Data : 07.04.14 Versione : 1.5d2
// Contenuto : Dichiarazione della interfaccia ISurf.
//
//
@@ -21,6 +21,7 @@ class __declspec( novtable) ISurf : public IGeoObj
public :
virtual bool IsSimple( void) const = 0 ;
virtual bool IsClosed( void) const = 0 ;
virtual bool Invert( void) = 0 ;
} ;
//----------------------------------------------------------------------------
+5
View File
@@ -16,6 +16,8 @@
#include "/EgtDev/Include/EGkSurf.h"
#include "/EgtDev/Include/EGkTriangle3d.h"
class PolyLine ;
//----------------------------------------------------------------------------
class __declspec( novtable) ISurfTriMesh : public ISurf
{
@@ -25,12 +27,15 @@ class __declspec( novtable) ISurfTriMesh : public ISurf
virtual int AddVertex( const Point3d& ptVert) = 0 ;
virtual int AddTriangle( const int nIdVert[3]) = 0 ;
virtual bool AdjustTopology( void) = 0 ;
virtual bool CreateByTriangulation( const PolyLine& PL) = 0 ;
virtual bool CreateByExtrusion( const PolyLine& PL, const Vector3d& vtExtr) = 0 ;
virtual int GetVertexNum( void) const = 0 ;
virtual int GetTriangleNum( void) const = 0 ;
virtual int GetFirstVertex( Point3d& ptP) const = 0 ;
virtual int GetNextVertex( int nId, Point3d& ptP) const = 0 ;
virtual int GetFirstTriangle( Triangle3d& Tria) const = 0 ;
virtual int GetNextTriangle( int nId, Triangle3d& Tria) const = 0 ;
virtual bool GetTriangleSmoothNormals( int nId, TriNormals3d& TNrms) const = 0 ;
} ;
//-----------------------------------------------------------------------------