TBTK
Need a break? Support the development by playing Polarity Puzzles
TBTK::Vector2d Class Reference

Public Member Functions

 Vector2d ()
 
 Vector2d (std::initializer_list< double > components)
 
 Vector2d (const std::vector< double > &components)
 
const Vector2d operator+ (const Vector2d &rhs) const
 
const Vector2d operator- (const Vector2d &rhs) const
 
const Vector2d operator- () const
 
const Vector2d operator* (double rhs) const
 
const Vector2d operator/ (double rhs) const
 
const Vector2d unit () const
 
const Vector2d perpendicular (const Vector2d &v) const
 
const Vector2d parallel (const Vector2d &v) const
 
double norm () const
 
const std::vector< double > getStdVector () const
 

Static Public Member Functions

static double dotProduct (const Vector2d &lhs, const Vector2d &rhs)
 

Public Attributes

double x
 
double y
 

Friends

const Vector2d operator* (double lhs, const Vector2d &rhs)
 
std::ostream & operator<< (std::ostream &stream, const Vector2d &v)
 

Constructor & Destructor Documentation

◆ Vector2d() [1/3]

TBTK::Vector2d::Vector2d ( )

Constructor.

◆ Vector2d() [2/3]

TBTK::Vector2d::Vector2d ( std::initializer_list< double >  components)

Constructor.

◆ Vector2d() [3/3]

TBTK::Vector2d::Vector2d ( const std::vector< double > &  components)

Constructor.

Member Function Documentation

◆ dotProduct()

double TBTK::Vector2d::dotProduct ( const Vector2d lhs,
const Vector2d rhs 
)
inlinestatic

Dot product.

◆ getStdVector()

const std::vector< double > TBTK::Vector2d::getStdVector ( ) const
inline

Get a std::vector<double> representation of the vector.

◆ norm()

double TBTK::Vector2d::norm ( ) const
inline

Norm.

◆ operator*()

const Vector2d TBTK::Vector2d::operator* ( double  rhs) const
inline

Multiplication operator (vector*scalar).

◆ operator+()

const Vector2d TBTK::Vector2d::operator+ ( const Vector2d rhs) const
inline

Addition operator.

◆ operator-() [1/2]

const Vector2d TBTK::Vector2d::operator- ( const Vector2d rhs) const
inline

Subtraction operator.

◆ operator-() [2/2]

const Vector2d TBTK::Vector2d::operator- ( ) const
inline

Inversion operator.

◆ operator/()

const Vector2d TBTK::Vector2d::operator/ ( double  rhs) const
inline

Division operator.

◆ parallel()

const Vector2d TBTK::Vector2d::parallel ( const Vector2d v) const
inline

Returns a vector that is the component of the vector that is parallel to the argument.

◆ perpendicular()

const Vector2d TBTK::Vector2d::perpendicular ( const Vector2d v) const
inline

Returns a vector that is the component of the vector that is perpendicular to the argument.

◆ unit()

const Vector2d TBTK::Vector2d::unit ( ) const
inline

Returns a unit vector pointing in the same direction as the original vector.

Friends And Related Function Documentation

◆ operator*

const Vector2d operator* ( double  lhs,
const Vector2d rhs 
)
friend

Multiplication operator (scalar*vector).

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
const Vector2d v 
)
friend

operator<< for ostream.

Member Data Documentation

◆ x

double TBTK::Vector2d::x

x-component.

◆ y

double TBTK::Vector2d::y

y-component.


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