From e8885c1843d629bd72b9f469bb2d5b561adcbfad Mon Sep 17 00:00:00 2001 From: pFernbach <pierre.fernbach@gmail.com> Date: Wed, 15 Jan 2020 16:02:11 +0100 Subject: [PATCH] [C++] waypoint : add size() and == methods --- include/hpp/bezier-com-traj/utils.hh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/hpp/bezier-com-traj/utils.hh b/include/hpp/bezier-com-traj/utils.hh index 01239a1..aaf39f4 100644 --- a/include/hpp/bezier-com-traj/utils.hh +++ b/include/hpp/bezier-com-traj/utils.hh @@ -33,6 +33,16 @@ struct waypoint_t { waypoint_t(MatrixXX A, VectorX b) : first(A), second(b) {} static waypoint_t Zero(size_t dim) { return initwp(dim, dim); } + + size_t size() const{return second.size();} + + bool isApprox(const waypoint_t& other, const value_type prec = Eigen::NumTraits<value_type>::dummy_precision()) const{ + return first.isApprox(other.first,prec) && second.isApprox(other.second,prec); + } + + bool operator==(const waypoint_t& other) const{ return isApprox(other); } + + bool operator!=(const waypoint_t& other) const{ return !(*this == other); } }; /** -- GitLab