MyGAL
mygal::Vector2< T > Class Template Reference

Class representing a 2D vector. More...

`#include <Vector2.h>`

Public Member Functions

Vector2 (T x=0.0, T y=0.0)
Default constructor. More...

Vector2< T > operator- () const
Compute the opposite vector. More...

Vector2< T > & operator+= (const Vector2< T > &other)
Add a vector. More...

Vector2< T > & operator-= (const Vector2< T > &other)
Substract a vector. More...

Vector2< T > & operator*= (T t)
Multiply by a scalar. More...

Vector2< T > getOrthogonal () const
Get the orthogonal vector. More...

getNorm () const
Compute the euclidean norm of the vector. More...

getDistance (const Vector2< T > &other) const
Compute the euclidean distance of this point to another point. More...

getDet (const Vector2< T > &other) const
Compute the determinant with another vector. More...

x

y

Related Functions

(Note that these are not member functions.)

template<typename T >
Vector2< T > operator+ (Vector2< T > lhs, const Vector2< T > &rhs)
Compute the sum of two vectors. More...

template<typename T >
Vector2< T > operator- (Vector2< T > lhs, const Vector2< T > &rhs)
Compute the difference of two vectors. More...

template<typename T >
Vector2< T > operator* (T t, Vector2< T > vec)
Compute the product of a scalar by a vector. More...

template<typename T >
Vector2< T > operator* (Vector2< T > vec, T t)
Compute the product of a vector by a scalar. More...

template<typename T >
std::ostream & operator<< (std::ostream &os, const Vector2< T > &vec)
Insert a vector in a stream. More...

Detailed Description

template<typename T> class mygal::Vector2< T >

Class representing a 2D vector.

This class can be used to represent a 2D point too.

Definition at line 33 of file Vector2.h.

◆ Vector2()

template<typename T>
 mygal::Vector2< T >::Vector2 ( T x = `0.0`, T y = `0.0` )
inline

Default constructor.

Parameters
 x x-coordinate y y-coordinate

Definition at line 59 of file Vector2.h.

◆ getDet()

template<typename T>
 T mygal::Vector2< T >::getDet ( const Vector2< T > & other ) const
inline

Compute the determinant with another vector.

Parameters
 other Other vector to compute the determinant with
Returns
The determinant of this vector with `other`

Definition at line 162 of file Vector2.h.

◆ getDistance()

template<typename T>
 T mygal::Vector2< T >::getDistance ( const Vector2< T > & other ) const
inline

Compute the euclidean distance of this point to another point.

In this function vectors are interpreted as points.

Parameters
 other Other point to compute the distance from
Returns
The euclidean distance of this point to `other`

Definition at line 150 of file Vector2.h.

◆ getNorm()

template<typename T>
 T mygal::Vector2< T >::getNorm ( ) const
inline

Compute the euclidean norm of the vector.

Returns
The euclidean norm of the vector

Definition at line 136 of file Vector2.h.

◆ getOrthogonal()

template<typename T>
 Vector2 mygal::Vector2< T >::getOrthogonal ( ) const
inline

Get the orthogonal vector.

Returns
The orthogonal vector

Definition at line 126 of file Vector2.h.

◆ operator*=()

template<typename T>
 Vector2& mygal::Vector2< T >::operator*= ( T t )
inline

Multiply by a scalar.

Parameters
 t Scalar to multiply by
Returns
This vector after multiplication

Definition at line 112 of file Vector2.h.

◆ operator+=()

template<typename T>
 Vector2& mygal::Vector2< T >::operator+= ( const Vector2< T > & other )
inline

Parameters
 other Vector to add
Returns
This vector after addition

Definition at line 84 of file Vector2.h.

◆ operator-()

template<typename T>
 Vector2 mygal::Vector2< T >::operator- ( ) const
inline

Compute the opposite vector.

Returns
The opposite vector

Definition at line 72 of file Vector2.h.

◆ operator-=()

template<typename T>
 Vector2& mygal::Vector2< T >::operator-= ( const Vector2< T > & other )
inline

Substract a vector.

Parameters
 other Vector to substract
Returns
This vector after substraction

Definition at line 98 of file Vector2.h.

◆ operator*() [1/2]

template<typename T >
 Vector2< T > operator* ( T t, Vector2< T > vec )
related

Compute the product of a scalar by a vector.

Parameters
 t Scalar vec Vector
Returns
Product of this scalar by this vector

Definition at line 212 of file Vector2.h.

◆ operator*() [2/2]

template<typename T >
 Vector2< T > operator* ( Vector2< T > vec, T t )
related

Compute the product of a vector by a scalar.

Parameters
 vec Vector t Scalar
Returns
Product of this vector by this scalar

Definition at line 228 of file Vector2.h.

◆ operator+()

template<typename T >
 Vector2< T > operator+ ( Vector2< T > lhs, const Vector2< T > & rhs )
related

Compute the sum of two vectors.

Parameters
 lhs First vector rhs Second vector
Returns
Sum of these two vectors

Definition at line 180 of file Vector2.h.

◆ operator-()

template<typename T >
 Vector2< T > operator- ( Vector2< T > lhs, const Vector2< T > & rhs )
related

Compute the difference of two vectors.

Parameters
 lhs First vector rhs Second vector
Returns
Difference of these two vectors

Definition at line 196 of file Vector2.h.

◆ operator<<()

template<typename T >
 std::ostream & operator<< ( std::ostream & os, const Vector2< T > & vec )
related

Insert a vector in a stream.

Parameters
 os Stream in which to insert the vector in vec Vector to insert in the stream
Returns
Stream after insertion

Definition at line 243 of file Vector2.h.

◆ x

template<typename T>
 T mygal::Vector2< T >::x

x-coordinate of the vector

Definition at line 50 of file Vector2.h.

◆ y

template<typename T>
 T mygal::Vector2< T >::y

y-coordinate of the vector

Definition at line 51 of file Vector2.h.

The documentation for this class was generated from the following file:
• /home/pierre/Programming/MyGAL/include/MyGAL/Vector2.h