A class defining a vector.
More...
#include <Vector.hpp>
|
|
| Vector () |
| | Default constructor.
|
| |
| | Vector (const double x, const double y) |
| | Class constructor.
|
| |
| double | x () const |
| | Gets the x coordinate of the vector.
|
| |
| double & | x () |
| | Gets the x coordinate of the vector.
|
| |
| double | y () const |
| | Gets the y coordinate of the vector.
|
| |
| double & | y () |
| | Gets the y coordinate of the vector.
|
| |
|
double | operator[] (const UInt i) const |
| | Get the value of the vector.
|
| |
|
double & | operator[] (const UInt i) |
| | Get the value of the vector.
|
| |
|
Vector & | operator+= (const Vector &vec) |
| | Inplace add vector to vector.
|
| |
|
Vector & | operator-= (const Vector &vec) |
| | Inplace subtract vector from vector.
|
| |
| Vector & | operator/= (const double alpha) |
| | Inplace divide vector by scalar.
|
| |
|
Vector & | operator*= (const double alpha) |
| | Inplace multiply vector by scalar.
|
| |
| void | normalise () |
| | Normalise the vector in place.
|
| |
| double | length () const |
| | Compute the length of the vector.
|
| |
| double | lengthSquared () const |
| | Compute the length squared of the vector.
|
| |
A class defining a vector.
◆ Vector()
| meshkernel::Vector::Vector |
( |
const double |
x, |
|
|
const double |
y |
|
) |
| |
|
inline |
Class constructor.
- Parameters
-
| [in] | x | The x coordinate of the vector |
| [in] | y | The y coordinate of the vector |
◆ length()
| double meshkernel::Vector::length |
( |
| ) |
const |
|
inline |
Compute the length of the vector.
- Returns
- \( l = \sqrt (x^2 + y^2) \)
◆ lengthSquared()
| double meshkernel::Vector::lengthSquared |
( |
| ) |
const |
|
inline |
Compute the length squared of the vector.
- Returns
- \( l = x^2 + y^2 \)
◆ normalise()
| void meshkernel::Vector::normalise |
( |
| ) |
|
|
inline |
Normalise the vector in place.
- Note
- No check is made that the length is 0
◆ operator/=()
Inplace divide vector by scalar.
- Note
- No check is made that the divisor is 0
◆ x() [1/2]
| double & meshkernel::Vector::x |
( |
| ) |
|
|
inline |
Gets the x coordinate of the vector.
- Returns
- x The x coordinate of the vector
◆ x() [2/2]
| double meshkernel::Vector::x |
( |
| ) |
const |
|
inline |
Gets the x coordinate of the vector.
- Returns
- x The x coordinate of the vector
◆ y() [1/2]
| double & meshkernel::Vector::y |
( |
| ) |
|
|
inline |
Gets the y coordinate of the vector.
- Returns
- x The y coordinate of the vector
◆ y() [2/2]
| double meshkernel::Vector::y |
( |
| ) |
const |
|
inline |
Gets the y coordinate of the vector.
- Returns
- x The y coordinate of the vector
The documentation for this class was generated from the following file:
- /home/runner/work/MeshKernel/MeshKernel/libs/MeshKernel/include/MeshKernel/Vector.hpp