From da86056179506d70d329e3482f1b4178cf8ab611 Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 2 Dec 2017 15:49:49 +0100 Subject: Add vector cmp. func. Signed-off-by: pacien --- include/common/geom.h | 14 ++++++++++++++ src/common/geom.c | 5 +++++ 2 files changed, 19 insertions(+) create mode 100644 src/common/geom.c diff --git a/include/common/geom.h b/include/common/geom.h index 15a1d57..4445998 100644 --- a/include/common/geom.h +++ b/include/common/geom.h @@ -5,6 +5,7 @@ * File: geom.h */ +#include #include /** @@ -29,4 +30,17 @@ typedef struct { CartesianVector origin, target; } CartesianMapping; +/** + * Function: vector_equals + * Compares two cartesian vectors. + * + * Parameters: + * v1 - the first vector + * v2 - the second vector + * + * Returns: + * T(v1 is equal to v2) + */ +bool vector_equals(CartesianVector v1, CartesianVector v2); + #endif diff --git a/src/common/geom.c b/src/common/geom.c new file mode 100644 index 0000000..7abb422 --- /dev/null +++ b/src/common/geom.c @@ -0,0 +1,5 @@ +#include "common/geom.h" + +bool vector_equals(CartesianVector v1, CartesianVector v2) { + return v1.x == v2.x && v1.y == v2.y; +} -- cgit v1.2.3