15#pragma pack ( push, 4 )
20template<
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);
Multi-purpose 3D vector class (homogeneous).
Definition: point_3d_h.hpp:22
Point3DH< T > operator*(const Point3DH< T > &lhs, const T &rhs)
Multiply point with scalar.
Definition: point_3d_h.hpp:379
T operator*(const Point3DH< T > &lhs, const Point3DH< T > &rhs)
Inner product of two point vectors.
Definition: point_3d_h.hpp:364
Point3DH< T > & operator*=(const T &value) noexcept
Multiplies by a scalar and assigns to this point.
Definition: point_3d_h.hpp:265
const T & operator[](int index) const noexcept
Index based element access.
Definition: point_3d_h.hpp:296
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
T X() const noexcept
Gets the x-component of the point.
Definition: point_3d_h.hpp:107
T W() const noexcept
Gets the w-component of the point.
Definition: point_3d_h.hpp:167
Point3DH< T > & operator-=(const Point3DH< T > &point) noexcept
Subtracts and assigns to this point.
Definition: point_3d_h.hpp:250
T Y() const noexcept
Gets the y-component of the point.
Definition: point_3d_h.hpp:127
void SetX(T x) noexcept
Sets the x-component of the point.
Definition: point_3d_h.hpp:117
Point3DH< T > & operator/=(const T &value) noexcept
Divide by a scalar and assigns to this point.
Definition: point_3d_h.hpp:280
void SetY(T y)
Sets the y-component of the point.
Definition: point_3d_h.hpp:137
Point3DH< T > operator-(const Point3DH< T > &lhs, const Point3DH< T > &rhs)
Subtracts two points.
Definition: point_3d_h.hpp:349
Point3DH< T > operator+(const Point3DH< T > &lhs, const Point3DH< T > &rhs)
Add two points.
Definition: point_3d_h.hpp:334
Point3DH() noexcept=default
Creates a default point at (0, 0).
T Z() const noexcept
Gets the z-component of the point.
Definition: point_3d_h.hpp:147
Point3DH(const T(&list)[N]) noexcept
Construct a point with an initializer list.
Definition: point_3d_h.hpp:94
Point3DH< T > & operator+=(const Point3DH< T > &point) noexcept
Adds and assigns to this point.
Definition: point_3d_h.hpp:235
void SetW(T w)
Sets the w-component of the point.
Definition: point_3d_h.hpp:177
Point3DH(Point3D< T > point3d) noexcept
Create a homogeneous point from a point.
Definition: point_3d_h.hpp:83
bool operator==(const Point3DH< T > &other) const noexcept
Compares to an other point.
Definition: point_3d_h.hpp:204
void Normalize() noexcept
Normalize the x-, y-, and z- with the w-component.
Definition: point_3d_h.hpp:189
T & operator[](int index) noexcept
Index based element access.
Definition: point_3d_h.hpp:308
void SetZ(T z)
Sets the z-component of the point.
Definition: point_3d_h.hpp:157
Point3DH< T > operator/(const Point3DH< T > &lhs, const T &rhs)
Divide point by scalar.
Definition: point_3d_h.hpp:409
bool operator!=(const Point3DH< T > &other) const noexcept
Compares to an other point.
Definition: point_3d_h.hpp:216
Multi-purpose 3D vector class.
Definition: point_3d.hpp:22
Point3DH< T > operator*(const T &lhs, const Point3DH< T > &rhs)
Multiply scalar with point.
Definition: point_3d_h.hpp:394
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24