13 #ifndef EBGeometry_Vec
14 #define EBGeometry_Vec
51 constexpr
Vec2T(
const T& a_x,
const T& a_y);
77 inline static constexpr
Vec2T<T>
83 inline static constexpr
Vec2T<T>
89 inline static constexpr
Vec2T<T>
95 inline static constexpr
Vec2T<T>
102 inline constexpr
Vec2T<T>&
103 operator=(const
Vec2T& a_other) noexcept;
111 inline constexpr
Vec2T<T>
112 operator+(const
Vec2T& a_other) const noexcept;
120 inline constexpr
Vec2T<T>
121 operator-(const
Vec2T& a_other) const noexcept;
126 inline constexpr
Vec2T<T>
127 operator-() const noexcept;
135 inline constexpr
Vec2T<T>
136 operator*(const T& s) const noexcept;
144 inline constexpr
Vec2T<T>
145 operator/(const T& s) const noexcept;
153 inline constexpr
Vec2T<T>&
154 operator+=(const
Vec2T& a_other) noexcept;
162 inline constexpr
Vec2T<T>&
163 operator-=(const
Vec2T& a_other) noexcept;
171 inline constexpr
Vec2T<T>&
172 operator*=(const T& s) noexcept;
180 inline constexpr
Vec2T<T>&
181 operator/=(const T& s) noexcept;
216 template <typename T>
224 operator<<(std::ostream& os,
const Vec3T<T>& vec)
226 os <<
'(' << vec[0] <<
',' << vec[1] <<
',' << vec[2] <<
')';
250 constexpr
Vec3T(const T& a_x, const T& a_y, const T& a_z) noexcept;
260 inline static constexpr
Vec3T<T>
266 inline static constexpr
Vec3T<T>
273 inline static constexpr
Vec3T<T>
274 unit(const
size_t a_dir) noexcept;
279 inline static constexpr
Vec3T<T>
285 inline static constexpr
Vec3T<T>
291 inline static constexpr
Vec3T<T>
299 inline constexpr
bool
300 lessLX(const
Vec3T<T>& u) const noexcept;
307 operator[](
size_t i) noexcept;
313 inline constexpr const T&
314 operator[](
size_t i) const noexcept;
320 inline constexpr
bool
321 operator==(const
Vec3T<T>& u) const noexcept;
327 inline constexpr
bool
328 operator!=(const
Vec3T<T>& u) const noexcept;
336 inline constexpr
bool
337 operator<(const
Vec3T<T>& u) const noexcept;
344 inline constexpr
bool
345 operator>(const
Vec3T<T>& u) const noexcept;
353 inline constexpr
bool
354 operator<=(const
Vec3T<T>& u) const noexcept;
362 inline constexpr
bool
363 operator>=(const
Vec3T<T>& u) const noexcept;
370 inline constexpr
Vec3T<T>&
371 operator=(const
Vec3T<T>& u) noexcept;
378 inline constexpr
Vec3T<T>
379 operator+(const
Vec3T<T>& u) const noexcept;
386 inline constexpr
Vec3T<T>
387 operator-(const
Vec3T<T>& u) const noexcept;
392 inline constexpr
Vec3T<T>
393 operator-() const noexcept;
401 inline constexpr
Vec3T<T>
402 operator*(const T& s) const noexcept;
410 inline constexpr
Vec3T<T>
411 operator*(const
Vec3T<T>& s) const noexcept;
418 inline constexpr
Vec3T<T>
419 operator/(const T& s) const noexcept;
426 inline constexpr
Vec3T<T>
427 operator/(const
Vec3T<T>& v) const noexcept;
435 inline constexpr
Vec3T<T>&
436 operator+=(const
Vec3T<T>& u) noexcept;
444 inline constexpr
Vec3T<T>&
445 operator-=(const
Vec3T<T>& u) noexcept;
453 inline constexpr
Vec3T<T>&
454 operator*=(const T& s) noexcept;
462 inline constexpr
Vec3T<T>&
463 operator/=(const T& s) noexcept;
472 inline constexpr
Vec3T<T>
482 inline constexpr
Vec3T<T>
490 inline constexpr
Vec3T<T>
491 cross(const
Vec3T<T>& u) const noexcept;
509 minDir(const
bool a_doAbs) const noexcept;
519 maxDir(const
bool a_doAbs) const noexcept;
541 std::array<T, 3> m_X;
550 template <typename T>
551 inline constexpr
Vec2T<T>
552 operator*(const T& s, const
Vec2T<T>& a_other) noexcept;
561 template <typename T>
562 inline constexpr
Vec2T<T>
563 operator/(const T& s, const
Vec2T<T>& a_other) noexcept;
571 template <typename T>
581 template <typename T>
590 template <typename T>
598 template <typename T>
608 template <class R, typename T>
609 inline constexpr
Vec3T<T>
610 operator*(const R& s, const
Vec3T<T>& u) noexcept;
618 template <typename T>
619 inline constexpr
Vec3T<T>
628 template <class R, typename T>
629 inline constexpr
Vec3T<T>
630 operator/(const R& s, const
Vec3T<T>& u) noexcept;
639 template <typename T>
640 inline constexpr
Vec3T<T>
650 template <typename T>
651 inline constexpr
Vec3T<T>
659 template <typename T>
667 template <typename T>
671 #include "EBGeometry_NamespaceFooter.hpp"
673 #include "EBGeometry_VecImplem.hpp"
Two-dimensional vector class with arithmetic operators.
Definition: EBGeometry_Vec.hpp:31
constexpr T length() const noexcept
Compute length of vector.
~Vec2T()=default
Destructor (does nothing)
constexpr T length2() const noexcept
Compute square of vector.
static constexpr Vec2T< T > max() noexcept
Return maximum possible representative vector.
Vec2T()
Default constructor. Sets the vector to the zero vector.
static constexpr Vec2T< T > zero() noexcept
Return av vector with x = y = 0.
T x
First component in the vector.
Definition: EBGeometry_Vec.hpp:61
constexpr Vec2T(const T &a_x, const T &a_y)
Full constructor.
T y
Second component in the vector.
Definition: EBGeometry_Vec.hpp:66
static constexpr Vec2T< T > min() noexcept
Return minimum possible representative vector.
constexpr T dot(const Vec2T &a_other) const noexcept
Dot product operator.
static constexpr Vec2T< T > infinity() noexcept
Return a vector with inf components.
static constexpr Vec2T< T > one() noexcept
Return av vector with x = y = 1.
Vec2T(const Vec2T &u) noexcept
Copy constructor.
Three-dimensional vector class with arithmetic operators.
Definition: EBGeometry_Vec.hpp:218
Vec3T() noexcept
Default constructor. Sets the vector to the zero vector.