olp-cpp-sdk  1.22.0
Public Member Functions | Public Attributes | List of all members
olp::math::Vector2< T > Struct Template Reference

Represents 2D vectors and points. More...

#include <Vector.h>

Public Member Functions

 Vector2 (T a, T b)
 Creates a Vector2 instance with the given X and Y components. More...
 
Vector2< T > & operator= (Vector2< T > const &v)
 Assigns components of one vector to another vector. More...
 
Vector2< T > operator* (T const &s) const
 Multiplies each vector component by a number. More...
 
Vector2< T > operator- ()
 Negates the vector.
 
Vector2< T > operator- (Vector2< T > const &v) const
 Subtracts one vector from another. More...
 
Vector2< T > operator+ (Vector2< T > const &v) const
 Adds corresponding components of two vectors. More...
 

Public Attributes

x
 The X component of the vector.
 
y
 The Y component of the vector.
 

Detailed Description

template<typename T>
struct olp::math::Vector2< T >

Represents 2D vectors and points.

Constructor & Destructor Documentation

◆ Vector2()

template<typename T >
olp::math::Vector2< T >::Vector2 ( a,
b 
)
inline

Creates a Vector2 instance with the given X and Y components.

Parameters
aThe X component of the vector.
bThe Y component of the vector.

Member Function Documentation

◆ operator*()

template<typename T >
Vector2<T> olp::math::Vector2< T >::operator* ( T const &  s) const
inline

Multiplies each vector component by a number.

Parameters
sThe number to multiply by.

◆ operator+()

template<typename T >
Vector2<T> olp::math::Vector2< T >::operator+ ( Vector2< T > const &  v) const
inline

Adds corresponding components of two vectors.

Parameters
vThe vector to add.

◆ operator-()

template<typename T >
Vector2<T> olp::math::Vector2< T >::operator- ( Vector2< T > const &  v) const
inline

Subtracts one vector from another.

Parameters
vThe vector to substruct from.

◆ operator=()

template<typename T >
Vector2<T>& olp::math::Vector2< T >::operator= ( Vector2< T > const &  v)
inline

Assigns components of one vector to another vector.

Parameters
vThe vector to take components from.

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