diff --git a/EGkColor.h b/EGkColor.h index f780159..8c3b563 100644 --- a/EGkColor.h +++ b/EGkColor.h @@ -15,12 +15,18 @@ #include +//----------------------------------------------------------------------------- +static const int MAX_RGB = 255 ; +static const int MAX_ALPHA = 100 ; +static const float INV_MAX_RGB = 1 / float( MAX_RGB) ; +static const float INV_MAX_ALPHA = 1 / float( MAX_ALPHA) ; + //----------------------------------------------------------------------------- class Color { public : Color( void) - { m_Col[RED] = 0 ; m_Col[GREEN] = 0 ; m_Col[BLUE] = 0 ; m_Col[ALPHA] = 0 ; } + { m_Col[RED] = 0 ; m_Col[GREEN] = 0 ; m_Col[BLUE] = 0 ; m_Col[ALPHA] = MAX_ALPHA ; } Color( int nRed, int nGreen, int nBlue, int nAlpha = MAX_ALPHA) { Set( nRed, nGreen, nBlue, nAlpha) ; } Color( double dRed, double dGreen, double dBlue, double dAlpha = 1) @@ -44,13 +50,13 @@ class Color int GetIntAlpha( void) const { return m_Col[ALPHA] ; } float GetRed( void) const - { return ( (float) m_Col[RED] / MAX_RGB) ; } + { return ( m_Col[RED] * INV_MAX_RGB) ; } float GetGreen( void) const - { return ( (float) m_Col[GREEN] / MAX_RGB) ; } + { return ( m_Col[GREEN] * INV_MAX_RGB) ; } float GetBlue( void) const - { return ( (float) m_Col[BLUE] / MAX_RGB) ; } + { return ( m_Col[BLUE] * INV_MAX_RGB) ; } float GetAlpha( void) const - { return ( (float) m_Col[ALPHA] / MAX_ALPHA) ; } + { return ( m_Col[ALPHA] * INV_MAX_ALPHA) ; } bool operator == ( const Color& other) { return ( m_Col[RED] == other.m_Col[RED] && m_Col[GREEN] == other.m_Col[GREEN] && @@ -59,9 +65,30 @@ class Color private : enum { RED = 0, GREEN = 1, BLUE = 2, ALPHA = 3, DIM = 4} ; - static const int MAX_RGB = 255 ; - static const int MAX_ALPHA = 100 ; private : unsigned char m_Col[DIM] ; } ; + +//---------------------------------------------------------------------------- +// Colori predefiniti +//---------------------------------------------------------------------------- +const Color BLACK( 0, 0, 0) ; +const Color GRAY( 128, 128, 128) ; +const Color LGRAY( 192, 192, 192) ; +const Color WHITE( 255, 255, 255) ; +const Color RED( 255, 0, 0) ; +const Color GREEN( 0, 255, 0) ; +const Color BLUE( 0, 0, 255) ; +const Color CYAN( 0, 255, 255) ; +const Color MAGENTA( 255, 0, 255) ; +const Color YELLOW( 255, 255, 0) ; +const Color BROWN( 128, 64, 0) ; +const Color PURPLE( 128, 0, 128) ; +const Color ORANGE( 255, 128, 0) ; +const Color LRED( 255, 128, 128) ; +const Color LGREEN( 128, 255, 128) ; +const Color LBLUE( 128, 128, 255) ; +const Color LCYAN( 128, 255, 255) ; +const Color LMAGENTA( 255, 128, 255) ; + diff --git a/EGkFrame3d.h b/EGkFrame3d.h index ea5196d..7d3d8c0 100644 --- a/EGkFrame3d.h +++ b/EGkFrame3d.h @@ -36,6 +36,7 @@ class EGK_EXPORT Frame3d bool Set( const Point3d& ptOrig, const Vector3d& vtDirX, const Vector3d& vtDirY, const Vector3d& vtDirZ) ; bool Set( const Point3d& ptOrig, const Point3d& ptOnX, const Point3d& ptNearY) ; + bool Set( const Point3d& ptOrig, const Vector3d& vtDirZ) ; bool Set( const Point3d& ptOrig, Type nType) ; bool Reset( void) ; void Translate( const Vector3d& vtMove) ; @@ -65,6 +66,7 @@ class EGK_EXPORT Frame3d bool GetRotationsCAC1( double& dAngC, double& dAngA, double& dAngC1) const ; private : + bool Verify( void) ; void CalculateType( void) ; private : diff --git a/EGkGeoFrame3d.h b/EGkGeoFrame3d.h index 08ee883..798a816 100644 --- a/EGkGeoFrame3d.h +++ b/EGkGeoFrame3d.h @@ -15,6 +15,8 @@ #include "/EgtDev/Include/EGkGeoObj.h" +class PolyLine ; + //----------------------------------------------------------------------------- class __declspec( novtable) IGeoFrame3d : public IGeoObj { @@ -23,6 +25,8 @@ class __declspec( novtable) IGeoFrame3d : public IGeoObj const Vector3d& vtDirY, const Vector3d& vtDirZ) = 0 ; virtual bool Set( const Frame3d& frF) = 0 ; virtual const Frame3d& GetFrame( void) const = 0 ; + virtual bool GetDrawWithArrowHeads( double dLenA, double dFrazLenAH, + PolyLine& plX, PolyLine& plY, PolyLine& plZ) const = 0 ; } ; //----------------------------------------------------------------------------- diff --git a/EGkGeoVector3d.h b/EGkGeoVector3d.h index 05f8232..c392183 100644 --- a/EGkGeoVector3d.h +++ b/EGkGeoVector3d.h @@ -15,12 +15,15 @@ #include "/EgtDev/Include/EGkGeoObj.h" +class PolyLine ; + //----------------------------------------------------------------------------- class __declspec( novtable) IGeoVector3d : public IGeoObj { public : virtual bool Set( const Vector3d& vtV) = 0 ; virtual const Vector3d& GetVector( void) const = 0 ; + virtual bool GetDrawWithArrowHead( double dFrazLenAH, PolyLine& PL) const = 0 ; } ; //-----------------------------------------------------------------------------