ab8ec30e29
- sistemato minuscole/maiuscole.
126 lines
4.7 KiB
C++
126 lines
4.7 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2013-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : EGkStringUtils3d.h Data : 10.03.14 Versione : 1.5c3
|
|
// Contenuto : Dichiarazione delle funzioni di utilità 3d per le stringhe.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 31.01.14 DS Creazione modulo.
|
|
// 10.03.14 DS Aggiunte lettura/scrittura Frame3d.
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "/EgtDev/Include/EGnStringUtils.h"
|
|
#include "/EgtDev/Include/EGkBBox3d.h"
|
|
#include "/EgtDev/Include/EGkFrame3d.h"
|
|
#include "/EgtDev/Include/EGkColor.h"
|
|
|
|
//----------------------- Macro per import/export -----------------------------
|
|
#undef EGK_EXPORT
|
|
#if defined( I_AM_EGK) // da definirsi solo nella DLL
|
|
#define EGK_EXPORT __declspec( dllexport)
|
|
#else
|
|
#define EGK_EXPORT __declspec( dllimport)
|
|
#endif
|
|
|
|
//----------------------------------------------------------------------------
|
|
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, BBox3d& b3Box) ;
|
|
EGK_EXPORT bool FromString( const std::string& sVal, Frame3d& frFrame) ;
|
|
EGK_EXPORT bool FromString( const std::string& sVal, Color& cCol) ;
|
|
inline const std::string
|
|
ToString( const Vector3d& vtVal, int nPrec = 9)
|
|
{ std::string sBuff ;
|
|
sBuff.reserve( 64) ;
|
|
sBuff += ToString( vtVal.x, nPrec) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( vtVal.y, nPrec) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( vtVal.z, nPrec) ;
|
|
return sBuff ; }
|
|
inline const std::string
|
|
ToString( const Point3d& ptVal, int nPrec = 6)
|
|
{ std::string sBuff ;
|
|
sBuff.reserve( 64) ;
|
|
sBuff += ToString( ptVal.x, nPrec) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( ptVal.y, nPrec) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( ptVal.z, nPrec) ;
|
|
return sBuff ; }
|
|
inline const std::string
|
|
ToString( const Point3d& ptVal, double dW, int nPrecP = 6, int nPrecW = 9)
|
|
{ std::string sBuff ;
|
|
sBuff.reserve( 64) ;
|
|
sBuff += ToString( ptVal.x, nPrecP) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( ptVal.y, nPrecP) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( ptVal.z, nPrecP) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( dW, nPrecW) ;
|
|
return sBuff ; }
|
|
inline const std::string
|
|
ToString( const BBox3d& b3B, int nPrecP = 6)
|
|
{ std::string sBuff ;
|
|
sBuff.reserve( 128) ;
|
|
sBuff += ToString( b3B.GetMin().x, nPrecP) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( b3B.GetMin().y, nPrecP) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( b3B.GetMin().z, nPrecP) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( b3B.GetMax().x, nPrecP) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( b3B.GetMax().y, nPrecP) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( b3B.GetMax().z, nPrecP) ;
|
|
return sBuff ; }
|
|
inline const std::string
|
|
ToString( const Frame3d& frF, int nPrecP = 6, int nPrecV = 9)
|
|
{ std::string sBuff ;
|
|
sBuff.reserve( 256) ;
|
|
sBuff += ToString( frF.Orig().x, nPrecP) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( frF.Orig().y, nPrecP) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( frF.Orig().z, nPrecP) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( frF.VersX().x, nPrecV) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( frF.VersX().y, nPrecV) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( frF.VersX().z, nPrecV) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( frF.VersY().x, nPrecV) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( frF.VersY().y, nPrecV) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( frF.VersY().z, nPrecV) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( frF.VersZ().x, nPrecV) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( frF.VersZ().y, nPrecV) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( frF.VersZ().z, nPrecV) ;
|
|
return sBuff ; }
|
|
inline const std::string
|
|
ToString( Color cCol)
|
|
{ std::string sBuff ;
|
|
sBuff.reserve( 32) ;
|
|
sBuff += ToString( cCol.GetIntRed()) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( cCol.GetIntGreen()) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( cCol.GetIntBlue()) ;
|
|
sBuff += ',' ;
|
|
sBuff += ToString( cCol.GetIntAlpha()) ;
|
|
return sBuff ; }
|