8 #include "point_3d.hpp" 15 #pragma pack ( push, 4 ) 20 template<
class T,
class ENABLE =
void>
84 :
Point3DH(point3d.X(), point3d.Y(), point3d.Z())
93 template<std::
size_t N>
96 static_assert(N == 4,
"CVB: Point3DH must have 4 elements");
97 std::copy(std::begin(list), std::end(list), &x_);
206 return (x_ == other.x_ && y_ == other.y_ && z_ == other.z_ && w_ == other.w_);
218 return !(*
this == other);
226 return Point3DH<C>(static_cast<C>(
X()), static_cast<C>(
Y()), static_cast<C>(
Z()), static_cast<C>(
W()));
298 assert(index < 4 && index >= 0);
299 return *(&x_ + index);
310 assert(index < 4 && index >= 0);
311 return *(&x_ + index);
316 T x_ = static_cast<T>(0.0);
317 T y_ = static_cast<T>(0.0);
318 T z_ = static_cast<T>(0.0);
319 T w_ = static_cast<T>(1.0);
336 return Point3DH<T>(lhs.
X() + rhs.
X(), lhs.
Y() + rhs.
Y(), lhs.
Z() + rhs.
Z(), lhs.
W() + rhs.
W());
351 return Point3DH<T>(lhs.
X() - rhs.
X(), lhs.
Y() - rhs.
Y(), lhs.
Z() - rhs.
Z(), lhs.
W() - rhs.
W());
366 return lhs.
X() * rhs.
X() + lhs.
Y() * rhs.
Y() + lhs.
Z() * rhs.
Z() + lhs.
W() * rhs.
W();
381 return Point3DH<T>(lhs.
X() * rhs, lhs.
Y() * rhs, lhs.
Z() * rhs, lhs.
W() * rhs);
411 return Point3DH<T>(lhs.
X() / rhs, lhs.
Y() / rhs, lhs.
Z() / rhs, lhs.
W() / rhs);
const T & operator[](int index) const noexcept
Index based element access.
Definition: point_3d_h.hpp:296
bool operator!=(const Point3DH< T > &other) const noexcept
Compares to an other point.
Definition: point_3d_h.hpp:216
Point3DH(const T(&list)[N]) noexcept
Construct a point with an initializer list.
Definition: point_3d_h.hpp:94
Point3DH() noexcept=default
Creates a default point at (0, 0).
Point3DH< T > & operator/=(const T &value) noexcept
Divide by a scalar and assigns to this point.
Definition: point_3d_h.hpp:280
T & operator[](int index) noexcept
Index based element access.
Definition: point_3d_h.hpp:308
Point3DH< T > & operator *=(const T &value) noexcept
Multiplies by a scalar and assigns to this point.
Definition: point_3d_h.hpp:265
bool operator==(const Point3DH< T > &other) const noexcept
Compares to an other point.
Definition: point_3d_h.hpp:204
T W() const noexcept
Gets the w-component of the point.
Definition: point_3d_h.hpp:167
AffineMatrix2D operator/(const AffineMatrix2D &lhs, const double &rhs)
Divide affine matrix by scalar.
Definition: affine_matrix_2d.hpp:301
Root namespace for the Image Manager interface.
Definition: version.hpp:11
void Normalize() noexcept
Normalize the x-, y-, and z- with the w-component.
Definition: point_3d_h.hpp:189
Point3DH< T > & operator -=(const Point3DH< T > &point) noexcept
Subtracts and assigns to this point.
Definition: point_3d_h.hpp:250
void SetY(T y)
Sets the y-component of the point.
Definition: point_3d_h.hpp:137
T X() const noexcept
Gets the x-component of the point.
Definition: point_3d_h.hpp:107
void SetX(T x) noexcept
Sets the x-component of the point.
Definition: point_3d_h.hpp:117
Multi-purpose 3D vector class.
Definition: point_3d.hpp:21
Point3DH(Point3D< T > point3d) noexcept
Create a homogeneous point from a point.
Definition: point_3d_h.hpp:83
AffineMatrix2D operator *(const AffineMatrix2D &lhs, const AffineMatrix2D &rhs) noexcept
Multiply two affine matrices.
Definition: affine_matrix_2d.hpp:245
Point3DH< T > operator+(const Point3DH< T > &lhs, const Point3DH< T > &rhs)
Add two points.
Definition: point_3d_h.hpp:334
void SetW(T w)
Sets the w-component of the point.
Definition: point_3d_h.hpp:177
T Y() const noexcept
Gets the y-component of the point.
Definition: point_3d_h.hpp:127
Point3DH(T x, T y, T z, T w) noexcept
Create a point from the x-, y-, z- and w-component.
Definition: point_3d_h.hpp:69
Point3DH< T > & operator+=(const Point3DH< T > &point) noexcept
Adds and assigns to this point.
Definition: point_3d_h.hpp:235
Multi-purpose 3D vector class (homogeneous).
Definition: point_3d_h.hpp:21
AffineMatrix2D operator-(const AffineMatrix2D &lhs, const AffineMatrix2D &rhs) noexcept
Subtract two affine matrices.
Definition: affine_matrix_2d.hpp:231
T Z() const noexcept
Gets the z-component of the point.
Definition: point_3d_h.hpp:147
void SetZ(T z)
Sets the z-component of the point.
Definition: point_3d_h.hpp:157