Dura2D  v0.1.0
An educational 2D game physics library
Loading...
Searching...
No Matches
d2VecN Struct Reference

Represents an N-dimensional vector. More...

#include <d2Math.h>

Public Member Functions

 d2VecN ()
 
 d2VecN (int N)
 Constructor that initializes the vector with given dimension.
 
 d2VecN (const d2VecN &v)
 Copy constructor.
 
 ~d2VecN ()
 
void Zero ()
 Sets all components of the vector to zero.
 
real Dot (const d2VecN &v) const
 Calculates the dot product with another vector.
 
d2VecNoperator= (const d2VecN &v)
 
d2VecN operator+ (const d2VecN &v) const
 
d2VecN operator- (const d2VecN &v) const
 
d2VecN operator* (const real n) const
 
const d2VecNoperator+= (const d2VecN &v)
 
const d2VecNoperator-= (const d2VecN &v)
 
const d2VecNoperator*= (const real n)
 
real operator[] (const int index) const
 
realoperator[] (const int index)
 

Public Attributes

int N
 The dimension of the vector.
 
realdata
 The data of the vector.
 

Detailed Description

Represents an N-dimensional vector.

Constructor & Destructor Documentation

◆ d2VecN() [1/3]

d2VecN::d2VecN ( )

◆ d2VecN() [2/3]

d2VecN::d2VecN ( int N)

Constructor that initializes the vector with given dimension.

Parameters
NThe dimension of the vector.

◆ d2VecN() [3/3]

d2VecN::d2VecN ( const d2VecN & v)

Copy constructor.

Parameters
vThe vector to copy from.

◆ ~d2VecN()

d2VecN::~d2VecN ( )

Member Function Documentation

◆ Dot()

real d2VecN::Dot ( const d2VecN & v) const

Calculates the dot product with another vector.

Parameters
vThe other vector.
Returns
The dot product.

◆ operator*()

d2VecN d2VecN::operator* ( const real n) const

◆ operator*=()

const d2VecN & d2VecN::operator*= ( const real n)

◆ operator+()

d2VecN d2VecN::operator+ ( const d2VecN & v) const

◆ operator+=()

const d2VecN & d2VecN::operator+= ( const d2VecN & v)

◆ operator-()

d2VecN d2VecN::operator- ( const d2VecN & v) const

◆ operator-=()

const d2VecN & d2VecN::operator-= ( const d2VecN & v)

◆ operator=()

d2VecN & d2VecN::operator= ( const d2VecN & v)

◆ operator[]() [1/2]

real & d2VecN::operator[] ( const int index)

◆ operator[]() [2/2]

real d2VecN::operator[] ( const int index) const

◆ Zero()

void d2VecN::Zero ( )

Sets all components of the vector to zero.

Member Data Documentation

◆ data

real* d2VecN::data

The data of the vector.

◆ N

int d2VecN::N

The dimension of the vector.


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