From 4f08cd2587f2c69d0287051950dd7a8c461a8662 Mon Sep 17 00:00:00 2001 From: HiroIshida Date: Wed, 5 Jun 2024 02:03:19 +0900 Subject: [PATCH] refactor: arithmatic operation must be const --- urdf_parser/include/urdf_model/pose.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/urdf_parser/include/urdf_model/pose.h b/urdf_parser/include/urdf_model/pose.h index ae62525..691a96e 100644 --- a/urdf_parser/include/urdf_model/pose.h +++ b/urdf_parser/include/urdf_model/pose.h @@ -97,17 +97,17 @@ class Vector3 this->z *= -1; } - Vector3 operator+(const Vector3& vec) + Vector3 operator+(const Vector3& vec) const { return Vector3(this->x+vec.x,this->y+vec.y,this->z+vec.z); }; - Vector3 operator-(const Vector3& vec) + Vector3 operator-(const Vector3& vec) const { return Vector3(this->x-vec.x,this->y-vec.y,this->z-vec.z); }; - Vector3 operator/(double deno) + Vector3 operator/(double deno) const { return Vector3(this->x/deno,this->y/deno,this->z/deno); }; @@ -298,7 +298,7 @@ class Rotation return q; }; - Rotation inverse(){ + Rotation inverse() const{ double norm = this->w*this->w+this->x*this->x+this->y*this->y+this->z*this->z; return Rotation(-x/norm, -y/norm, -z/norm, w/norm); } @@ -332,7 +332,7 @@ class Pose this->position = this->rotation * this->position; } - Pose inverse(){ + Pose inverse() const{ Pose pose_out = *this; pose_out.inverse_inplace(); return pose_out;