C++ SDK Reference  12.5
 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-2013 Boston Dynamics
4  * ALL RIGHTS RESERVED.
5  *
6  * These coded instructions, statements, and computer programs
7  * contain unpublished proprietary information of Boston Dynamics
8  * and are protected by Copyright Laws of the United States.
9  * They may not be used, duplicated, or disclosed in any form, in
10  * whole or in part, without the prior written consent from Boston
11  * Dynamics.
12  *
13  * RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the government is subject
15  * to restrictions as set forth in FAR 52.227.19(c)(2) or
16  * subparagraph (c)(1)(ii) of the Rights in Technical Data and
17  * Computer Software clause at DFARS 252.227-7013 and/or in
18  * similar or successor clauses in the FAR, or the DOD or NASA
19  * FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the
20  * Commercial Computer Software--Restricted Rights at 48 CFR
21  * 52.227-19, as applicable. Unpublished-rights reserved under
22  * the Copyright Laws of the United States.
23  * Contractor/Manufacturer is:
24  * Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.
25  */
26 
27 /*********************************************************************
28  **
29  *t DI-Guy Vector Classes
30  **
31  *b Link against: libdiguy
32  */
33 
34 #ifndef __diguy_vector_classes_H
35 #define __diguy_vector_classes_H
36 
37 #ifdef SWIG
38 %module diguyVec3f
39 #else
40 #define CPLUSPLUS_ONLY
41 #endif
42 
43 #ifdef CPLUSPLUS_ONLY
44 #include <declspec_diguy.h>
45 class diguyVec4f;
46 #endif
47 
48 
49 /****************************************************************************/
50 /*
51  * diguyVec2f
52  */
53 /****************************************************************************/
54 
55 class BDI_DECLSPEC_diguy diguyVec2f
56 {
57 
58 public:
59 
60  inline diguyVec2f() {x = y = 0.0f;}
61  inline diguyVec2f(float new_x) {x = y = new_x;}
62  inline diguyVec2f(float new_x, float new_y) {x = new_x; y = new_y;}
63 
64  inline float _x() {return x;}
65  inline float _y() {return y;}
66 
67  inline float _azimuth() {return azimuth;}
68  inline float _elevation() {return elevation;}
69 
70  /*
71  * Data members. See the comment in diguyVec3f regarding the use of
72  * unions.
73  */
74 #ifdef CPLUSPLUS_ONLY
75 
76  union {
77  float x;
78  float azimuth;
79  };
80 
81  union {
82  float y;
83  float elevation;
84  };
85 
86 #endif
87 };
88 
89 
90 
91 /****************************************************************************/
92 /*
93  * diguyVec3f
94  */
95 /****************************************************************************/
96 
97 class BDI_DECLSPEC_diguy diguyVec3f
98 {
99 
100 public:
101 
102  inline diguyVec3f() {x = y = z = 0.0f;}
103  inline diguyVec3f(float new_x) {x = y = z = new_x;}
104  inline diguyVec3f(float new_x, float new_y, float new_z) {x = new_x; y = new_y; z = new_z;}
105 
106  diguyVec3f diguy_to_y_forward_z_up_coords();
107  diguyVec3f y_forward_z_up_to_diguy_coords();
108 
109  diguyVec3f diguy_to_z_forward_y_up_coords(); // diguy coords to unity coords
110  diguyVec3f z_forward_y_up_to_diguy_coords(); // unity coords to diguy coords
112  diguyVec4f diguy_euler_angles_to_quaternion() const;
113 
114  inline float _x() {return x;}
115  inline float _y() {return y;}
116  inline float _z() {return z;}
117 
118  inline float _rz() {return rz;}
119  inline float _rx() {return rx;}
120  inline float _ry() {return ry;}
121 
122  inline float _r() {return r;}
123  inline float _g() {return g;}
124  inline float _b() {return b;}
125 
126  inline float _azimuth() {return azimuth;}
127  inline float _elevation() {return elevation;}
128  inline float _radius() {return radius;}
129 
130 #ifdef CPLUSPLUS_ONLY
131 
132  /*
133  * Data members.
134  *
135  * Each data member is a union of different floats, so that variable
136  * names appropriate to the variable's context can be used. For
137  * example, for a position vector p, the following would be appropriate:
138  *
139  * p.x = 10.0f; p.y = 0.0f; p.z = 1.0f;
140  *
141  * For a color green:
142  *
143  * c.r = 0.0f; c.g = 1.0f; c.b = 0.0f;
144  */
146  union {
147  float x;
148  float rz;
149  float r;
150  float azimuth;
151  };
153  union {
154  float y;
155  float rx;
156  float g;
157  float elevation;
158  };
160  union {
161  float z;
162  float ry;
163  float b;
164  float radius;
165  };
166 
167 #endif
168 };
169 
170 
171 
172 /****************************************************************************/
173 /*
174  * diguyVec4f
175  */
176 /****************************************************************************/
178 class BDI_DECLSPEC_diguy diguyVec4f
179 {
180 
181 public:
183  inline diguyVec4f() {x = y = z = w = 0.0f;}
184  inline diguyVec4f(float new_x) {x = y = z = w = new_x;}
185  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;}
187  inline float _x() {return x;}
188  inline float _y() {return y;}
189  inline float _z() {return z;}
190  inline float _w() {return w;}
192  inline float _rz() {return rz;}
193  inline float _rx() {return rx;}
194  inline float _ry() {return ry;}
195  inline float _rw() {return rw;}
197  inline float _r() {return r;}
198  inline float _g() {return g;}
199  inline float _b() {return b;}
200  inline float _a() {return a;}
201 
202  inline float _qx() {return qx;}
203  inline float _qy() {return qy;}
204  inline float _qz() {return qz;}
205  inline float _qw() {return qw;}
206 
207 #ifdef CPLUSPLUS_ONLY
208 
209  /*
210  * Data members. See the comment in diguyVec3f regarding the use of
211  * unions.
212  */
213 
214  union {
215  float x;
216  float rz;
217  float r;
218  float qx;
219  };
220 
221  union {
222  float y;
223  float rx;
224  float g;
225  float qy;
226  };
227 
228  union {
229  float z;
230  float ry;
231  float b;
232  float qz;
233  };
234 
235  union {
236  float w;
237  float rw;
238  float a;
239  float qw;
240  };
241 
242 #endif
243 };
244 
246 
247 
248 /****************************************************************************/
249 /*
250  * diguyVec3d
251  */
252 /****************************************************************************/
253 
254 class BDI_DECLSPEC_diguy diguyVec3d
255 {
257 public:
259  inline diguyVec3d() {x = y = z = 0.0;}
260  inline diguyVec3d(double new_x) {x = y = z = new_x;}
261  inline diguyVec3d(double new_x, double new_y, double new_z) {x = new_x; y = new_y; z = new_z;}
263  inline double _x() {return x;}
264  inline double _y() {return y;}
265  inline double _z() {return z;}
267  inline double _rz() {return rz;}
268  inline double _rx() {return rx;}
269  inline double _ry() {return ry;}
270 
271  inline double _r() {return r;}
272  inline double _g() {return g;}
273  inline double _b() {return b;}
274 
275  inline double _azimuth() {return azimuth;}
276  inline double _elevation() {return elevation;}
277  inline double _radius() {return radius;}
279 #ifdef CPLUSPLUS_ONLY
281  /*
282  * Data members. See the comment in diguyVec3f regarding the use of
283  * unions.
284  */
286  union {
287  double x;
288  double rz;
289  double r;
290  double azimuth;
291  };
293  union {
294  double y;
295  double rx;
296  double g;
297  double elevation;
298  };
299 
300  union {
301  double z;
302  double ry;
303  double b;
304  double radius;
305  };
306 
307 #endif
308 };
309 
310 
311 
313 /****************************************************************************/
314 /*
315  * diguyVec4d
316  */
317 /****************************************************************************/
319 class BDI_DECLSPEC_diguy diguyVec4d
320 {
322 public:
324  inline diguyVec4d() {x = y = z = w = 0.0;}
325  inline diguyVec4d(double new_x) {x = y = z = w = new_x;}
326  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;}
328  inline double _x() {return x;}
329  inline double _y() {return y;}
330  inline double _z() {return z;}
331  inline double _w() {return w;}
333  inline double _rz() {return rz;}
334  inline double _rx() {return rx;}
335  inline double _ry() {return ry;}
336  inline double _rw() {return rw;}
337 
338  inline double _r() {return r;}
339  inline double _g() {return g;}
340  inline double _b() {return b;}
341  inline double _a() {return a;}
342 
343  inline double _qx() {return qx;}
344  inline double _qy() {return qy;}
345  inline double _qz() {return qz;}
346  inline double _qw() {return qw;}
348 #ifdef CPLUSPLUS_ONLY
349 
350  /*
351  * Data members. See the comment in diguyVec3f regarding the use of
352  * unions.
353  */
355  union {
356  double x;
357  double rz;
358  double r;
359  double qx;
360  };
362  union {
363  double y;
364  double rx;
365  double g;
366  double qy;
367  };
369  union {
370  double z;
371  double ry;
372  double b;
373  double qz;
374  };
375 
376  union {
377  double w;
378  double rw;
379  double a;
380  double qw;
381  };
382 
383 #endif
384 };
388 
389 /****************************************************************************/
390 /*
391  * diguyVec3i
392  */
393 /****************************************************************************/
395 class BDI_DECLSPEC_diguy diguyVec3i
396 {
397 
398 public:
399 
400  inline diguyVec3i() {x = y = z = 0;}
401  inline diguyVec3i(int new_x) {x = y = z = new_x;}
402  inline diguyVec3i(int new_x, int new_y, int new_z) {x = new_x; y = new_y; z = new_z;}
403 
404  inline int _x() {return x;}
405  inline int _y() {return y;}
406  inline int _z() {return z;}
407 
408  inline int _r() {return r;}
409  inline int _g() {return g;}
410  inline int _b() {return b;}
412 #ifdef CPLUSPLUS_ONLY
413 
414  /*
415  * Data members. See the comment in diguyVec3f regarding the use of
416  * unions.
417  */
418 
419  union {
420  int x;
421  int r;
422  };
423 
424  union {
425  int y;
426  int g;
427  };
429  union {
430  int z;
431  int b;
432  };
434 #endif
435 };
436 
441 /****************************************************************************/
442 /*
443  * diguyVec4i
444  */
445 /****************************************************************************/
446 
447 class BDI_DECLSPEC_diguy diguyVec4i
448 {
449 
450 public:
451 
452  inline diguyVec4i() {x = y = z = w = 0;}
453  inline diguyVec4i(int new_x) {x = y = z = w = new_x;}
454  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;}
456  inline int _x() {return x;}
457  inline int _y() {return y;}
458  inline int _z() {return z;}
459  inline int _w() {return w;}
461  inline int _r() {return r;}
462  inline int _g() {return g;}
463  inline int _b() {return b;}
464  inline int _a() {return a;}
466 #ifdef CPLUSPLUS_ONLY
467 
468  /*
469  * Data members. See the comment in diguyVec3f regarding the use of
470  * unions.
471  */
472 
473  union {
474  int x;
475  int r;
476  };
477 
478  union {
479  int y;
480  int g;
481  };
482 
483  union {
484  int z;
485  int b;
486  };
487 
488  union {
489  int w;
490  int a;
491  };
492 
493 #endif
494 };
495 
496 
497 #endif // __diguy_vector_classes_H
498