Go to the documentation of this file.
7 #ifndef INCLUDE_JET_POINT3_H_
8 #define INCLUDE_JET_POINT3_H_
25 static_assert(std::is_arithmetic<T>::value,
26 "Point only can be instantiated with arithematic types");
40 constexpr
Point() : x(0), y(0), z(0) {}
43 constexpr
Point(T x_, T y_, T z_) : x(x_), y(y_), z(z_) {}
50 Point(
const std::initializer_list<U>& lst);
53 constexpr
Point(
const Point& v) : x(v.x), y(v.y), z(v.z) {}
61 void set(T x, T y, T z);
68 void set(
const std::initializer_list<U>& lst);
144 const T&
at(
size_t i)
const;
171 template <
typename U>
223 template <
typename T>
227 template <
typename T>
231 template <
typename T>
235 template <
typename T>
239 template <
typename T>
243 template <
typename T>
247 template <
typename T>
251 template <
typename T>
255 template <
typename T>
259 template <
typename T>
263 template <
typename T>
267 template <
typename T>
271 template <
typename T>
275 template <
typename T>
279 template <
typename T>
283 template <
typename T>
287 template <
typename T>
292 template <
typename T>
296 template <
typename T>
313 #include "detail/point3-inl.h"
315 #endif // INCLUDE_JET_POINT3_H_
Point(const std::initializer_list< U > &lst)
Constructs point with initializer list.
2-D point class.
Definition: point2.h:23
Point3< double > Point3D
Double-type 3D point.
Definition: point3.h:303
bool operator!=(const Point &v) const
Returns true if other is the not same as this point.
Point rdiv(T v) const
Computes (v, v, v) / this.
Point2< T > ceil(const Point2< T > &a)
Returns element-wise ceiled point.
Point sub(T v) const
Computes this - (v, v, v).
T z
Z (or the third) component of the point.
Definition: point3.h:35
bool operator==(const Point &v) const
Returns true if other is the same as this point.
Point add(T v) const
Computes this + (v, v, v).
T & at(size_t i)
Returns reference to the i -th element of the point.
Point & operator=(const std::initializer_list< T > &lst)
Set x, y, and z components with given initializer list.
Point & operator*=(const Point &v)
Computes this *= (v.x, v.y, v.z)
Point div(const Point &v) const
Computes this / (v.x, v.y, v.z).
T max() const
Returns the maximum value among x, y, and z.
T min() const
Returns the minimum value among x, y, and z.
Point3< ssize_t > Point3I
Integer-type 3D point.
Definition: point3.h:306
T absmin() const
Returns the absolute minimum value among x, y, and z.
Point2< T > max(const Point2< T > &a, const Point2< T > &b)
Returns element-wise max point: (max(a.x, b.x), max(a.y, b.y)).
Point rsub(T v) const
Computes (v, v, v) - this.
void imul(T v)
Computes this *= (v, v, v).
Point & operator-=(T v)
Computes this -= (v, v, v)
constexpr Point(const Point &v)
Copy constructor.
Definition: point3.h:53
void set(const std::initializer_list< U > &lst)
Set x, y, and z components with given initializer list.
Point & operator-=(const Point &v)
Computes this -= (v.x, v.y, v.z)
Point add(const Point &v) const
Computes this + (v.x, v.y, v.z).
T absmax() const
Returns the absolute maximum value among x, y, and z.
Point3< float > Point3F
Float-type 3D point.
Definition: point3.h:300
Point & operator*=(T v)
Computes this *= (v, v, v)
Point & operator/=(T v)
Computes this /= (v, v, v)
void set(const Point &v)
Set x, y, and z with other point pt.
T y
Y (or the second) component of the point.
Definition: point3.h:32
Definition: advection_solver2.h:18
void set(T s)
Set all x, y, and z components to s.
Point mul(T v) const
Computes this * (v, v, v).
const T & at(size_t i) const
Returns const reference to the i -th element of the point.
Point sub(const Point &v) const
Computes this - (v.x, v.y, v.z).
T x
X (or the first) component of the point.
Definition: point3.h:26
Point & operator=(const Point &v)
Set x, y, and z with other point pt.
void imul(const Point &v)
Computes this *= (v.x, v.y, v.z).
void idiv(const Point &v)
Computes this /= (v.x, v.y, v.z).
Point & operator+=(T v)
Computes this += (v, v, v)
Point div(T v) const
Computes this / (v, v, v).
Point< U, 3 > castTo() const
Returns a point with different value type.
T clamp(T val, T low, T high)
Returns the clamped value.
void iadd(const Point &v)
Computes this += (v.x, v.y, v.z).
Matrix2x2< T > operator+(const Matrix2x2< T > &a, const Matrix2x2< T > &b)
Returns a + b (element-size).
bool isEqual(const Point &other) const
Returns true if other is the same as this point.
Point2< T > floor(const Point2< T > &a)
Returns element-wise floored point.
T sum() const
Returns the sum of all the components (i.e. x + y).
void set(T x, T y, T z)
Set x, y, and z components with given parameters.
3-D point class.
Definition: point3.h:23
size_t dominantAxis() const
Returns the index of the dominant axis.
T & operator[](size_t i)
Returns reference to the i -th element of the point.
void set(const Point2< T > &pt, T z)
Set x, y, and z components with given pt.x, pt.y, and z.
Point3< size_t > Point3UI
Unsigned integer-type 3D point.
Definition: point3.h:309
constexpr Point()
Constructs default point (0, 0, 0).
Definition: point3.h:40
Point rsub(const Point &v) const
Computes (v.x, v.y, v.z) - this.
Generic N-D point class.
Definition: point.h:23
const T & operator[](size_t i) const
Returns const reference to the i -th element of the point.
void idiv(T v)
Computes this /= (v, v, v).
void setZero()
Set both x, y, and z to zero.
Matrix2x2< T > operator/(const Matrix2x2< T > &a, T b)
Returns a' / b, where every element of matrix a' is a.
Point2< T > min(const Point2< T > &a, const Point2< T > &b)
Returns element-wise min point: (min(a.x, b.x), min(a.y, b.y)).
Point mul(const Point &v) const
Computes this * (v.x, v.y, v.z).
Matrix2x2< T > operator-(const Matrix2x2< T > &a)
Returns a matrix with opposite sign.
Point & operator/=(const Point &v)
Computes this /= (v.x, v.y, v.z)
void isub(const Point &v)
Computes this -= (v.x, v.y, v.z).
Matrix2x2< T > operator*(const Matrix2x2< T > &a, T b)
Returns a * b', where every element of matrix b' is b.
Point rdiv(const Point &v) const
Computes (v.x, v.y, v.z) / this.
Point & operator+=(const Point &v)
Computes this += (v.x, v.y, v.z)
void isub(T v)
Computes this -= (v, v, v).
constexpr Point(const Point2< T > &v, T z_)
Constructs point with a 2-D point and a scalar.
Definition: point3.h:46
void iadd(T v)
Computes this += (v, v, v).
size_t subminantAxis() const
Returns the index of the subminant axis.
constexpr Point(T x_, T y_, T z_)
Constructs point with given parameters x_, y_, and z_.
Definition: point3.h:43