|
| | Vector3D (const double x, const double y, const double z) |
| | Initializes a vector given xyz components. More...
|
| |
|
| Vector3D (const Vec3_ &other) |
| | Copy constructor for the base class.
|
| |
| double | x () const |
| | Gets x-component. More...
|
| |
| void | x (const double &newX) |
| | Sets x-component. More...
|
| |
| double | y () const |
| | Gets y-component. More...
|
| |
| void | y (const double &newY) |
| | Sets y-component. More...
|
| |
| double | z () const |
| | Gets z-component. More...
|
| |
| void | z (const double &newZ) |
| | Sets z-component. More...
|
| |
| Vector3D | cross (const Vector3D &other) const |
| | Cross product of two vectors. More...
|
| |
| template<typename T > |
| T | componentsAs () const |
| | Converts vector to another object. More...
|
| |
| template<typename T > |
| T | anglesAs () const |
| | Converts angles to another object. More...
|
| |
| template<AngleDir D> |
| double | angle () const |
| | Gets a specific angle of the vector. More...
|
| |
| template<AngleDir D> |
| Vector3D | rotate (const double &ang) const |
| | Rotates vector around a certain axis by a certain angle. More...
|
| |
| | Vector () |
| | No-argument constructor. More...
|
| |
| | Vector (const std::initializer_list< T > args) |
| | Initializes a vector given initializer list. More...
|
| |
| | Vector (const Vector< D, T > &other) |
| | Copy constructor. More...
|
| |
| | Vector (Vector< D, T > &&) noexcept=default |
| | Move constructor. More...
|
| |
| | Vector () |
| | No-argument constructor. More...
|
| |
| | Vector (const std::initializer_list< T > args) |
| | Initializes a vector given initializer list. More...
|
| |
| | Vector (const Vector< D, T > &other) |
| | Copy constructor. More...
|
| |
| | Vector (Vector< D, T > &&) noexcept=default |
| | Move constructor. More...
|
| |
| Vector< D, T > & | operator= (const Vector< D, T > &other) |
| | Assignment operator. More...
|
| |
| Vector< D, T > & | operator= (Vector< D, T > &&) noexcept=default |
| | Move assignment operator. More...
|
| |
| virtual | ~Vector ()=default |
| | Destructor. More...
|
| |
| virtual std::string | toString () const |
| | Returns string form of vector. More...
|
| |
| Vector< D, T > | operator- () const |
| | Negative of a vector. More...
|
| |
| Vector< D, T > | operator+ () const |
| | Positive of a vector. More...
|
| |
| Vector< D, T > & | operator+= (const Vector< D, T > &other) |
| | In-place addition. More...
|
| |
| Vector< D, T > & | operator-= (const Vector< D, T > &other) |
| | In-place subtraction. More...
|
| |
| Vector< D, T > & | operator*= (const T other) |
| | In-place scalar multiplication. More...
|
| |
| Vector< D, T > & | operator/= (const T other) |
| | In-place scalar division. More...
|
| |
| T | dot (const Vector< D, T > &other) const |
| | Dot product. More...
|
| |
| T | magn () const |
| | Magnitude. More...
|
| |
| Vector< D, T > | normalize () const |
| | Normalizes a vector. More...
|
| |
| constexpr std::size_t | numDimensions () const |
| | Gets the number of dimensions. More...
|
| |
| bool | isZero () const |
| | Determines whether the current vector is a zero vector. More...
|
| |
| const T & | operator[] (const std::size_t index) const |
| | Value of a certain component of a vector. More...
|
| |
| T & | operator[] (const std::size_t index) |
| | Sets value of a certain component. More...
|
| |
| const T & | at (const std::size_t index) const |
| | Value of a certain component of a vector. More...
|
| |
| T & | at (const std::size_t index) |
| | Sets value of a certain component. More...
|
| |
| iterator | begin () noexcept |
| | Iterator of first element. More...
|
| |
| const_iterator | begin () const noexcept |
| | Const interator of first element. More...
|
| |
| iterator | end () noexcept |
| | Interator of last element + 1. More...
|
| |
| const_iterator | end () const noexcept |
| | Const interator of last element + 1. More...
|
| |
| reverse_iterator | rbegin () noexcept |
| | Reverse iterator to last element. More...
|
| |
| const_reverse_iterator | rbegin () const noexcept |
| | Const reverse iterator to last element. More...
|
| |
| reverse_iterator | rend () noexcept |
| | Reverse iterator to first element - 1. More...
|
| |
| const_reverse_iterator | rend () const noexcept |
| | Const reverse iterator to first element - 1. More...
|
| |
A simple 3D vector representation.
template<AngleDir D>
| Vector3D svector::Vector3D::rotate |
( |
const double & |
ang | ) |
const |
|
inline |
Rotates vector around a certain axis by a certain angle.
Uses the basic gimbal-like 3D rotation matrices for the x-axis, y-axis, and the z-axis.
Specify your rotation in the template argument. When the given template is ALPHA, the vector rotates around the x-axis, when the given template is BETA, the vector rotates around y-axis, and when the given template is GAMMA, the vector rotates around z-axis.
- See also
- svector::AngleDir
- Parameters
-
| ang | the angle to rotate the vector, in radians. |
- Returns
- A new, rotated vector.