60 lines
699 B
C
60 lines
699 B
C
#ifndef LINALG_H
|
|
#define LINALG_H
|
|
|
|
typedef struct {
|
|
double x;
|
|
double y;
|
|
double z;
|
|
} f3;
|
|
|
|
typedef struct {
|
|
double xx;
|
|
double xy;
|
|
double xz;
|
|
double yx;
|
|
double yy;
|
|
double yz;
|
|
double zx;
|
|
double zy;
|
|
double zz;
|
|
} f3x3;
|
|
|
|
typedef struct {
|
|
double x;
|
|
double y;
|
|
} f2;
|
|
|
|
typedef struct {
|
|
double xx;
|
|
double xy;
|
|
double yx;
|
|
double yy;
|
|
} f2x2;
|
|
|
|
typedef struct {
|
|
f2 p0;
|
|
f2 p1;
|
|
f2 p2;
|
|
} f2x3;
|
|
|
|
typedef struct {
|
|
int x;
|
|
int y;
|
|
} i2;
|
|
|
|
typedef struct {
|
|
i2 p0;
|
|
i2 p1;
|
|
i2 p2;
|
|
} i2x3;
|
|
|
|
f2 f2_from_f3(f3 v);
|
|
i2 i2_from_f2(f2 v);
|
|
|
|
f3 add_f3(f3 l, f3 r);
|
|
|
|
f2 mul_f2_f2x2(f2 l, f2x2 r);
|
|
f3 mul_f3_f3x3(f3 l, f3x3 r);
|
|
|
|
#endif
|