/usr/include/urg/Position.h is in liburg0-dev 0.8.18-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | #ifndef QRK_POSITION_H
#define QRK_POSITION_H
/*!
\file
\brief �ʒu(���W�ƌ���)�̌^��`
���W�ƌ������Ǘ�����
\author Satofumi KAMIMURA
$Id: Position.h 1811 2010-04-30 16:12:05Z satofumi $
*/
#include "Angle.h"
#include <iostream>
namespace qrk
{
/*!
\brief �ʒu
*/
template<class T>
class Position
{
public:
T x; //!< X �ʒu
T y; //!< Y �ʒu
Angle angle; //!< �p�x
Position(void) : x(0), y(0)
{
}
Position(const Position& rhs) : x(rhs.x), y(rhs.y), angle(rhs.angle)
{
}
Position(T x_, T y_, const Angle& angle_) : x(x_), y(y_), angle(angle_)
{
}
int to_deg(void) const
{
return angle.to_deg();
}
double to_rad(void) const
{
return angle.to_rad();
}
bool operator == (const Position& rhs) const
{
if ((this->x == rhs.x) && (this->y == rhs.y) &&
(this->angle.to_rad() == rhs.angle.to_rad())) {
return true;
} else {
return false;
}
}
Position& operator = (const Position<T>& rhs)
{
this->x = rhs.x;
this->y = rhs.y;
this->angle = rhs.angle;
return *this;
}
Position<T>& operator += (const Position<T>& rhs)
{
this->x += rhs.x;
this->y += rhs.y;
this->angle += rhs.angle;
return *this;
}
const Position<T> operator + (const Position<T>& rhs) const
{
return Position<T>(*this) += rhs;
}
Position<T>& operator -= (const Position<T>& rhs)
{
this->x -= rhs.x;
this->y -= rhs.y;
this->angle -= rhs.angle;
return *this;
}
const Position<T> operator - (const Position<T>& rhs) const
{
return Position<T>(*this) -= rhs;
}
Position<T>& operator *= (const T& rhs)
{
this->x *= rhs;
this->y *= rhs;
this->angle *= rhs;
return *this;
}
Position<T> operator * (const T& rhs) const
{
Position<T> ret(*this);
return ret *= rhs;
}
friend const Position<T> operator * (const T& lhs,
const Position<T>& rhs)
{
return Position<T>(rhs) * lhs;
}
friend std::ostream& operator << (std::ostream& out,
const Position<T>& rhs)
{
out << '(' << rhs.x << ", " << rhs.y
<< ", deg(" << rhs.angle.to_deg() << "))";
return out;
}
};
}
#endif /* !QRK_POSITION_H */
|