00001
00032 #ifndef INC_MI32_STEREOSHIFT_H
00033 #define INC_MI32_STEREOSHIFT_H
00034
00035 #ifndef INC_MI32_POINT_H
00036 #include <mi32/point.h>
00037 #endif
00038
00039 #ifndef INC_MI32_STEREOVIEW_H
00040 #include <mi32/stereoview.h>
00041 #endif
00042
00043
00044 #ifndef GENERATING_DOXYGEN_OUTPUT
00045 class POLYLINE;
00046 #endif
00047
00048
00050 class STEREOSHIFT {
00051 public:
00052
00054 STEREOSHIFT (
00055 ) : m_Scale(0), m_ZeroValue(0), m_View(STEREOVIEW_None) { }
00056
00058 void CalcPointDual (
00059 const DPOINT3D& ptBase,
00060 DPOINT2D& ptLeft,
00061 DPOINT2D& ptRight
00062 ) const;
00063
00065 void CalcPointLeft (
00066 const DPOINT3D& ptBase,
00067 DPOINT2D& ptDisplaced
00068 ) const { ptDisplaced.x = ptBase.x - CalcShift(ptBase.z); ptDisplaced.y = ptBase.y; }
00069
00071 void CalcPointRight (
00072 const DPOINT3D& ptBase,
00073 DPOINT2D& ptDisplaced
00074 ) const { ptDisplaced.x = ptBase.x + CalcShift(ptBase.z); ptDisplaced.y = ptBase.y; }
00075
00077 void CalcPolylineDual (
00078 const POLYLINE& plBase,
00079 POLYLINE& plLeft,
00080 POLYLINE& plRight
00081 ) const;
00082
00084 void CalcPolylineSingle (
00085 const POLYLINE& plBase,
00086 POLYLINE& plDisplaced
00087 ) const;
00088
00091 double CalcShift (
00092 double z
00093 ) const { return ((m_ZeroValue - z) * m_Scale); }
00094
00096 double GetScale () const
00097 { return (m_Scale); }
00098
00099 STEREOVIEW GetView () const
00100 { return (m_View); }
00101
00103 double GetZeroValue () const
00104 { return (m_ZeroValue); }
00105
00107 void Invalidate ()
00108 { m_Scale = 0; m_View = STEREOVIEW_None; }
00109
00111 bool IsValid () const
00112 { return (m_Scale != 0 && m_View != STEREOVIEW_None); }
00113
00115 void Set (
00116 STEREOVIEW View,
00117 double Scale,
00118 double ZeroValue
00119 );
00120
00121 private:
00122 #ifndef GENERATING_DOXYGEN_OUTPUT
00123 double m_Scale;
00124 double m_ZeroValue;
00125 STEREOVIEW m_View;
00126 #endif
00127 };
00128
00129 #endif // INC_MI32_STEREOSHIFT_H