MeshKernel
Public Member Functions | List of all members
meshkernel::Vector Class Reference

A class defining a vector. More...

#include <Vector.hpp>

Public Member Functions

 Vector ()
 Default constructor.
 
 Vector (const double x, const double y)
 Class constructor. More...
 
double x () const
 Gets the x coordinate of the vector. More...
 
double & x ()
 Gets the x coordinate of the vector. More...
 
double y () const
 Gets the y coordinate of the vector. More...
 
double & y ()
 Gets the y coordinate of the vector. More...
 
double operator[] (const UInt i) const
 Get the value of the vector.
 
double & operator[] (const UInt i)
 Get the value of the vector.
 
Vectoroperator+= (const Vector &vec)
 Inplace add vector to vector.
 
Vectoroperator-= (const Vector &vec)
 Inplace subtract vector from vector.
 
Vectoroperator/= (const double alpha)
 Inplace divide vector by scalar. More...
 
Vectoroperator*= (const double alpha)
 Inplace multiply vector by scalar.
 
void normalise ()
 Normalise the vector in place. More...
 
double length () const
 Compute the length of the vector. More...
 
double lengthSquared () const
 Compute the length squared of the vector. More...
 

Detailed Description

A class defining a vector.

Constructor & Destructor Documentation

◆ Vector()

meshkernel::Vector::Vector ( const double  x,
const double  y 
)
inline

Class constructor.

Parameters
[in]xThe x coordinate of the vector
[in]yThe y coordinate of the vector

Member Function Documentation

◆ 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/=()

meshkernel::Vector & meshkernel::Vector::operator/= ( const double  alpha)
inline

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: