summaryrefslogtreecommitdiff
path: root/src/common/geom.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/geom.c')
-rw-r--r--src/common/geom.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/common/geom.c b/src/common/geom.c
index 7abb422..219270f 100644
--- a/src/common/geom.c
+++ b/src/common/geom.c
@@ -1,5 +1,24 @@
1#include "common/geom.h" 1#include "common/geom.h"
2#include "morpher/matrix.h"
3
4CartesianMapping m(int x, int y) {
5 return (CartesianMapping) {{x, y},
6 {x, y}};
7}
8
9CartesianVector v(int x, int y) {
10 return (CartesianVector) {x, y};
11}
12
13bool mappings_equals(CartesianMapping m1, CartesianMapping m2) {
14 return vector_equals(m1.origin, m2.origin) && vector_equals(m1.target, m2.target);
15}
2 16
3bool vector_equals(CartesianVector v1, CartesianVector v2) { 17bool vector_equals(CartesianVector v1, CartesianVector v2) {
4 return v1.x == v2.x && v1.y == v2.y; 18 return v1.x == v2.x && v1.y == v2.y;
5} 19}
20
21IntVector triangle_area(CartesianVector v1, CartesianVector v2, CartesianVector v3) {
22 return matrix_int_det2(v1.x - v3.x, v2.x - v3.x,
23 v1.y - v3.y, v2.y - v3.y);
24}