-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmatrix2.h
56 lines (51 loc) · 1.92 KB
/
matrix2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef DOUBLE_MATRIX
#define DOUBLE_MATRIX 1
typedef struct Matrix{
double *matrix;
int numRows;
int numCols;
} Matrix;
void swapRows(Matrix *,int,int);
void addRow(Matrix *,int ,int ,double );
void subtractRow(Matrix *matrix,int differenceRow,int subtractedRow,double scalar);
void scalarMultiplyRow(Matrix *matrix,int row,double scalar);
Matrix *createMatrix(int rows, int cols);
void solveMatrix(Matrix *m);
char inPlaceTranspose(Matrix *m);
char inPlaceSum(Matrix *,Matrix *);
char inPlaceDifference(Matrix *,Matrix*);
char inPlaceInverse(Matrix *);
void freeMatrix(Matrix *m);
void toPoint(Matrix *m);
void toVector(Matrix *m);
void inPlaceScalarMultiply(Matrix *,double);
void printMatrix(Matrix *);
//Matrix operations, sum, product, inverse
char placeProductMatrix(Matrix *,Matrix *,Matrix *);
Matrix *getProductMatrix(Matrix *m1,Matrix *m2);
void placeInverseMatrix(Matrix *, Matrix *);
Matrix *getInverseMatrix(Matrix *m1);
Matrix *getSumMatrix(Matrix *m1,Matrix *m2);
//Matrix generation.
Matrix *matrixCopy(Matrix *);
Matrix *point4(double x,double y,double z);
Matrix *vec4(double x,double y,double z);
Matrix *identityMatrix(int size);
Matrix *getScalarMultipleMatrix(Matrix *,double);
/**Set a vector to the following dimensions*/
void setVec4(Matrix *,double, double, double);
void setPoint4(Matrix *,double, double, double);
//Affine transformation matricies.
Matrix *scaleMatrix(double sX,double sY,double sZ);
Matrix *translationMatrix(double,double,double);
void placeMatrixCopy(Matrix *,Matrix *);
void placeScaleMatrix(double, double, double, Matrix *);
void placeTranslationMatrix(double,double,double,Matrix *);
void placeRotation_Y_Matrix(Matrix *,double);
void placeRotation_X_Matrix(Matrix *,double);
void placeVec4(Matrix *,double,double,double);
void placePoint4(Matrix *,double,double,double);
void placeScalarMultipleMatrix(Matrix *m,Matrix *m2,double scalar);
//Vector functions
double dotProduct(Matrix *,Matrix*);
#endif