|
Ginger 1.1.5; VERSION ${PROJECT_VERSION}
|
#include <vector2_ref.hpp>
Public Member Functions | |
| constexpr | Vector2Ref () noexcept |
| Construct a new Vector2Ref object. | |
| constexpr | Vector2Ref (double &x, double &y) noexcept |
| Construct a new Vector2Ref object. | |
| constexpr auto | x () const noexcept -> const double & |
| constexpr auto | y () const noexcept -> const double & |
| constexpr auto | dot (const Vector2Ref &other) const -> double |
| constexpr auto | cross (const Vector2Ref &other) const -> double |
Arithmetic operators | |
definie +, -, *, /, +=, -=, *=, /=, etc. | |
| CONSTEXPR14 auto | operator+= (const Vector2< double, double > &other) -> Vector2Ref & |
| CONSTEXPR14 auto | operator-= (const Vector2< double, double > &other) -> Vector2Ref & |
| CONSTEXPR14 auto | operator*= (const double &alpha) -> Vector2Ref & |
| CONSTEXPR14 auto | operator/= (const double &alpha) -> Vector2Ref & |
| CONSTEXPR14 auto | operator* (const double &alpha) const -> Vector2< double, double > |
Public Attributes | |
| double & | _x |
| double & | _y |
Friends | |
| template<class Stream > | |
| auto | operator<< (Stream &out, const Vector2Ref &vec) -> Stream & |
|
inlineconstexprnoexcept |
Construct a new Vector2Ref object.
The default constructor binds both components to a shared dummy variable.
|
inlineconstexprnoexcept |
Construct a new Vector2Ref object.
The function constructs a new Vector2Ref object with given x and y values.
| [in] | x | The parameter x is of type double&&, which means it is a forwarding reference. It can accept any type, and it is passed as an rvalue reference. This allows the constructor to efficiently move or forward the value of x into the _x member variable. |
| [in] | y | The parameter "y" is the y-coordinate of the Vector2Ref object. It represents the vertical position of the vector in a 2D coordinate system. |
|
inlineconstexpr |
The cross product of two 2D vectors is calculated by multiplying their x and y components and subtracting the result.
\( u \times v = u_x v_y - u_y v_x \)
| [in] | other | The parameter "other" is a reference to an object of type Vector2Ref. |
cross returns the result of the cross product between the current vector and the other vector. The result is of type double.
|
inlineconstexpr |
The dot function calculates the dot product of two 2D vectors.
\( u \cdot v = u_x v_x + u_y v_y \)
| [in] | other | The parameter "other" is a reference to an object of type Vector2Ref. |
dot function is returning the dot product of two vectors, which is a scalar value of type double.
|
inline |
The function multiplies the components of this Vector2Ref by a scalar value.
| [in] | alpha | The scalar value to multiply each component by. |
|
inline |
The function multiplies the x and y components of a Vector2Ref object by a given value.
| R |
| [in] | alpha | alpha is a constant reference to a variable of type R. |
operator*= function returns a reference to the modified Vector2Ref object.
|
inline |
The function operator+= adds the components of another Vector2 object to the current Vector2Ref object and returns a reference to the updated object.
| [in] | other | The parameter "other" is a reference to an object of type Vector2<double, double>. |
|
inline |
The function subtracts the x and y components of another Vector2 object from the current Vector2Ref object.
| [in] | other | The parameter "other" is a reference to an object of type Vector2<double, double>. |
|
inline |
The function divides the x and y components of a Vector2Ref object by a given value.
| R |
| [in] | alpha | The parameter "alpha" is of type R, which is a template parameter. It represents the value by which the x and y components of the Vector2Ref object are divided. |
|
inlineconstexprnoexcept |
The function returns a reference to a constant value of type double.
|
inlineconstexprnoexcept |
The function y() returns a reference to a constant value of type double.
|
friend |
The above function overloads the << operator to output a Vector2Ref object in the format "{x, y}".
| Stream |
| [out] | out | The parameter "out" is a reference to a Stream object. It is used to output the contents of the Vector2Ref object to the stream. |
| [in] | vec | The parameter vec is a constant reference to an object of type Vector2Ref. |
operator<< function is Stream&. | double& ginger::Vector2Ref::_x |
| double& ginger::Vector2Ref::_y |