point_2dh.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_POINT_2DH_H
00050 #define LASS_GUARDIAN_OF_INCLUSION_PRIM_POINT_2DH_H
00051
00052 #include "prim_common.h"
00053 #include "point_2d.h"
00054 #include "vector_3d.h"
00055
00056 namespace lass
00057 {
00058 namespace prim
00059 {
00060
00061 template<typename T>
00062 struct Point2DH
00063 {
00064 public:
00065
00066 typedef Point2DH<T> TSelf;
00067
00068 typedef Point2D<T> TPoint;
00069 typedef Vector3D<T> TVector;
00070
00071 typedef typename TVector::TValue TValue;
00072 typedef typename TVector::TParam TParam;
00073 typedef typename TVector::TReference TReference;
00074 typedef typename TVector::TConstReference TConstReference;
00075 typedef typename TVector::TNumTraits TNumTraits;
00076
00077 enum { dimension = TPoint::dimension };
00078
00079 template <typename U> struct Rebind
00080 {
00081 typedef Point2DH<U> Type;
00082 };
00083
00084 TValue x;
00085 TValue y;
00086 TValue z;
00087
00088 Point2DH();
00089 Point2DH(TParam iX, TParam iY, TParam iZ = TNumTraits::one);
00090 Point2DH(const TPoint& iAffinePoint);
00091 explicit Point2DH(const TVector& iPositionVector);
00092
00093 const TVector position() const;
00094 TConstReference operator[](size_t iIndex) const;
00095 TReference operator[](size_t iIndex);
00096 TConstReference at(signed iIndex) const;
00097 TReference at(signed iIndex);
00098
00099 const Point2DH<T>& operator+() const;
00100 const Point2DH<T> operator-() const;
00101
00102 Point2DH<T>& operator+=(const Point2DH<T>& iB);
00103 Point2DH<T>& operator-=(const Point2DH<T>& iB);
00104 Point2DH<T>& operator*=(TParam iB);
00105 Point2DH<T>& operator/=(TParam iB);
00106
00107 const bool isZero() const;
00108 const bool isInfinite() const;
00109 const bool isNaN() const;
00110 const bool isValid() const;
00111 const TValue weight() const;
00112 const Point2D<T> affine() const;
00113
00114 void homogenize();
00115 };
00116
00117 template<typename T> bool operator==(const Point2DH<T>& iA, const Point2DH<T>& iB);
00118 template<typename T> bool operator!=(const Point2DH<T>& iA, const Point2DH<T>& iB);
00119
00120 template<typename T> Point2DH<T> operator+(const Point2DH<T>& iA, const Point2DH<T>& iB);
00121 template<typename T> Point2DH<T> operator+(const Point2DH<T>& iA, const Point2D<T>& iB);
00122 template<typename T> Point2DH<T> operator+(const Point2D<T>& iA, const Point2DH<T>& iB);
00123 template<typename T> Point2DH<T> operator+(const Point2D<T>& iA, const Point2D<T>& iB);
00124
00125 template<typename T> Point2DH<T> operator-(const Point2DH<T>& iA, const Point2DH<T>& iB);
00126 template<typename T> Point2DH<T> operator*(const Point2DH<T>& iA, typename Point2DH<T>::TParam iB);
00127 template<typename T> Point2DH<T> operator/(const Point2DH<T>& iA, typename Point2DH<T>::TParam iB);
00128 template<typename T> Point2DH<T> operator*(typename Point2DH<T>::TParam iA, const Point2DH<T>& iB);
00129
00130 template<typename T> std::ostream& operator<<(std::ostream& oOStream, const Point2DH<T>& iB);
00131 template<typename T> io::XmlOStream& operator<<(io::XmlOStream& oOStream, const Point2DH<T>& iB);
00132 template<typename T> std::istream& operator>>(std::istream& ioIStream, Point2DH<T>& oB);
00133
00134
00135
00136 }
00137
00138 }
00139
00140 #include "point_2dh.inl"
00141
00142 #endif
00143
00144