From 71ebb4afbf014582a4ecba2f4c4af8deaf56d061 Mon Sep 17 00:00:00 2001 From: Simon Rasmussen Date: Wed, 1 Mar 2017 12:39:25 +0100 Subject: [PATCH] Added equality operators for vector types --- include/ur_modern_driver/types.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/include/ur_modern_driver/types.h b/include/ur_modern_driver/types.h index 8c51443..86d3a24 100644 --- a/include/ur_modern_driver/types.h +++ b/include/ur_modern_driver/types.h @@ -2,11 +2,21 @@ #include -typedef struct { +struct double3_t { double x, y, z; -} double3_t; +}; -typedef struct { +struct cartesian_coord_t { double3_t position; double3_t rotation; -} cartesian_coord_t; \ No newline at end of file +}; + +inline bool operator==(const double3_t& lhs, const double3_t& rhs) +{ + return lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z; +} + +inline bool operator==(const cartesian_coord_t& lhs, const cartesian_coord_t& rhs) +{ + return lhs.position == rhs.position && lhs.rotation == rhs.rotation; +} \ No newline at end of file