Skip to content

Commit

Permalink
refactor: arithmatic operation must be const
Browse files Browse the repository at this point in the history
  • Loading branch information
HiroIshida committed Jun 4, 2024
1 parent 9d8d208 commit 4f08cd2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions urdf_parser/include/urdf_model/pose.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4f08cd2

Please sign in to comment.