common_msgs/geometry_msgs/include/geometry_msgs/Quaternion.h
2025-12-04 15:11:15 +07:00

40 lines
852 B
C++

#ifndef QUATERNION_H
#define QUATERNION_H
#include "utils.h"
namespace geometry_msgs
{
struct Quaternion
{
double x;
double y;
double z;
double w;
// Constructor mặc định
Quaternion() : x(0.0), y(0.0), z(0.0), w(1.0) {}
// Constructor khởi tạo nhanh
Quaternion(double x_, double y_, double z_, double w_)
: x(x_), y(y_), z(z_), w(w_) {}
};
// constants requiring out of line definition
inline bool operator==(const geometry_msgs::Quaternion &lhs, const geometry_msgs::Quaternion &rhs)
{
return isEqual(lhs.x, rhs.x) &&
isEqual(lhs.y, rhs.y) &&
isEqual(lhs.z, rhs.z) &&
isEqual(lhs.w, rhs.w);
}
inline bool operator!=(const geometry_msgs::Quaternion &lhs, const geometry_msgs::Quaternion &rhs)
{
return !(lhs == rhs);
}
} // namespace geometry_msgs
#endif // QUATERNION_H