PERRY v1.0.0
P-E-R-R-Y/PERRY helps creating games with a bunch of tools.
Loading...
Searching...
No Matches
extra

Classes

class  Matrice< T >
 

Functions

 Matrice< T >::Matrice (int rows, int cols)
 Construct a new Matrice object.
 
 Matrice< T >::Matrice (const std::vector< std::vector< T > > &grid)
 Construct a new Matrice object.
 
T & Matrice< T >::operator() (int row, int col)
 get the value of the matrix at the given row and column
 
const T & Matrice< T >::operator() (int row, int col) const
 get the unmutable value of the matrix at the given row and column
 
Matrice< T > Matrice< T >::operator= (const Matrice< T > &other)
 copy constructor
 
int Matrice< T >::getRows () const
 Get the Rows object.
 
int Matrice< T >::getCols () const
 Get the Cols object.
 
void Matrice< T >::print () const
 Print the matrix.
 
template<typename T>
Matrice< T > operator* (const Matrice< T > &a, const Matrice< T > &b)
 Define the multiplication operator for matrix multiplication.
 
sf::Vector3f crossProduct (sf::Vector3f a, sf::Vector3f b)
 cross product of two vectors gives you a new vector that is perpendicular to both input vectors
 
sf::Vector3f normaliseV3f (const sf::Vector3f &vec)
 convert a vector to a unit vector
 
float dotProduct (sf::Vector3f a, sf::Vector3f b)
 give an idea about how much two vectors are aligned
 
sf::Vector3f viewFromUp (const sf::Vector3f up)
 viewFromUp will return a view vector based on the up vector
 

Variables

std::vector< std::vector< T > > Matrice< T >::data
 
int Matrice< T >::rows
 
int Matrice< T >::cols
 

Detailed Description

Function Documentation

◆ crossProduct()

sf::Vector3f crossProduct ( sf::Vector3f a,
sf::Vector3f b )

cross product of two vectors gives you a new vector that is perpendicular to both input vectors

Parameters
a
b
Returns
sf::Vector3f

◆ dotProduct()

float dotProduct ( sf::Vector3f a,
sf::Vector3f b )

give an idea about how much two vectors are aligned

  • If the dot product is positive, the vectors point in roughly the same direction.
  • If the dot product is zero, the vectors are perpendicular (at a 90° angle to each other).
  • If the dot product is negative, the vectors point in opposite directions.

need to normalize the vectors before using the dot product

Parameters
a
b
Returns
float

◆ getCols()

template<typename T>
int Matrice< T >::getCols ( ) const
inline

Get the Cols object.

Returns
int

◆ getRows()

template<typename T>
int Matrice< T >::getRows ( ) const
inline

Get the Rows object.

Returns
int

◆ Matrice() [1/2]

template<typename T>
Matrice< T >::Matrice ( const std::vector< std::vector< T > > & grid)
inline

Construct a new Matrice object.

Parameters
grid

◆ Matrice() [2/2]

template<typename T>
Matrice< T >::Matrice ( int rows,
int cols )
inline

Construct a new Matrice object.

Parameters
rows
cols

◆ normaliseV3f()

sf::Vector3f normaliseV3f ( const sf::Vector3f & vec)

convert a vector to a unit vector

Parameters
vec
Returns
sf::Vector3f

◆ operator()() [1/2]

template<typename T>
T & Matrice< T >::operator() ( int row,
int col )
inline

get the value of the matrix at the given row and column

Parameters
row
col
Returns
T&

◆ operator()() [2/2]

template<typename T>
const T & Matrice< T >::operator() ( int row,
int col ) const
inline

get the unmutable value of the matrix at the given row and column

Parameters
row
col
Returns
const T&

◆ operator*()

template<typename T>
Matrice< T > operator* ( const Matrice< T > & a,
const Matrice< T > & b )

Define the multiplication operator for matrix multiplication.

Template Parameters
T
Parameters
a
b
Returns
Matrice<T>

◆ operator=()

template<typename T>
Matrice< T > Matrice< T >::operator= ( const Matrice< T > & other)
inline

copy constructor

Parameters
other
Returns
Matrice<T>

◆ viewFromUp()

sf::Vector3f viewFromUp ( const sf::Vector3f up)

viewFromUp will return a view vector based on the up vector

Parameters
up
Returns
sf::Vector3f