maliput
Vector2 Class Reference

Detailed Description

A 2-dimensional vector.

#include <include/maliput/math/vector.h>

Inheritance diagram for Vector2:
[legend]

Public Member Functions

 Vector2 ()
 Constructs a null 2-dimensional vector. More...
 
 Vector2 (std::initializer_list< double > values)
 Constructs a 2-dimensional vector using initializing list;. More...
 
 Vector2 (std::array< double, 2 > values)
 Constructs a 2-dimensional vector from a std::array object;. More...
 
 Vector2 (double x, double y)
 Constructs a 2-dimensional from double type arguments.;. More...
 
 Vector2 (const Vector< 2 > &other)
 Constructs a Vector2 from a Vector<2>. More...
 
double x () const
 
double y () const
 
doublex ()
 
doubley ()
 
- Public Member Functions inherited from VectorBase< 2, Vector2 >
 VectorBase ()
 Constructs a null N-dimensional vector. More...
 
 VectorBase (std::array< double, N > values)
 Constructs an N-dimensional vector from a std::array object;. More...
 
 VectorBase (std::initializer_list< double > values)
 Constructs an N-dimensional vector using initializing list;. More...
 
 VectorBase (const VectorBase< N, Vector2 > &other)=default
 Copy constructor. More...
 
 VectorBase (VectorBase< N, Vector2 > &&other)=default
 Move constructor. More...
 
double dot (const VectorBase< N, Vector2 > &vector) const
 
double norm () const
 
void normalize ()
 Divides each vector component by norm(). More...
 
Vector2 normalized () const
 
std::size_t size () const
 
std::array< double, N > to_array () const
 
Vector2operator= (const VectorBase< N, Vector2 > &other)
 Assignment operator overload. More...
 
Vector2operator= (const VectorBase< N, Vector2 > &&other)
 Move assignment operator overload. More...
 
double operator[] (std::size_t index) const
 Constant subscripting array operator overload. More...
 
doubleoperator[] (std::size_t index)
 Subscripting array operator overload. More...
 
bool operator== (const VectorBase< N, Vector2 > &vector) const
 Equality operator overload. More...
 
bool operator!= (const VectorBase< N, Vector2 > &vector) const
 Inequality operator overload. More...
 
Vector2 operator+ (const VectorBase< N, Vector2 > &vector) const
 Add operator overload. More...
 
Vector2operator+= (const VectorBase< N, Vector2 > &vector)
 Add and assignment operator overload. More...
 
Vector2 operator- (const VectorBase< N, Vector2 > &vector) const
 Substract operator overload. More...
 
Vector2 operator/ (double scalar) const
 Divide operator overload between a VectorBase<N, Derived> vector and a double. More...
 
std::string to_str () const
 

Static Public Member Functions

static Vector2 UnitX ()
 
static Vector2 UnitY ()
 
- Static Public Member Functions inherited from VectorBase< 2, Vector2 >
static Vector2 Zero ()
 
static Vector2 Ones ()
 
static Vector2 FromStr (const std::string &vector_str)
 Parses vector_str that should come in the following format "{A, B, C, ...}" (white spaces could or could not be there). More...
 

Additional Inherited Members

- Static Public Attributes inherited from VectorBase< 2, Vector2 >
static constexpr std::size_t kDimension
 The dimension of the vector. More...
 
- Protected Attributes inherited from VectorBase< 2, Vector2 >
std::array< double, N > values_
 

Constructor & Destructor Documentation

◆ Vector2() [1/5]

Vector2 ( )

Constructs a null 2-dimensional vector.

◆ Vector2() [2/5]

Vector2 ( std::initializer_list< double values)

Constructs a 2-dimensional vector using initializing list;.

◆ Vector2() [3/5]

Vector2 ( std::array< double, 2 >  values)

Constructs a 2-dimensional vector from a std::array object;.

◆ Vector2() [4/5]

Vector2 ( double  x,
double  y 
)

Constructs a 2-dimensional from double type arguments.;.

◆ Vector2() [5/5]

Vector2 ( const Vector< 2 > &  other)

Constructs a Vector2 from a Vector<2>.

Member Function Documentation

◆ UnitX()

Vector2 UnitX ( )
static
Returns
An unitary 2-dimensional vector with direction at x axis.

◆ UnitY()

Vector2 UnitY ( )
static
Returns
An unitary 2-dimensional vector with direction at y axis.

◆ x() [1/2]

double& x ( )
Returns
The x value by reference.

◆ x() [2/2]

double x ( ) const
Returns
The x value.

◆ y() [1/2]

double& y ( )
Returns
The y value by reference.

◆ y() [2/2]

double y ( ) const
Returns
The y value.

The documentation for this class was generated from the following files: