DI-Guy C++ SDK Reference  13.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguy_vector_classes.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2014 VT MAK
4  ** All rights reserved.
5  *********************************************************************/
6 
7 /*********************************************************************
8  **
9  *t DI-Guy Vector Classes
10  **
11  *b Link against: libdiguy
12  */
13 
14 #ifndef __diguy_vector_classes_H
15 #define __diguy_vector_classes_H
16 
17 #ifdef SWIG
18 %module diguyVec3f
19 #else
20 #define CPLUSPLUS_ONLY
21 #endif
22 
23 #ifdef CPLUSPLUS_ONLY
24 #include <declspec_diguy.h>
25 class diguyVec4f;
26 #endif
27 
28 
29 /****************************************************************************/
30 /*
31  * diguyVec2f
32  */
33 /****************************************************************************/
34 
35 class BDI_DECLSPEC_diguy diguyVec2f
36 {
37 
38 public:
39 
40  inline diguyVec2f() {x = y = 0.0f;}
41  inline diguyVec2f(float new_x) {x = y = new_x;}
42  inline diguyVec2f(float new_x, float new_y) {x = new_x; y = new_y;}
43 
44  inline float _x() {return x;}
45  inline float _y() {return y;}
46 
47  inline float _azimuth() {return azimuth;}
48  inline float _elevation() {return elevation;}
49 
50  /*
51  * Data members. See the comment in diguyVec3f regarding the use of
52  * unions.
53  */
54 #ifdef CPLUSPLUS_ONLY
55 
56  union {
57  float x;
58  float azimuth;
59  };
60 
61  union {
62  float y;
63  float elevation;
64  };
65 
66 #endif
67 };
68 
69 
70 
71 /****************************************************************************/
72 /*
73  * diguyVec3f
74  */
75 /****************************************************************************/
76 
77 class BDI_DECLSPEC_diguy diguyVec3f
78 {
79 
80 public:
81 
82  inline diguyVec3f() {x = y = z = 0.0f;}
83  inline diguyVec3f(float new_x) {x = y = z = new_x;}
84  inline diguyVec3f(float new_x, float new_y, float new_z) {x = new_x; y = new_y; z = new_z;}
85 
86  diguyVec3f diguy_to_y_forward_z_up_coords();
87  diguyVec3f y_forward_z_up_to_diguy_coords();
88 
89  diguyVec3f diguy_to_z_forward_y_up_coords(); // diguy coords to unity coords
90  diguyVec3f z_forward_y_up_to_diguy_coords(); // unity coords to diguy coords
91 
92  diguyVec4f diguy_euler_angles_to_quaternion() const;
93 
94  inline float _x() {return x;}
95  inline float _y() {return y;}
96  inline float _z() {return z;}
97 
98  inline float _rz() {return rz;}
99  inline float _rx() {return rx;}
100  inline float _ry() {return ry;}
101 
102  inline float _r() {return r;}
103  inline float _g() {return g;}
104  inline float _b() {return b;}
105 
106  inline float _azimuth() {return azimuth;}
107  inline float _elevation() {return elevation;}
108  inline float _radius() {return radius;}
109 
110 #ifdef CPLUSPLUS_ONLY
111 
112  /*
113  * Data members.
114  *
115  * Each data member is a union of different floats, so that variable
116  * names appropriate to the variable's context can be used. For
117  * example, for a position vector p, the following would be appropriate:
118  *
119  * p.x = 10.0f; p.y = 0.0f; p.z = 1.0f;
120  *
121  * For a color green:
122  *
123  * c.r = 0.0f; c.g = 1.0f; c.b = 0.0f;
124  */
126  union {
127  float x;
128  float rz;
129  float r;
130  float azimuth;
131  };
133  union {
134  float y;
135  float rx;
136  float g;
137  float elevation;
138  };
140  union {
141  float z;
142  float ry;
143  float b;
144  float radius;
145  };
146 
147 #endif
148 };
149 
150 
151 
152 /****************************************************************************/
153 /*
154  * diguyVec4f
155  */
156 /****************************************************************************/
158 class BDI_DECLSPEC_diguy diguyVec4f
159 {
160 
161 public:
163  inline diguyVec4f() {x = y = z = w = 0.0f;}
164  inline diguyVec4f(float new_x) {x = y = z = w = new_x;}
165  inline diguyVec4f(float new_x, float new_y, float new_z, float new_w) {x = new_x; y = new_y; z = new_z; w = new_w;}
167  inline float _x() {return x;}
168  inline float _y() {return y;}
169  inline float _z() {return z;}
170  inline float _w() {return w;}
172  inline float _rz() {return rz;}
173  inline float _rx() {return rx;}
174  inline float _ry() {return ry;}
175  inline float _rw() {return rw;}
177  inline float _r() {return r;}
178  inline float _g() {return g;}
179  inline float _b() {return b;}
180  inline float _a() {return a;}
181 
182  inline float _qx() {return qx;}
183  inline float _qy() {return qy;}
184  inline float _qz() {return qz;}
185  inline float _qw() {return qw;}
186 
187 #ifdef CPLUSPLUS_ONLY
188 
189  /*
190  * Data members. See the comment in diguyVec3f regarding the use of
191  * unions.
192  */
193 
194  union {
195  float x;
196  float rz;
197  float r;
198  float qx;
199  };
200 
201  union {
202  float y;
203  float rx;
204  float g;
205  float qy;
206  };
207 
208  union {
209  float z;
210  float ry;
211  float b;
212  float qz;
213  };
214 
215  union {
216  float w;
217  float rw;
218  float a;
219  float qw;
220  };
221 
222 #endif
223 };
224 
226 
227 
228 /****************************************************************************/
229 /*
230  * diguyVec3d
231  */
232 /****************************************************************************/
233 
234 class BDI_DECLSPEC_diguy diguyVec3d
235 {
237 public:
239  inline diguyVec3d() {x = y = z = 0.0;}
240  inline diguyVec3d(double new_x) {x = y = z = new_x;}
241  inline diguyVec3d(double new_x, double new_y, double new_z) {x = new_x; y = new_y; z = new_z;}
243  inline double _x() {return x;}
244  inline double _y() {return y;}
245  inline double _z() {return z;}
247  inline double _rz() {return rz;}
248  inline double _rx() {return rx;}
249  inline double _ry() {return ry;}
250 
251  inline double _r() {return r;}
252  inline double _g() {return g;}
253  inline double _b() {return b;}
254 
255  inline double _azimuth() {return azimuth;}
256  inline double _elevation() {return elevation;}
257  inline double _radius() {return radius;}
259 #ifdef CPLUSPLUS_ONLY
261  /*
262  * Data members. See the comment in diguyVec3f regarding the use of
263  * unions.
264  */
266  union {
267  double x;
268  double rz;
269  double r;
270  double azimuth;
271  };
273  union {
274  double y;
275  double rx;
276  double g;
277  double elevation;
278  };
279 
280  union {
281  double z;
282  double ry;
283  double b;
284  double radius;
285  };
286 
287 #endif
288 };
289 
290 
291 
293 /****************************************************************************/
294 /*
295  * diguyVec4d
296  */
297 /****************************************************************************/
299 class BDI_DECLSPEC_diguy diguyVec4d
300 {
302 public:
304  inline diguyVec4d() {x = y = z = w = 0.0;}
305  inline diguyVec4d(double new_x) {x = y = z = w = new_x;}
306  inline diguyVec4d(double new_x, double new_y, double new_z, double new_w) {x = new_x; y = new_y; z = new_z; w = new_w;}
308  inline double _x() {return x;}
309  inline double _y() {return y;}
310  inline double _z() {return z;}
311  inline double _w() {return w;}
313  inline double _rz() {return rz;}
314  inline double _rx() {return rx;}
315  inline double _ry() {return ry;}
316  inline double _rw() {return rw;}
317 
318  inline double _r() {return r;}
319  inline double _g() {return g;}
320  inline double _b() {return b;}
321  inline double _a() {return a;}
322 
323  inline double _qx() {return qx;}
324  inline double _qy() {return qy;}
325  inline double _qz() {return qz;}
326  inline double _qw() {return qw;}
328 #ifdef CPLUSPLUS_ONLY
329 
330  /*
331  * Data members. See the comment in diguyVec3f regarding the use of
332  * unions.
333  */
335  union {
336  double x;
337  double rz;
338  double r;
339  double qx;
340  };
342  union {
343  double y;
344  double rx;
345  double g;
346  double qy;
347  };
349  union {
350  double z;
351  double ry;
352  double b;
353  double qz;
354  };
355 
356  union {
357  double w;
358  double rw;
359  double a;
360  double qw;
361  };
362 
363 #endif
364 };
368 
369 /****************************************************************************/
370 /*
371  * diguyVec3i
372  */
373 /****************************************************************************/
375 class BDI_DECLSPEC_diguy diguyVec3i
376 {
377 
378 public:
379 
380  inline diguyVec3i() {x = y = z = 0;}
381  inline diguyVec3i(int new_x) {x = y = z = new_x;}
382  inline diguyVec3i(int new_x, int new_y, int new_z) {x = new_x; y = new_y; z = new_z;}
383 
384  inline int _x() {return x;}
385  inline int _y() {return y;}
386  inline int _z() {return z;}
387 
388  inline int _r() {return r;}
389  inline int _g() {return g;}
390  inline int _b() {return b;}
392 #ifdef CPLUSPLUS_ONLY
393 
394  /*
395  * Data members. See the comment in diguyVec3f regarding the use of
396  * unions.
397  */
398 
399  union {
400  int x;
401  int r;
402  };
403 
404  union {
405  int y;
406  int g;
407  };
409  union {
410  int z;
411  int b;
412  };
414 #endif
415 };
416 
421 /****************************************************************************/
422 /*
423  * diguyVec4i
424  */
425 /****************************************************************************/
426 
427 class BDI_DECLSPEC_diguy diguyVec4i
428 {
429 
430 public:
431 
432  inline diguyVec4i() {x = y = z = w = 0;}
433  inline diguyVec4i(int new_x) {x = y = z = w = new_x;}
434  inline diguyVec4i(int new_x, int new_y, int new_z, int new_w) {x = new_x; y = new_y; z = new_z; w = new_w;}
436  inline int _x() {return x;}
437  inline int _y() {return y;}
438  inline int _z() {return z;}
439  inline int _w() {return w;}
441  inline int _r() {return r;}
442  inline int _g() {return g;}
443  inline int _b() {return b;}
444  inline int _a() {return a;}
446 #ifdef CPLUSPLUS_ONLY
447 
448  /*
449  * Data members. See the comment in diguyVec3f regarding the use of
450  * unions.
451  */
452 
453  union {
454  int x;
455  int r;
456  };
457 
458  union {
459  int y;
460  int g;
461  };
462 
463  union {
464  int z;
465  int b;
466  };
467 
468  union {
469  int w;
470  int a;
471  };
472 
473 #endif
474 };
475 
476 
477 #endif // __diguy_vector_classes_H
478