|
Jameo Core Library
|
A two dimensional vector. Owns special functions for 2d space. More...
Public Member Functions | |
| Vertex2 () noexcept=default | |
| Constructor creates null vector. | |
| Vertex2 (double x, double y) noexcept | |
| Constructor creates arbitrary vector. | |
| Vertex2 (const Vertex3 &v3) noexcept | |
| Copy constructor. | |
| double | abs () const |
| This method returns the absolute value of the vector. The absolute value is equal to the length. | |
| Vertex2 & | normalize () |
| This method normalizes the vector. A normalized vector has the length 1. | |
| Vertex2 | normalized () const |
| This method returns a normalized vector with the length 1. | |
| double | crossProduct (const Vertex2 &another) const |
| Returns the cross product of this vector multiplied by another. | |
| double | dotProduct (const Vertex2 &another) const |
| Returns the scalar product of this vector with another. | |
| bool | isCollinear (const Vertex2 &another) const |
| This method calculates whether the two vectors are collinear. In other words, whether both vectors are parallel. | |
| bool | isOrthogonal (const Vertex2 &another) const |
| This method calculates whether the two vectors are orthogonal. In other words, whether they are perpendicular to each other. | |
| double | angleTo (const Vertex2 &another) const |
| Returns the signed angle between this vector and another vector. | |
| bool | isRightTo (const Vertex2 &another) const |
| This method calculates whether this vector is "to the right", i.e. clockwise next to the other vector. | |
| bool | isLeftTo (const Vertex2 &another) const |
| This method calculates whether this vector is "left", i.e. counterclockwise, next to the other vector. | |
| bool | isValid () const |
| This method returns true if the vector is defined, i.e. if the numbers are not NAN "Not-a-number". | |
| Vertex2 & | rotate (double angle) |
| This method rotates the vector around the Z-axis with the specified angle. | |
| Vertex2 | rotated (double angle) const |
| This method returns a rotated vector around the Z-axis with the specified angle. | |
| Vertex2 | scale (const Vertex2 &another) const |
| This method multiplies this vector line by line with the other vector. | |
| Vertex2 & | operator+= (const Vertex2 &another) |
| Vertex2 & | operator-= (const Vertex2 &another) |
| Vertex2 | operator/ (double b) const |
| Implementation of the operator /. | |
Public Attributes | |
| double | x = 0.0 |
| X component of vector. | |
| double | y = 0.0 |
| Y component of vector. | |
Friends | |
| DllExport friend std::ostream & | operator<< (std::ostream &out, const Vertex2 &vertex) |
A two dimensional vector. Owns special functions for 2d space.
|
defaultnoexcept |
Constructor creates null vector.
|
noexcept |
Constructor creates arbitrary vector.
| x | X-component of the vector |
| y | y-component of the vector |
|
explicitnoexcept |
Copy constructor.
| v3 | The other 3d-vector. The z-component is ignored. |
| double jm::Vertex2::abs | ( | ) | const |
This method returns the absolute value of the vector. The absolute value is equal to the length.
| double jm::Vertex2::angleTo | ( | const Vertex2 & | another | ) | const |
Returns the signed angle between this vector and another vector.
| another | The vector we want to know the angle to. |
| double jm::Vertex2::crossProduct | ( | const Vertex2 & | another | ) | const |
Returns the cross product of this vector multiplied by another.
| another | the other vector. |
| double jm::Vertex2::dotProduct | ( | const Vertex2 & | another | ) | const |
Returns the scalar product of this vector with another.
| another | the other vector. |
| bool jm::Vertex2::isCollinear | ( | const Vertex2 & | another | ) | const |
This method calculates whether the two vectors are collinear. In other words, whether both vectors are parallel.
| bool jm::Vertex2::isLeftTo | ( | const Vertex2 & | another | ) | const |
This method calculates whether this vector is "left", i.e. counterclockwise, next to the other vector.
| bool jm::Vertex2::isOrthogonal | ( | const Vertex2 & | another | ) | const |
This method calculates whether the two vectors are orthogonal. In other words, whether they are perpendicular to each other.
| bool jm::Vertex2::isRightTo | ( | const Vertex2 & | another | ) | const |
This method calculates whether this vector is "to the right", i.e. clockwise next to the other vector.
| bool jm::Vertex2::isValid | ( | ) | const |
This method returns true if the vector is defined, i.e. if the numbers are not NAN "Not-a-number".
| Vertex2 & jm::Vertex2::normalize | ( | ) |
This method normalizes the vector. A normalized vector has the length 1.
| Vertex2 jm::Vertex2::normalized | ( | ) | const |
This method returns a normalized vector with the length 1.
| Vertex2 jm::Vertex2::operator/ | ( | double | b | ) | const |
Implementation of the operator /.
| Vertex2 & jm::Vertex2::rotate | ( | double | angle | ) |
This method rotates the vector around the Z-axis with the specified angle.
| angle | The angle of rotation in the mathematical positive sense in radians. |
| Vertex2 jm::Vertex2::rotated | ( | double | angle | ) | const |
This method returns a rotated vector around the Z-axis with the specified angle.
| angle | The angle of rotation in the mathematical positive sense in radians. |
This method multiplies this vector line by line with the other vector.
|
friend |
| double jm::Vertex2::x = 0.0 |
X component of vector.
| double jm::Vertex2::y = 0.0 |
Y component of vector.