43#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_POINT_2DH_INL
44#define LASS_GUARDIAN_OF_INCLUSION_PRIM_POINT_2DH_INL
53template <
typename T>
inline
54Point2DH<T>::Point2DH():
59 LASS_ASSERT(isZero());
64template<
typename T>
inline
65Point2DH<T>::Point2DH(TParam iX, TParam iY, TParam iZ):
74template<
typename T>
inline
75Point2DH<T>::Point2DH(
const TPoint& iAffinePoint):
84template<
typename T>
inline
85Point2DH<T>::Point2DH(
const TVector& iPositionVector):
94template <
typename T>
inline
95const typename Point2DH<T>::TVector
96Point2DH<T>::position()
const
98 return TVector(x, y, z);
103template<
typename T>
inline
104typename Point2DH<T>::TConstReference
105Point2DH<T>::operator[](
size_t iIndex)
const
107 LASS_ASSERT(iIndex < dimension);
108 return *(&x + iIndex);
113template<
typename T>
inline
114typename Point2DH<T>::TReference
115Point2DH<T>::operator[](
size_t iIndex)
117 LASS_ASSERT(iIndex < dimension);
118 return *(&x + iIndex);
125template<
typename T>
inline
126typename Point2DH<T>::TConstReference
129 return *(&x + num::mod(iIndex, dimension));
136template<
typename T>
inline
137typename Point2DH<T>::TReference
140 return *(&x + num::mod(iIndex, dimension));
147template<
typename T>
inline
158 return Poin2DH(-x, -y, -z);
164Point2DH<T>& Point2DH<T>::operator+=(
const Point2DH<T>& iB)
175Point2DH<T>& Point2DH<T>::operator-=(
const Point2DH<T>& iB)
186Point2DH<T>& Point2DH<T>::operator*=(TParam iB)
197Point2DH<T>& Point2DH<T>::operator/=(TParam iB)
199 const TValue invB = TNumTraits::one / iB;
214 return x == TNumTraits::zero && y == TNumTraits::zero;
221template<
typename T>
inline
224 return num::isNaN(x) || num::isNaN(y) || num::isNaN(z);
234 return z == TNumTraits::zero;
244 return x != TNumTraits::zero || y != TNumTraits::zero || z != TNumTraits::zero;
251template<
typename T>
inline
262template<
typename T>
inline
265 Point2DH<T> result(*
this);
267 return Point2D<T>(result.x, result.y);
277 const TValue invZ = TNumTraits::one / z;
292 return iA.x == iB.x && iA.y == iB.y && iA.z == iB.z;
299template<
typename T>
inline
300bool operator!=(
const Point2DH<T>& iA,
const Point2DH<T>& iB)
309template<
typename T>
inline
310Point2DH<T> operator+(
const Point2DH<T>& iA,
const Point2DH<T>& iB)
312 Point2DH<T> result(iA);
321template<
typename T>
inline
322Point2DH<T> operator+(
const Point2DH<T>& iA,
const Point2D<T>& iB)
324 Point2DH<T> result(iA);
333template<
typename T>
inline
334Point2DH<T> operator+(
const Point2D<T>& iA,
const Point2DH<T>& iB)
336 Point2DH<T> result(iA);
345template<
typename T>
inline
346Point2DH<T> operator+(
const Point2D<T>& iA,
const Point2D<T>& iB)
348 Point2DH<T> result(iA);
357template<
typename T>
inline
358Point2DH<T> operator-(
const Point2DH<T>& iA,
const Point2DH<T>& iB)
360 Point2DH<T> result(iA.position());
369template<
typename T>
inline
370Point2DH<T> operator*(
const Point2DH<T>& iA,
typename Point2DH<T>::TParam iB)
372 Point2DH<T> result(iA);
381template<
typename T>
inline
382Point2DH<T> operator/(
const Point2DH<T>& iA,
typename Point2DH<T>::TParam iB)
384 Point2DH<T> result(iA);
393template<
typename T>
inline
394Point2DH<T> operator*(
typename Point2DH<T>::TParam iA,
const Point2DH<T>& iB)
396 Point2DH<T> result(iB);
406std::ostream& operator<<(std::ostream& ioOStream,
const Point2DH<T>& iB)
408 LASS_ENFORCE_STREAM(ioOStream) << iB.position();
417io::XmlOStream& operator<<(io::XmlOStream& oOStream,
const Point2DH<T>& iB)
419 LASS_ENFORCE_STREAM(oOStream)
420 <<
"<Point2DH>" << iB.x <<
" " << iB.y <<
" " << iB.z <<
"</Point2DH>\n";
429std::istream& operator>>(std::istream& ioIStream, Point2DH<T>& oB)
432 LASS_ENFORCE(ioIStream) >> temp;
433 oB = Point2DH<T>(temp);
set of geometrical primitives
Library for Assembled Shared Sources.
void homogenize()
Rescale point so that weight is 1.
bool isValid() const
Return true if point is valid.
TConstReference at(signed iIndex) const
Wrap index around range.
bool isNaN() const
Return true if at least one of the components is NaN.
bool isZero() const
Return true if point is origin (0, 0, z).
bool isInfinite() const
Return true if point is at infinite distance of origin.
const Point2D< T > affine() const
Return rescaled version of point with weight = 1.
const Point2DH< T > & operator+() const
A weird way to get back the same object.
const TValue weight() const
Return weight of point.