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

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

#include <vec3.h>

Public Member Functions

 Vec3 (double newX=0, double newY=0, double newZ=0)
 Constructor that sets up a new zero vector. More...
 
 Vec3 (rune::Vec2)
 Construct a Vec3 from a Vec2 by dropping the z coordinate. More...
 
Vec3 operator- (const Vec3 &right)
 Overload of subtraction operator. More...
 
Vec3 operator- ()
 Overload of negation operator. More...
 
Vec3 operator+ (const Vec3 &right)
 Overload of addition operator. More...
 
Vec3 operator* (const Vec3 &right)
 Overload of multiplication operator. More...
 
Vec3 operator/ (const Vec3 &right)
 Overload of division operator. More...
 
Vec3 operator/ (double scalar)
 Overload of division operator for a scalar on the right. More...
 
Vec3operator-= (const Vec3 &right)
 Overload of -= operator. More...
 
Vec3operator+= (const Vec3 &right)
 Overload of += operator. More...
 
Vec3operator*= (const Vec3 &right)
 Overload of *= operator. More...
 
Vec3operator*= (const double right)
 Overload of *= operator for a scalar multiplier. More...
 
Vec3 operator* (double scalar)
 Overload of multiplication operator for a scalar on the right. More...
 
bool operator== (const Vec3 &right)
 Overload of comparator operator. More...
 
bool operator!= (const Vec3 &right)
 Overload of != operator. More...
 
double magnitude (void)
 Determine the magnitude of the vector. More...
 
std::ostream & operator<< (std::ostream &os, const rune::Vec3 &vector)
 
double dotProduct (const rune::Vec3 &vector1, const rune::Vec3 &vector2)
 
rune::Vec3 normalize (const rune::Vec3 &vector)
 
rune::Vec3 crossProduct (const rune::Vec3 &vec1, const rune::Vec3 &vec2)
 
rune::Vec3 operator* (double scalar, const rune::Vec3 &vec)
 

Public Attributes

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

Detailed Description

1 x 3 vector to be used for math.

Author
Thomas Montano
Date
May 21 2020

Constructor & Destructor Documentation

◆ Vec3() [1/2]

rune::Vec3::Vec3 ( double  newX = 0,
double  newY = 0,
double  newZ = 0 
)

Constructor that sets up a new zero vector.

Parameters
newXThe new X coordinate for the vector.
newYThe new Y coordinate for the vector.
newZThe new Z coordinate for the vector.

◆ Vec3() [2/2]

rune::Vec3::Vec3 ( rune::Vec2  castedVector)

Construct a Vec3 from a Vec2 by dropping the z coordinate.

Parameters
castedVectorThe vector to be converted to a rune::Vec2

Member Function Documentation

◆ crossProduct()

rune::Vec3 crossProduct ( const rune::Vec3 vec1,
const rune::Vec3 vec2 
)
Parameters
vec1The first vector to be used in the cross product.
vec2The second vector to be used in the cross product.
Returns
The result of the cross product.

◆ dotProduct()

double dotProduct ( const rune::Vec3 vector1,
const rune::Vec3 vector2 
)
Parameters
vector1The first vector of the dot product.
vector2The second vector of the dot product.
Returns
The result of the dot product.

◆ magnitude()

double rune::Vec3::magnitude ( void  )

Determine the magnitude of the vector.

Returns
The magnitude of the vector.

◆ normalize()

rune::Vec3 normalize ( const rune::Vec3 vector)
Parameters
vectorThe vector to be normalized.
Returns
A vector in the same direction as vector but with magnitude 1.

◆ operator!=()

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

Overload of != operator.

Parameters
rightThe vector to compare to.
Returns
Whether or not the vectors are member wise non equivalent.

◆ operator*() [1/3]

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

Overload of multiplication operator.

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

◆ operator*() [2/3]

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

Overload of multiplication operator for a scalar on the right.

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

◆ operator*() [3/3]

rune::Vec3 operator* ( double  scalar,
const rune::Vec3 vec 
)
Parameters
scalarThe scalar to be multiplied by.
vecThe matrix being multiplied with.
Returns
A member wise multiplication.

◆ operator*=() [1/2]

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

Overload of *= operator for a scalar multiplier.

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

◆ operator*=() [2/2]

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

Overload of *= operator.

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

◆ operator+()

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

Overload of addition operator.

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

◆ operator+=()

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

Overload of += operator.

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

◆ operator-() [1/2]

rune::Vec3 rune::Vec3::operator- ( )

Overload of negation operator.

Returns
The negative of the vector.

◆ operator-() [2/2]

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

Overload of subtraction operator.

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

◆ operator-=()

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

Overload of -= operator.

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

◆ operator/() [1/2]

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

Overload of division operator.

Parameters
rightThe vector to be divided by.
Returns
A member wise division.

◆ operator/() [2/2]

rune::Vec3 rune::Vec3::operator/ ( double  scalar)

Overload of division operator for a scalar on the right.

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

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const rune::Vec3 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::Vec3::operator== ( const Vec3 right)

Overload of comparator operator.

Parameters
rightThe vector to compare to.
Returns
Whether or not the vectors are member wise equivalent.

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