Melee Modding Library
2.0.0
A C library for modding Super Smash Bros Melee
|
Support for matrix and vector operations. More...
#include "gctypes.h"
Go to the source code of this file.
Data Structures | |
struct | Vector |
A vector of 32-bit floating-point values. More... | |
struct | Matrix |
A matrix of 32-bit floating-point values. More... | |
Macros | |
#define | ROW_VECTOR(mat, ndx) ((Vector) {mat.data[ndx], mat.nCol}) |
Functions | |
bool | initVector (Vector *vec, size_t size) |
Initialize a Vector. More... | |
bool | initMatrix (Matrix *mat, size_t numRows, size_t numCols) |
Initialize a matrix. More... | |
void | populateVec (Vector *vec, void *func) |
Populate the values in a vector. More... | |
void | populateMat (Matrix *mat, void *func) |
Populate the values in a matrix. More... | |
void | matrixVectorProduct (Vector *y, const Matrix *A, const Vector *x) |
Multiplication of the form y = Ax More... | |
float | vectorDotProd (const Vector *u, const Vector *v) |
Calculates the dot product of two vectors. More... | |
Variables | |
bool | _matrixError |
Set to true when a error occurs in a matrix operation. | |
Support for matrix and vector operations.
struct Vector |
A vector of 32-bit floating-point values.
Data Fields | ||
---|---|---|
float * | data |
array of floating-point values |
size_t | size |
size of |
struct Matrix |
#define ROW_VECTOR | ( | mat, | |
ndx | |||
) | ((Vector) {mat.data[ndx], mat.nCol}) |
Extract a row from mat
as a Vector
struct
void populateVec | ( | Vector * | vec, |
void * | func | ||
) |
Populate the values in a vector.
This function populates each element in the vector based on func
. Element n
will be equal to func(n)
.
vec | - pointer to a Vector struct |
func | - pointer to a function of the form float foo(u32) |
void populateMat | ( | Matrix * | mat, |
void * | func | ||
) |
Populate the values in a matrix.
This function populates each element in the matrix based on func
. The element at [row][col]
will be equal to func(row, col)
.
mat | - pointer to a Matrix struct |
func | - pointer to a function of the form float foo(u32, u32) |
Multiplication of the form y = Ax
This function multiplies Ax
and stores the result in y
.
Calculates the dot product of two vectors.
u
and v
.