]> git.lizzy.rs Git - nothing.git/blob - src/math/point.h
Merge pull request #664 from tsoding/658
[nothing.git] / src / math / point.h
1 #ifndef POINT_H_
2 #define POINT_H_
3
4 #include "math/mat3x3.h"
5 #include "math/pi.h"
6
7 typedef struct Point {
8     float x, y;
9 } Point;
10
11 typedef Point Vec;
12
13 Vec vec(float x, float y);
14 Vec vec_from_polar(float arg, float mag);
15 Vec vec_from_ps(Point p1, Point p2);
16
17 float vec_arg(Vec v);
18 float vec_mag(Vec v);
19
20 float rad_to_deg(float a);
21
22 Vec vec_sum(Vec v1, Vec v2);
23 Vec vec_sub(Vec v1, Vec v2);
24 Vec vec_neg(Vec v);
25 void vec_add(Vec *v1, Vec v2);
26 float vec_length(Vec v);
27 float vec_sqr_norm(Vec v);
28 Vec vec_scala_mult(Vec v, float scalar);
29 Vec vec_entry_mult(Vec v1, Vec v2);
30 Vec vec_entry_div(Vec v1, Vec v2);
31 Vec vec_norm(Vec v);
32
33 Point point_mat3x3_product(Point p, mat3x3 m);
34
35 #endif  // POINT_H_