mu
vector3d.h
Go to the documentation of this file.
1 
6 #ifndef MU_VECTOR3D_H_
7 #define MU_VECTOR3D_H_
8 
9 #include "mu/vector.h"
10 
11 namespace mu {
12 
18 template <typename T>
19 class Vector3D : public Vector<3, T> {
20  public:
21  /* inherit base class constructors. only constructors specific to Vector2D
22  * are defined here. apply rule of zero */
24 
34  template <class Tt = T>
35  // NOLINTNEXTLINE(runtime/explicit) implicit to make copy-init. work
36  Vector3D(const Vector<3, T>& other) : Vector<3, T>(other) {}
37 
45  T& x() noexcept { return Vector<3, T>::data_[0]; }
46 
54  const T& x() const noexcept { return Vector<3, T>::data_[0]; }
55 
63  T& y() noexcept { return Vector<3, T>::data_[1]; }
64 
72  const T& y() const noexcept { return Vector<3, T>::data_[1]; }
73 
81  T& z() noexcept { return Vector<3, T>::data_[2]; }
82 
90  const T& z() const noexcept { return Vector<3, T>::data_[2]; }
91 };
92 
93 } // namespace mu
94 #endif // MU_VECTOR3D_H_
Vector3D(const Vector< 3, T > &other)
Construct a new Vector3D object from a Vector object.
Definition: vector3d.h:36
const T & z() const noexcept
const z component
Definition: vector3d.h:90
const T & y() const noexcept
const y component
Definition: vector3d.h:72
A three dimensional vector.
Definition: vector3d.h:19
A generic vector.
Definition: vector.h:48
const T & x() const noexcept
const x component
Definition: vector3d.h:54
T & x() noexcept
x component
Definition: vector3d.h:45
Definition: literals.h:11
T & z() noexcept
z component
Definition: vector3d.h:81
T & y() noexcept
y component
Definition: vector3d.h:63