simplevectors  0.3.9
Simple vector implementations in C++
Public Member Functions | Public Attributes | List of all members
svector::Vec2D Struct Reference

A minimal 2D vector representation. More...

#include <embed.hpp>

Public Member Functions

 Vec2D ()
 No-argument constructor. More...
 
 Vec2D (const double xOther, const double yOther)
 Initializes a vector given xy components. More...
 
 Vec2D (const Vec2D &other)=default
 Copy constructor.
 
 Vec2D (Vec2D &&) noexcept=default
 Move constructor. More...
 
Vec2Doperator= (const Vec2D &other)
 Assignment operator.
 
Vec2Doperator= (Vec2D &&) noexcept=default
 Move assignment operator. More...
 
virtual ~Vec2D ()=default
 Destructor. More...
 
Vec2Doperator+= (const Vec2D &other)
 In-place addtion. More...
 
Vec2Doperator-= (const Vec2D &other)
 In-place subtraction. More...
 
Vec2Doperator*= (const double &other)
 In-place scalar multiplication. More...
 
Vec2Doperator/= (const double &other)
 In-place scalar division. More...
 

Public Attributes

double x
 The x-component of the 2D vector.
 
double y
 The y-component of the 2D vector.
 

Detailed Description

A minimal 2D vector representation.

Constructor & Destructor Documentation

◆ Vec2D() [1/3]

svector::Vec2D::Vec2D ( )
inline

No-argument constructor.

Initializes a zero vector.

◆ Vec2D() [2/3]

svector::Vec2D::Vec2D ( const double  xOther,
const double  yOther 
)
inline

Initializes a vector given xy components.

Parameters
xOtherThe x-component.
yOtherThe y-component.

◆ Vec2D() [3/3]

svector::Vec2D::Vec2D ( Vec2D &&  )
defaultnoexcept

Move constructor.

Uses C++ default move constructor.

◆ ~Vec2D()

virtual svector::Vec2D::~Vec2D ( )
virtualdefault

Destructor.

Uses C++ default destructor.

Member Function Documentation

◆ operator*=()

Vec2D& svector::Vec2D::operator*= ( const double &  other)
inline

In-place scalar multiplication.

Performs scalar multiplication on the current object.

Parameters
otherThe number to multiply by.

◆ operator+=()

Vec2D& svector::Vec2D::operator+= ( const Vec2D other)
inline

In-place addtion.

Adds another vector object to current vector.

Parameters
otherThe other object to add.

◆ operator-=()

Vec2D& svector::Vec2D::operator-= ( const Vec2D other)
inline

In-place subtraction.

Subtracts another vector object from current vector.

Parameters
otherThe other object to subtract.

◆ operator/=()

Vec2D& svector::Vec2D::operator/= ( const double &  other)
inline

In-place scalar division.

Performs scalar division on the current object.

Parameters
otherThe number to divide by.

◆ operator=()

Vec2D& svector::Vec2D::operator= ( Vec2D &&  )
defaultnoexcept

Move assignment operator.

Uses C++ default move assignment operator.


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