Develop and Download Open Source Software

Browse Subversion Repository

Contents of /common/GridTypes.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 373 - (show annotations) (download) (as text)
Tue Dec 9 11:32:24 2008 UTC (15 years, 4 months ago) by satofumi
File MIME type: text/x-chdr
File size: 2643 byte(s)
urg.lib がコンパイルできるように調整
1 #ifndef GRID_TYPES_H
2 #define GRID_TYPES_H
3
4 /*!
5 \file
6 \brief グリッド型の定義
7
8 \author Satofumi KAMIMURA
9
10 $Id$
11 */
12
13
14 namespace beego {
15 /*!
16 \brief 角度クラス
17 */
18 class Angle {
19 double radian;
20
21 friend Angle deg(const double degree);
22 friend Angle rad(const double radian);
23
24 public:
25 Angle(void);
26 Angle(const Angle& rhs);
27 Angle& operator = (const Angle& rhs);
28 ~Angle(void);
29
30 double to_rad(void) const;
31 double to_deg(void) const;
32 };
33
34
35 /*!
36 \brief 2次元位置
37 */
38 template<class T> class Grid {
39 public:
40 T x;
41 T y;
42
43 Grid(void) : x(0), y(0) {
44 }
45
46 Grid(const Grid& rhs) : x(rhs.x), y(rhs.y) {
47 }
48
49 Grid& operator = (const Grid& rhs) {
50 this->x = rhs.x;
51 this->y = rhs.y;
52
53 return *this;
54 }
55
56 Grid(const T x, const T y) : x(x), y(y) {
57 }
58
59 ~Grid(void) {
60 }
61 };
62
63
64 /*!
65 \brief 2次元の位置、向き
66 */
67 template<class T> class Position {
68 public:
69 T x;
70 T y;
71 Angle angle;
72
73 Position(void) : x(0), y(0) {
74 }
75
76 Position(const int x, const int y, const Angle angle)
77 : x(x), y(y), angle(angle) {
78 }
79
80 Position(const Position& rhs) : x(rhs.x), y(rhs.y), angle(rhs.angle) {
81 }
82
83 Position& operator = (const Position& rhs) {
84 this->x = rhs.x;
85 this->y = rhs.y;
86 this->angle = rhs.angle;
87
88 return *this;
89 }
90
91 ~Position(void) {
92 }
93 };
94
95
96 /*!
97 \brief 3次元位置
98 */
99 template<class T> class Grid3D {
100 public:
101 T x;
102 T y;
103 T z;
104
105 Grid3D(void) : x(0), y(0), z(0) {
106 }
107
108 Grid3D(const Grid3D& rhs) : x(rhs.x), y(rhs.y), z(rhs.z) {
109 }
110
111 Grid3D& operator = (const Grid3D& rhs) {
112 this->x = rhs.x;
113 this->y = rhs.y;
114 this->z = rhs.z;
115
116 return *this;
117 }
118
119 ~Grid3D(void) {
120 }
121 };
122
123 /*!
124 \brief degree 角度の変換
125
126 \param degree [i] degree 角度
127 \return Angle 角度
128 */
129 extern Angle deg(const double degree);
130
131 /*!
132 \brief radian 角度の変換
133
134 \param radian [i] radian 角度
135 \return Angle 角度
136 */
137 extern Angle rad(const double radian);
138
139
140 /*!
141 \brief 2次元位置、向きの代入
142 */
143 template<class T> void set_Position(Position<T>* obj, T x, T y,
144 const Angle& angle) {
145 obj->x = x;
146 obj->y = y;
147 obj->angle = angle;
148 }
149
150
151 /*!
152 \brief 2次元位置の代入
153 */
154 template<class T> void set_Grid(Grid<T>* obj, T x, T y) {
155 obj->x = x;
156 obj->y = y;
157 }
158
159
160 /*!
161 \brief 3次元位置の代入
162 */
163 template<class T> void set_Grid3D(Grid3D<T>* obj, T x, T y, T z) {
164 obj->x = x;
165 obj->y = y;
166 obj->z = z;
167 }
168 };
169
170 #endif /* !GRID_TYPES_H */

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26