Rune Engine  Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
rune::Vec2 Class Reference

1 x 2 vector to be used for math. More...

#include <vec2.h>

Public Member Functions

 Vec2 (double newX=0, double newY=0)
 Constructor that sets up a new vector. More...
 
Vec2 operator- (const Vec2 &right)
 Overload of subtraction operator. More...
 
Vec2 operator- ()
 Overload of negation operator. More...
 
Vec2 operator+ (const Vec2 &right)
 Overload of addition operator. More...
 
Vec2 operator* (const Vec2 &right)
 Overload of multiplication operator. More...
 
Vec2 operator/ (const Vec2 &right)
 Overload of division operator. More...
 
Vec2 operator/ (double scalar)
 Overload of division operator for a scalar on the right.
 
Vec2operator-= (const Vec2 &right)
 Overload of -= operator. More...
 
Vec2operator+= (const Vec2 &right)
 Overload of += operator. More...
 
Vec2operator*= (const Vec2 &right)
 Overload of *= operator. More...
 
Vec2operator*= (const double right)
 Overload of *= operator for a scalar multiplier. More...
 
Vec2 operator* (double scalar)
 Overload of * operator for a scalar multiplier. More...
 
bool operator== (const Vec2 &right)
 Overload of comparator operator. More...
 
bool operator!= (const Vec2 &right)
 Overload of != operator. More...
 
std::ostream & operator<< (std::ostream &os, const rune::Vec2 &vector)
 
rune::Vec2 operator* (double scalar, rune::Vec2 const &vec)
 
rune::Vec2 operator/ (double scalar, rune::Vec2 vec)
 
rune::Vec2 operator/ (double scalar)
 Overload of / operator for a scalar. More...
 
double dotProduct (rune::Vec2 const &v1, rune::Vec2 const &v2)
 
rune::Vec2 findNormal (rune::Vec2 const &axis)
 Find the left handed vector normal to a surface. More...
 
rune::Vec2 normalize (rune::Vec2 const &vector)
 
double crossProduct (rune::Vec2 const &vec1, rune::Vec2 const &vec2)
 

Public Attributes

double x
 X coordinate of the vector.
 
double y
 Y coordinate of the vector.
 

Detailed Description

1 x 2 vector to be used for math.

Author
Thomas Montano
Date
April 20 2020

Constructor & Destructor Documentation

◆ Vec2()

rune::Vec2::Vec2 ( double  newX = 0,
double  newY = 0 
)

Constructor that sets up a new vector.

Parameters
newXThe initial value for the X component.
newYThe initial value for the Y component.

Member Function Documentation

◆ crossProduct()

double crossProduct ( rune::Vec2 const &  vec1,
rune::Vec2 const &  vec2 
)
Parameters
vec1The first vector.
vec2The second vector.
Returns
The result of the cross product.

◆ dotProduct()

double dotProduct ( rune::Vec2 const &  v1,
rune::Vec2 const &  v2 
)
Parameters
v1First vector to be used in the dot product.
v2Seconds vector to be used in the dot product.
Returns
The result of the dot product calculation.

◆ findNormal()

rune::Vec2 findNormal ( rune::Vec2 const &  axis)

Find the left handed vector normal to a surface.

Parameters
axisThe axis that is used to find the normal.
Returns
The left handed vector that is normal to the provided surface.

◆ normalize()

rune::Vec2 normalize ( rune::Vec2 const &  vector)
Parameters
vectorVector that should be normalized.
Returns
Vector in the direction of vector but with magnitude of 1.

◆ operator!=()

bool rune::Vec2::operator!= ( const Vec2 right)

Overload of != operator.

Parameters
rightThe vector to be compared to.
Returns
Whether or not the two vectors are member wise inequivalent.

◆ operator*() [1/3]

rune::Vec2 rune::Vec2::operator* ( const Vec2 right)

Overload of multiplication operator.

Parameters
rightThe vector to multiply by.
Returns
A member wise multiplication.

◆ operator*() [2/3]

rune::Vec2 rune::Vec2::operator* ( double  scalar)

Overload of * operator for a scalar multiplier.

Parameters
scalarThe scalar to be multiplied with.
Returns
A member wise multiplication.

◆ operator*() [3/3]

rune::Vec2 operator* ( double  scalar,
rune::Vec2 const &  vec 
)
Parameters
scalarThe scalar to be multiplied with.
vecThe vector to be multiplied.
Returns
A member wise multiplication.

◆ operator*=() [1/2]

rune::Vec2 & rune::Vec2::operator*= ( const double  right)

Overload of *= operator for a scalar multiplier.

Parameters
rightThe scalar to be multiplied by.
Returns
A member wise multiplication.

◆ operator*=() [2/2]

rune::Vec2 & rune::Vec2::operator*= ( const Vec2 right)

Overload of *= operator.

Parameters
rightThe vector to be multiplied by.
Returns
A member wise multiplication.

◆ operator+()

rune::Vec2 rune::Vec2::operator+ ( const Vec2 right)

Overload of addition operator.

Parameters
rightThe vector to be added.
Returns
A member wise addition.

◆ operator+=()

rune::Vec2 & rune::Vec2::operator+= ( const Vec2 right)

Overload of += operator.

Parameters
rightThe vector to be added.
Returns
A member wise addition.

◆ operator-() [1/2]

rune::Vec2 rune::Vec2::operator- ( )

Overload of negation operator.

Returns
The member wise negative of the vector.

◆ operator-() [2/2]

rune::Vec2 rune::Vec2::operator- ( const Vec2 right)

Overload of subtraction operator.

Parameters
rightThe vector to be subtracter.
Returns
A member wise subtraction.

◆ operator-=()

rune::Vec2 & rune::Vec2::operator-= ( const Vec2 right)

Overload of -= operator.

Parameters
rightThe vector to be subtracted.
Returns
A member wise subtraction.

◆ operator/() [1/3]

rune::Vec2 rune::Vec2::operator/ ( const Vec2 right)

Overload of division operator.

Parameters
rightThe vector to divide by.
Returns
A member wise division.

◆ operator/() [2/3]

rune::Vec2 operator/ ( double  scalar)

Overload of / operator for a scalar.

Parameters
scalarThe scalar to be divided by.
Returns
A member wise division by the scalar.

◆ operator/() [3/3]

rune::Vec2 operator/ ( double  scalar,
rune::Vec2  vec 
)
Parameters
scalarThe scalar to be used as a divisor.
vecThe vector to be element wise divided by.
Returns
A member wise multiplication.

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const rune::Vec2 vector 
)
Parameters
osOutput stream that the vector should be printed to.
vectorVector to be printed.
Returns
Stream to be printed to the console.

◆ operator==()

bool rune::Vec2::operator== ( const Vec2 right)

Overload of comparator operator.

Parameters
rightThe vector to be compared to.
Returns
Whether or not the two vectors are member wise equivalent.

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