From c3aee6fb611942ac1f4edda14ce23201848fdd29 Mon Sep 17 00:00:00 2001 From: Valenza Florian <fvalenza@laas.fr> Date: Mon, 15 Feb 2016 17:55:08 +0100 Subject: [PATCH] Provide operator == in CollisionResult, CostSource and Contact --- include/hpp/fcl/collision_data.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/include/hpp/fcl/collision_data.h b/include/hpp/fcl/collision_data.h index eec9c36e..6f850d69 100644 --- a/include/hpp/fcl/collision_data.h +++ b/include/hpp/fcl/collision_data.h @@ -119,6 +119,17 @@ struct Contact return b2 < other.b2; return b1 < other.b1; } + + bool operator == (const Contact& other) const + { + return o1 == other.o1 + && o2 == other.o2 + && b1 == other.b1 + && b2 == other.b2 + && normal == other.normal + && pos == other.pos + && penetration_depth == other.penetration_depth; + } }; /// @brief Cost source describes an area with a cost. The area is described by an AABB region. @@ -169,6 +180,14 @@ struct CostSource return false; } + + bool operator == (const CostSource& other) const + { + return aabb_min == other.aabb_min + && aabb_max == other.aabb_max + && cost_density == other.cost_density + && total_cost == other.total_cost; + } }; struct CollisionResult; @@ -262,6 +281,14 @@ public: cost_sources.erase(--cost_sources.end()); } + /// @brief whether two CollisionResult are the same or not + inline bool operator ==(const CollisionResult& other) const + { + return contacts == other.contacts + && cost_sources == other.cost_sources + && distance_lower_bound == other.distance_lower_bound; + } + /// @brief return binary collision result bool isCollision() const { -- GitLab