45#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_POINT_3DH_INL
46#define LASS_GUARDIAN_OF_INCLUSION_PRIM_POINT_3DH_INL
61template<
typename T>
inline
62Point3DH<T>::Point3DH():
68 LASS_ASSERT(isZero());
73template<
typename T>
inline
74Point3DH<T>::Point3DH(TParam iX, TParam iY, TParam iZ, TParam iW):
84template<
typename T>
inline
85Point3DH<T>::Point3DH(
const TPoint& iAffinePoint) :
95template<
typename T>
inline
96Point3DH<T>::Point3DH(
const TVector& iPositionVector) :
106template <
typename T>
inline
107const typename Point3DH<T>::TVector
108Point3DH<T>::position()
const
110 return TVector(x, y, z, w);
115template<
typename T>
inline
116typename Point3DH<T>::TConstReference
117Point3DH<T>::operator[](
size_t iIndex)
const
119 LASS_ASSERT(iIndex < dimension);
120 return *(&x + iIndex);
125template<
typename T>
inline
126typename Point3DH<T>::TReference
127Point3DH<T>::operator[](
size_t iIndex)
129 LASS_ASSERT(iIndex < dimension);
130 return *(&x + iIndex);
137template<
typename T>
inline
138typename Point3DH<T>::TConstReference
141 return *(&x + num::mod(iIndex, dimension));
149template<
typename T>
inline
150typename Point3DH<T>::TReference
153 return *(&x + num::mod(iIndex, dimension));
160template<
typename T>
inline
177Point3DH<T>& Point3DH<T>::operator+=(
const Point3DH<T>& iB)
189Point3DH<T>& Point3DH<T>::operator-=(
const Point3DH<T>& iB)
201Point3DH<T>& Point3DH<T>::operator*=(TParam iB)
213Point3DH<T>& Point3DH<T>::operator/=(TParam iB)
215 const TValue invB = TNumTraits::one / iB;
231 return x == TNumTraits::zero && y == TNumTraits::zero && z == TNumTraits::zero;
238template<
typename T>
inline
241 return num::isNaN(x) || num::isNaN(y) || num::isNaN(z) || num::isNaN(w);
248template<
typename T>
inline
251 return w == TNumTraits::zero;
261 return x != TNumTraits::zero || y != TNumTraits::zero || z != TNumTraits::zero ||
262 w != TNumTraits::zero;
269template<
typename T>
inline
270const typename Point3DH<T>::TParam
284 Point3DH<T> result(*
this);
286 return Point3D<T>(result.x, result.y, result.z);
293template<
typename T>
inline
296 const TValue invW = TNumTraits::one / w;
312 return iA.x == iB.x && iA.y == iB.y && iA.z == iB.z && iA.w == iB.w;
319template<
typename T>
inline
320bool operator!=(
const Point3DH<T>& iA,
const Point3DH<T>& iB)
329template<
typename T>
inline
330Point3DH<T> operator+(
const Point3DH<T>& iA,
const Point3DH<T>& iB)
332 Point3DH<T> result(iA);
341template<
typename T>
inline
342Point3DH<T> operator-(
const Point3DH<T>& iA,
const Point3DH<T>& iB)
344 Point3DH<T> result(iA.position());
353template<
typename T>
inline
354Point3DH<T> operator*(
const Point3DH<T>& iA,
typename Point3DH<T>::TParam iB)
356 Point3DH<T> result(iA);
365template<
typename T>
inline
366Point3DH<T> operator/(
const Point3DH<T>& iA,
typename Point3DH<T>::TParam iB)
368 Point3DH<T> result(iA);
377template<
typename T>
inline
378Point3DH<T> operator*(
typename Point3DH<T>::TParam iA,
const Point3DH<T>& iB)
380 Point3DH<T> result(iB);
390std::ostream& operator<<(std::ostream& ioOStream,
const Point3DH<T>& iB)
392 LASS_ENFORCE_STREAM(ioOStream) << iB.position();
401io::XmlOStream& operator<<(io::XmlOStream& oOStream,
const Point3DH<T>& iB)
403 LASS_ENFORCE_STREAM(oOStream)
404 <<
"<Point3DH>" << iB.x <<
" " << iB.y <<
" " << iB.z <<
" " << iB.w
414std::istream& operator>>(std::istream& ioIStream, Point3DH<T>& oB)
417 LASS_ENFORCE_STREAM(ioIStream) >> temp;
418 oB = Point3D<T>(temp);
set of geometrical primitives
Library for Assembled Shared Sources.
const Point3DH< T > & operator+() const
A weird way to get back the same object.
const TParam weight() const
Return weight of point.
bool isZero() const
Return true if point is origin (0, 0, 0, w).
TConstReference at(signed iIndex) const
Wrap index around range.
const TPoint affine() const
Return rescaled version of point with weight = 1.
bool isNaN() const
Return true if at least one of the components is NaN.
bool isInfinite() const
Return true if point is at infinite distance of origin.
bool isValid() const
Return true if point is valid.
void homogenize()
Rescale point so that weight is 1.