15 #pragma pack ( push, 4 ) 20 template<
class T,
class ENABLE =
void>
67 template<std::
size_t N>
70 static_assert(N == 3,
"CVB: Point3D must have 3 elements");
71 std::copy(std::begin(list), std::end(list), &x_);
142 return sqrt(x_ * x_ + y_ * y_ + z_ * z_);
155 return (x_ == other.x_ && y_ == other.y_ && z_ == other.z_);
167 return !(*
this == other);
175 return Point3D<C>(static_cast<C>(
X()), static_cast<C>(
Y()), static_cast<C>(
Z()));
243 assert(index < 3 && index >= 0);
244 return *(&x_ + index);
255 assert(index < 3 && index >= 0);
256 return *(&x_ + index);
261 T x_ = static_cast<T>(0.0);
262 T y_ = static_cast<T>(0.0);
263 T z_ = static_cast<T>(0.0);
310 return lhs.
X() * rhs.
X() + lhs.
Y() * rhs.
Y() + lhs.
Z() * rhs.
Z();
325 return Point3D<T>(lhs.
X() * rhs, lhs.
Y() * rhs, lhs.
Z() * rhs);
355 return Point3D<T>(lhs.
X() / rhs, lhs.
Y() / rhs, lhs.
Z() / rhs);
371 return Point3D<int>(static_cast<int>(std::round(rhs.X())), static_cast<int>(std::round(rhs.Y())), static_cast<int>(std::round(rhs.Z())) );
T X() const noexcept
Get the x component of the point.
Definition: point_3d.hpp:80
Point3D() noexcept=default
Creates a default point at (0, 0).
Point2D< int > Round(const Point2D< T > &rhs) noexcept
Round to an integer point.
Definition: point_2d.hpp:380
void SetY(T y)
Set the y component of the point.
Definition: point_3d.hpp:110
AffineMatrix2D operator/(const AffineMatrix2D &lhs, const double &rhs)
Divide affine matrix by scalar.
Definition: affine_matrix_2d.hpp:301
T Length() const noexcept
Gets the length of this point.
Definition: point_3d.hpp:140
Point3D< T > & operator -=(const Point3D< T > &point) noexcept
Subtracts and assigns to this point.
Definition: point_3d.hpp:198
Root namespace for the Image Manager interface.
Definition: version.hpp:11
void SetX(T x) noexcept
Set the x component of the point.
Definition: point_3d.hpp:90
Multi-purpose 3D vector class.
Definition: point_3d.hpp:21
AffineMatrix2D operator *(const AffineMatrix2D &lhs, const AffineMatrix2D &rhs) noexcept
Multiply two affine matrices.
Definition: affine_matrix_2d.hpp:245
void SetZ(T z)
Set the z component of the point.
Definition: point_3d.hpp:130
Point3D< T > & operator *=(const T &value) noexcept
Multiplies by a scalar and assigns to this point.
Definition: point_3d.hpp:212
Point3D< T > operator+(const Point3D< T > &lhs, const Point3D< T > &rhs)
Add two points.
Definition: point_3d.hpp:278
T & operator[](int index) noexcept
Index based element access.
Definition: point_3d.hpp:253
bool operator!=(const Point3D< T > &other) const noexcept
Compares to an other point.
Definition: point_3d.hpp:165
bool operator==(const Point3D< T > &other) const noexcept
Compares to an other point.
Definition: point_3d.hpp:153
Point3D(const T(&list)[N]) noexcept
Construct a point with an initializer list.
Definition: point_3d.hpp:68
T Z() const noexcept
Get the z component of the point.
Definition: point_3d.hpp:120
Point3D< T > & operator+=(const Point3D< T > &point) noexcept
Adds and assigns to this point.
Definition: point_3d.hpp:184
const T & operator[](int index) const noexcept
Index based element access.
Definition: point_3d.hpp:241
AffineMatrix2D operator-(const AffineMatrix2D &lhs, const AffineMatrix2D &rhs) noexcept
Subtract two affine matrices.
Definition: affine_matrix_2d.hpp:231
Point3D< T > & operator/=(const T &value) noexcept
Divide by a scalar and assigns to this point.
Definition: point_3d.hpp:226
T Y() const noexcept
Get the y component of the point.
Definition: point_3d.hpp:100