Openholo  v2.1
Open Source Digital Holographic Library
ivec.h
Go to the documentation of this file.
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install, copy or use the software.
7 //
8 //
9 // License Agreement
10 // For Open Source Digital Holographic Library
11 //
12 // Openholo library is free software;
13 // you can redistribute it and/or modify it under the terms of the BSD 2-Clause license.
14 //
15 // Copyright (C) 2017-2024, Korea Electronics Technology Institute. All rights reserved.
16 // E-mail : contact.openholo@gmail.com
17 // Web : http://www.openholo.org
18 //
19 // Redistribution and use in source and binary forms, with or without modification,
20 // are permitted provided that the following conditions are met:
21 //
22 // 1. Redistribution's of source code must retain the above copyright notice,
23 // this list of conditions and the following disclaimer.
24 //
25 // 2. Redistribution's in binary form must reproduce the above copyright notice,
26 // this list of conditions and the following disclaimer in the documentation
27 // and/or other materials provided with the distribution.
28 //
29 // This software is provided by the copyright holders and contributors "as is" and
30 // any express or implied warranties, including, but not limited to, the implied
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
32 // In no event shall the copyright holder or contributors be liable for any direct,
33 // indirect, incidental, special, exemplary, or consequential damages
34 // (including, but not limited to, procurement of substitute goods or services;
35 // loss of use, data, or profits; or business interruption) however caused
36 // and on any theory of liability, whether in contract, strict liability,
37 // or tort (including negligence or otherwise) arising in any way out of
38 // the use of this software, even if advised of the possibility of such damage.
39 //
40 // This software contains opensource software released under GNU Generic Public License,
41 // NVDIA Software License Agreement, or CUDA supplement to Software License Agreement.
42 // Check whether software you use contains licensed software.
43 //
44 //M*/
45 
46 #ifndef __ivec_h
47 #define __ivec_h
48 //|
49 //| ivec : n-dimensional ivector
50 //|
51 
52 #include <stdio.h>
53 
54 namespace oph {
55 
59 struct __declspec(dllexport) ivec2 {
60  int v[2];
61  static const int n;
62 
63  inline ivec2() { };
64 
65  inline ivec2(int a)
66  {
67  v[1 - 1] = a; v[2 - 1] = a;
68  }
69 
70  inline ivec2(int v_1 , int v_2 )
71  {
72  v[1 - 1] = v_1; v[2 - 1] = v_2;
73  }
74 
75  inline ivec2(const ivec2& a)
76  {
77  v[1 - 1] = a[1 - 1]; v[2 - 1] = a[2 - 1];
78  }
79 
80  inline ivec2& operator=(const ivec2& a)
81  {
82  v[1 - 1] = a[1 - 1]; v[2 - 1] = a[2 - 1];
83  return *this;
84  }
85 
86 
87  inline int& operator[] (int i) { return v[i]; }
88  inline const int& operator[] (int i) const { return v[i]; }
89  inline int& operator() (int i) { return v[i % 2]; }
90  inline const int& operator() (int i) const { return v[i % 2]; }
91 };
92 
93 
94 
95 
96 //| binary op : componentwise
97 
98 
99 inline ivec2 operator + (const ivec2& a, const ivec2& b)
100 {
101  ivec2 c;
102  for(int i = 0; i < 2;++i) { c[i] = a[i] + b[i]; }
103  return c;
104 }
105 
106 inline ivec2 operator + (int a, const ivec2& b)
107 {
108  ivec2 c;
109  for(int i = 0; i < 2;++i) { c[i] = a + b[i]; }
110  return c;
111 }
112 
113 inline ivec2 operator + (const ivec2& a, int b)
114 {
115  ivec2 c;
116  for(int i = 0; i < 2;++i) { c[i] = a[i] + b; }
117  return c;
118 }
119 
120 
121 
122 inline ivec2 operator - (const ivec2& a, const ivec2& b)
123 {
124  ivec2 c;
125  for(int i = 0; i < 2;++i) { c[i] = a[i] - b[i]; }
126  return c;
127 }
128 
129 inline ivec2 operator - (int a, const ivec2& b)
130 {
131  ivec2 c;
132  for(int i = 0; i < 2;++i) { c[i] = a - b[i]; }
133  return c;
134 }
135 
136 inline ivec2 operator - (const ivec2& a, int b)
137 {
138  ivec2 c;
139  for(int i = 0; i < 2;++i) { c[i] = a[i] - b; }
140  return c;
141 }
142 
143 
144 
145 inline ivec2 operator * (const ivec2& a, const ivec2& b)
146 {
147  ivec2 c;
148  for(int i = 0; i < 2;++i) { c[i] = a[i] * b[i]; }
149  return c;
150 }
151 
152 inline ivec2 operator * (int a, const ivec2& b)
153 {
154  ivec2 c;
155  for(int i = 0; i < 2;++i) { c[i] = a * b[i]; }
156  return c;
157 }
158 
159 inline ivec2 operator * (const ivec2& a, int b)
160 {
161  ivec2 c;
162  for(int i = 0; i < 2;++i) { c[i] = a[i] * b; }
163  return c;
164 }
165 
166 
167 //
168 //inline ivec2 operator / (const ivec2& a, const ivec2& b)
169 //{
170 // ivec2 c;
171 // for(int i = 0; i < 2;++i) { c[i] = a[i] / b[i]; }
172 // return c;
173 //}
174 //
175 //inline ivec2 operator / (int a, const ivec2& b)
176 //{
177 // ivec2 c;
178 // for(int i = 0; i < 2;++i) { c[i] = a / b[i]; }
179 // return c;
180 //}
181 //
182 //inline ivec2 operator / (const ivec2& a, int b)
183 //{
184 // ivec2 c;
185 // for(int i = 0; i < 2;++i) { c[i] = a[i] / b; }
186 // return c;
187 //}
188 
189 
190 
191 //| cumulative op : componentwise
192 
193 
194 inline ivec2 operator += (ivec2& a, const ivec2& b)
195 {
196  return a = (a + b);
197 }
198 
199 inline ivec2 operator += (ivec2& a, int b)
200 {
201  return a = (a + b);
202 }
203 
204 
205 
206 inline ivec2 operator -= (ivec2& a, const ivec2& b)
207 {
208  return a = (a - b);
209 }
210 
211 inline ivec2 operator -= (ivec2& a, int b)
212 {
213  return a = (a - b);
214 }
215 
216 
217 
218 inline ivec2 operator *= (ivec2& a, const ivec2& b)
219 {
220  return a = (a * b);
221 }
222 
223 inline ivec2 operator *= (ivec2& a, int b)
224 {
225  return a = (a * b);
226 }
227 
228 
229 
230 //inline ivec2 operator /= (ivec2& a, const ivec2& b)
231 //{
232 // return a = (a / b);
233 //}
234 //
235 //inline ivec2 operator /= (ivec2& a, int b)
236 //{
237 // return a = (a / b);
238 //}
239 
240 
241 
242 //| logical op : componentwise
243 
244 
245 inline int operator == (const ivec2& a, const ivec2& b)
246 {
247  int c = 1;
248  for(int i = 0; i < 2;++i) { c = c && a[i] == b[i]; }
249  return c;
250 }
251 
252 inline int operator == (int a, const ivec2& b)
253 {
254  int c = 1;
255  for(int i = 0; i < 2;++i) { c = c && a == b[i]; }
256  return c;
257 }
258 
259 inline int operator == (const ivec2& a, int b)
260 {
261  int c = 1;
262  for(int i = 0; i < 2;++i) { c = c && a[i] == b; }
263  return c;
264 }
265 
266 
267 
268 inline int operator < (const ivec2& a, const ivec2& b)
269 {
270  int c = 1;
271  for(int i = 0; i < 2;++i) { c = c && a[i] < b[i]; }
272  return c;
273 }
274 
275 inline int operator < (int a, const ivec2& b)
276 {
277  int c = 1;
278  for(int i = 0; i < 2;++i) { c = c && a < b[i]; }
279  return c;
280 }
281 
282 inline int operator < (const ivec2& a, int b)
283 {
284  int c = 1;
285  for(int i = 0; i < 2;++i) { c = c && a[i] < b; }
286  return c;
287 }
288 
289 
290 
291 inline int operator <= (const ivec2& a, const ivec2& b)
292 {
293  int c = 1;
294  for(int i = 0; i < 2;++i) { c = c && a[i] <= b[i]; }
295  return c;
296 }
297 
298 inline int operator <= (int a, const ivec2& b)
299 {
300  int c = 1;
301  for(int i = 0; i < 2;++i) { c = c && a <= b[i]; }
302  return c;
303 }
304 
305 inline int operator <= (const ivec2& a, int b)
306 {
307  int c = 1;
308  for(int i = 0; i < 2;++i) { c = c && a[i] <= b; }
309  return c;
310 }
311 
312 
313 
314 inline int operator > (const ivec2& a, const ivec2& b)
315 {
316  int c = 1;
317  for(int i = 0; i < 2;++i) { c = c && a[i] > b[i]; }
318  return c;
319 }
320 
321 inline int operator > (int a, const ivec2& b)
322 {
323  int c = 1;
324  for(int i = 0; i < 2;++i) { c = c && a > b[i]; }
325  return c;
326 }
327 
328 inline int operator > (const ivec2& a, int b)
329 {
330  int c = 1;
331  for(int i = 0; i < 2;++i) { c = c && a[i] > b; }
332  return c;
333 }
334 
335 
336 
337 
338 inline int operator >= (const ivec2& a, const ivec2& b)
339 {
340  int c = 1;
341  for(int i = 0; i < 2;++i) { c = c && a[i] >= b[i]; }
342  return c;
343 }
344 inline int operator >= (int a, const ivec2& b)
345 {
346  int c = 1;
347  for(int i = 0; i < 2;++i) { c = c && a >= b[i]; }
348  return c;
349 }
350 
351 inline int operator >= (const ivec2& a, int b)
352 {
353  int c = 1;
354  for(int i = 0; i < 2;++i) { c = c && a[i] >= b; }
355  return c;
356 }
357 
358 inline int operator != (const ivec2& a, const ivec2& b)
359 {
360  int c = 1;
361  for(int i = 0; i < 2;++i) { c = c && a[i] != b[i]; }
362  return c;
363 }
364 
365 //| unary op : componentwise
366 inline ivec2 operator - (const ivec2& a)
367 {
368  ivec2 c;
369  for(int i = 0; i < 2;++i) { c[i] = -a[i]; }
370  return c;
371 }
372 
376 struct __declspec(dllexport) ivec3 {
377  int v[3];
378  static const int n;
379 
380  inline ivec3() { };
381 
382  inline ivec3(int a)
383  {
384  v[1 - 1] = a; v[2 - 1] = a; v[3 - 1] = a;
385  }
386 
387  inline ivec3(int v_1 , int v_2 , int v_3 )
388  {
389  v[1 - 1] = v_1; v[2 - 1] = v_2; v[3 - 1] = v_3;
390  }
391 
392  inline ivec3(const ivec3& a)
393  {
394  v[1 - 1] = a[1 - 1]; v[2 - 1] = a[2 - 1]; v[3 - 1] = a[3 - 1];
395  }
396 
397  inline ivec3& operator=(const ivec3& a)
398  {
399  v[1 - 1] = a[1 - 1]; v[2 - 1] = a[2 - 1]; v[3 - 1] = a[3 - 1];
400  return *this;
401  }
402 
403 
404  inline int& operator[] (int i) { return v[i]; }
405  inline const int& operator[] (int i) const { return v[i]; }
406  inline int& operator() (int i) { return v[i % 3]; }
407  inline const int& operator() (int i) const { return v[i % 3]; }
408 };
409 //| binary op : componentwise
410 
411 inline ivec3 operator + (const ivec3& a, const ivec3& b)
412 {
413  ivec3 c;
414  for(int i = 0; i < 3;++i) { c[i] = a[i] + b[i]; }
415  return c;
416 }
417 
418 inline ivec3 operator + (int a, const ivec3& b)
419 {
420  ivec3 c;
421  for(int i = 0; i < 3;++i) { c[i] = a + b[i]; }
422  return c;
423 }
424 
425 inline ivec3 operator + (const ivec3& a, int b)
426 {
427  ivec3 c;
428  for(int i = 0; i < 3;++i) { c[i] = a[i] + b; }
429  return c;
430 }
431 
432 
433 
434 inline ivec3 operator - (const ivec3& a, const ivec3& b)
435 {
436  ivec3 c;
437  for(int i = 0; i < 3;++i) { c[i] = a[i] - b[i]; }
438  return c;
439 }
440 
441 inline ivec3 operator - (int a, const ivec3& b)
442 {
443  ivec3 c;
444  for(int i = 0; i < 3;++i) { c[i] = a - b[i]; }
445  return c;
446 }
447 
448 inline ivec3 operator - (const ivec3& a, int b)
449 {
450  ivec3 c;
451  for(int i = 0; i < 3;++i) { c[i] = a[i] - b; }
452  return c;
453 }
454 
455 
456 
457 inline ivec3 operator * (const ivec3& a, const ivec3& b)
458 {
459  ivec3 c;
460  for(int i = 0; i < 3;++i) { c[i] = a[i] * b[i]; }
461  return c;
462 }
463 
464 inline ivec3 operator * (int a, const ivec3& b)
465 {
466  ivec3 c;
467  for(int i = 0; i < 3;++i) { c[i] = a * b[i]; }
468  return c;
469 }
470 
471 inline ivec3 operator * (const ivec3& a, int b)
472 {
473  ivec3 c;
474  for(int i = 0; i < 3;++i) { c[i] = a[i] * b; }
475  return c;
476 }
477 
478 //
479 //
480 //inline ivec3 operator / (const ivec3& a, const ivec3& b)
481 //{
482 // ivec3 c;
483 // for(int i = 0; i < 3;++i) { c[i] = a[i] / b[i]; }
484 // return c;
485 //}
486 //
487 //inline ivec3 operator / (int a, const ivec3& b)
488 //{
489 // ivec3 c;
490 // for(int i = 0; i < 3;++i) { c[i] = a / b[i]; }
491 // return c;
492 //}
493 //
494 //inline ivec3 operator / (const ivec3& a, int b)
495 //{
496 // ivec3 c;
497 // for(int i = 0; i < 3;++i) { c[i] = a[i] / b; }
498 // return c;
499 //}
500 
501 
502 
503 //| cumulative op : componentwise
504 
505 
506 inline ivec3 operator += (ivec3& a, const ivec3& b)
507 {
508  return a = (a + b);
509 }
510 
511 inline ivec3 operator += (ivec3& a, int b)
512 {
513  return a = (a + b);
514 }
515 
516 
517 
518 inline ivec3 operator -= (ivec3& a, const ivec3& b)
519 {
520  return a = (a - b);
521 }
522 
523 inline ivec3 operator -= (ivec3& a, int b)
524 {
525  return a = (a - b);
526 }
527 
528 
529 
530 inline ivec3 operator *= (ivec3& a, const ivec3& b)
531 {
532  return a = (a * b);
533 }
534 
535 inline ivec3 operator *= (ivec3& a, int b)
536 {
537  return a = (a * b);
538 }
539 
540 
541 //
542 //inline ivec3 operator /= (ivec3& a, const ivec3& b)
543 //{
544 // return a = (a / b);
545 //}
546 //
547 //inline ivec3 operator /= (ivec3& a, int b)
548 //{
549 // return a = (a / b);
550 //}
551 
552 
553 
554 //| logical op : componentwise
555 
556 
557 inline int operator == (const ivec3& a, const ivec3& b)
558 {
559  int c = 1;
560  for(int i = 0; i < 3;++i) { c = c && a[i] == b[i]; }
561  return c;
562 }
563 
564 inline int operator == (int a, const ivec3& b)
565 {
566  int c = 1;
567  for(int i = 0; i < 3;++i) { c = c && a == b[i]; }
568  return c;
569 }
570 
571 inline int operator == (const ivec3& a, int b)
572 {
573  int c = 1;
574  for(int i = 0; i < 3;++i) { c = c && a[i] == b; }
575  return c;
576 }
577 
578 
579 
580 inline int operator < (const ivec3& a, const ivec3& b)
581 {
582  int c = 1;
583  for(int i = 0; i < 3;++i) { c = c && a[i] < b[i]; }
584  return c;
585 }
586 
587 inline int operator < (int a, const ivec3& b)
588 {
589  int c = 1;
590  for(int i = 0; i < 3;++i) { c = c && a < b[i]; }
591  return c;
592 }
593 
594 inline int operator < (const ivec3& a, int b)
595 {
596  int c = 1;
597  for(int i = 0; i < 3;++i) { c = c && a[i] < b; }
598  return c;
599 }
600 
601 
602 
603 inline int operator <= (const ivec3& a, const ivec3& b)
604 {
605  int c = 1;
606  for(int i = 0; i < 3;++i) { c = c && a[i] <= b[i]; }
607  return c;
608 }
609 
610 inline int operator <= (int a, const ivec3& b)
611 {
612  int c = 1;
613  for(int i = 0; i < 3;++i) { c = c && a <= b[i]; }
614  return c;
615 }
616 
617 inline int operator <= (const ivec3& a, int b)
618 {
619  int c = 1;
620  for(int i = 0; i < 3;++i) { c = c && a[i] <= b; }
621  return c;
622 }
623 
624 
625 
626 inline int operator > (const ivec3& a, const ivec3& b)
627 {
628  int c = 1;
629  for(int i = 0; i < 3;++i) { c = c && a[i] > b[i]; }
630  return c;
631 }
632 
633 inline int operator > (int a, const ivec3& b)
634 {
635  int c = 1;
636  for(int i = 0; i < 3;++i) { c = c && a > b[i]; }
637  return c;
638 }
639 
640 inline int operator > (const ivec3& a, int b)
641 {
642  int c = 1;
643  for(int i = 0; i < 3;++i) { c = c && a[i] > b; }
644  return c;
645 }
646 
647 
648 
649 inline int operator >= (const ivec3& a, const ivec3& b)
650 {
651  int c = 1;
652  for(int i = 0; i < 3;++i) { c = c && a[i] >= b[i]; }
653  return c;
654 }
655 
656 inline int operator >= (int a, const ivec3& b)
657 {
658  int c = 1;
659  for(int i = 0; i < 3;++i) { c = c && a >= b[i]; }
660  return c;
661 }
662 
663 inline int operator >= (const ivec3& a, int b)
664 {
665  int c = 1;
666  for(int i = 0; i < 3;++i) { c = c && a[i] >= b; }
667  return c;
668 }
669 
670 inline int operator != (const ivec3& a, const ivec3& b)
671 {
672  int c = 1;
673  for(int i = 0; i < 3;++i) { c = c && a[i] != b[i]; }
674  return c;
675 }
676 
677 //| unary op : componentwise
678 inline ivec3 operator - (const ivec3& a)
679 {
680  ivec3 c;
681  for(int i = 0; i < 3;++i) { c[i] = -a[i]; }
682  return c;
683 }
684 
688 struct __declspec(dllexport) ivec4 {
689  int v[4];
690  static const int n;
691 
692  inline ivec4() { };
693 
694  inline ivec4(int a)
695  {
696  v[1 - 1] = a; v[2 - 1] = a; v[3 - 1] = a; v[4 - 1] = a;
697  }
698 
699  inline ivec4(int v_1 , int v_2 , int v_3 , int v_4 )
700  {
701  v[1 - 1] = v_1; v[2 - 1] = v_2; v[3 - 1] = v_3; v[4 - 1] = v_4;
702  }
703 
704  inline ivec4(const ivec4& a)
705  {
706  v[1 - 1] = a[1 - 1]; v[2 - 1] = a[2 - 1]; v[3 - 1] = a[3 - 1]; v[4 - 1] = a[4 - 1];
707  }
708 
709  inline ivec4& operator=(const ivec4& a)
710  {
711  v[1 - 1] = a[1 - 1]; v[2 - 1] = a[2 - 1]; v[3 - 1] = a[3 - 1]; v[4 - 1] = a[4 - 1];
712  return *this;
713  }
714 
715 
716  inline int& operator[] (int i) { return v[i]; }
717  inline const int& operator[] (int i) const { return v[i]; }
718  inline int& operator() (int i) { return v[i % 4]; }
719  inline const int& operator() (int i) const { return v[i % 4]; }
720 };
721 
722 
723 
724 
725 //| binary op : componentwise
726 
727 
728 inline ivec4 operator + (const ivec4& a, const ivec4& b)
729 {
730  ivec4 c;
731  for(int i = 0; i < 4;++i) { c[i] = a[i] + b[i]; }
732  return c;
733 }
734 
735 inline ivec4 operator + (int a, const ivec4& b)
736 {
737  ivec4 c;
738  for(int i = 0; i < 4;++i) { c[i] = a + b[i]; }
739  return c;
740 }
741 
742 inline ivec4 operator + (const ivec4& a, int b)
743 {
744  ivec4 c;
745  for(int i = 0; i < 4;++i) { c[i] = a[i] + b; }
746  return c;
747 }
748 
749 
750 
751 inline ivec4 operator - (const ivec4& a, const ivec4& b)
752 {
753  ivec4 c;
754  for(int i = 0; i < 4;++i) { c[i] = a[i] - b[i]; }
755  return c;
756 }
757 
758 inline ivec4 operator - (int a, const ivec4& b)
759 {
760  ivec4 c;
761  for(int i = 0; i < 4;++i) { c[i] = a - b[i]; }
762  return c;
763 }
764 
765 inline ivec4 operator - (const ivec4& a, int b)
766 {
767  ivec4 c;
768  for(int i = 0; i < 4;++i) { c[i] = a[i] - b; }
769  return c;
770 }
771 
772 
773 
774 inline ivec4 operator * (const ivec4& a, const ivec4& b)
775 {
776  ivec4 c;
777  for(int i = 0; i < 4;++i) { c[i] = a[i] * b[i]; }
778  return c;
779 }
780 
781 inline ivec4 operator * (int a, const ivec4& b)
782 {
783  ivec4 c;
784  for(int i = 0; i < 4;++i) { c[i] = a * b[i]; }
785  return c;
786 }
787 
788 inline ivec4 operator * (const ivec4& a, int b)
789 {
790  ivec4 c;
791  for(int i = 0; i < 4;++i) { c[i] = a[i] * b; }
792  return c;
793 }
794 
795 
796 //
797 //inline ivec4 operator / (const ivec4& a, const ivec4& b)
798 //{
799 // ivec4 c;
800 // for(int i = 0; i < 4;++i) { c[i] = a[i] / b[i]; }
801 // return c;
802 //}
803 //
804 //inline ivec4 operator / (int a, const ivec4& b)
805 //{
806 // ivec4 c;
807 // for(int i = 0; i < 4;++i) { c[i] = a / b[i]; }
808 // return c;
809 //}
810 //
811 //inline ivec4 operator / (const ivec4& a, int b)
812 //{
813 // ivec4 c;
814 // for(int i = 0; i < 4;++i) { c[i] = a[i] / b; }
815 // return c;
816 //}
817 
818 
819 
820 //| cumulative op : componentwise
821 
822 
823 inline ivec4 operator += (ivec4& a, const ivec4& b)
824 {
825  return a = (a + b);
826 }
827 
828 inline ivec4 operator += (ivec4& a, int b)
829 {
830  return a = (a + b);
831 }
832 
833 
834 
835 inline ivec4 operator -= (ivec4& a, const ivec4& b)
836 {
837  return a = (a - b);
838 }
839 
840 inline ivec4 operator -= (ivec4& a, int b)
841 {
842  return a = (a - b);
843 }
844 
845 
846 
847 inline ivec4 operator *= (ivec4& a, const ivec4& b)
848 {
849  return a = (a * b);
850 }
851 
852 inline ivec4 operator *= (ivec4& a, int b)
853 {
854  return a = (a * b);
855 }
856 
857 
858 
859 //inline ivec4 operator /= (ivec4& a, const ivec4& b)
860 //{
861 // return a = (a / b);
862 //}
863 //
864 //inline ivec4 operator /= (ivec4& a, int b)
865 //{
866 // return a = (a / b);
867 //}
868 
869 
870 
871 //| logical op : componentwise
872 
873 
874 inline int operator == (const ivec4& a, const ivec4& b)
875 {
876  int c = 1;
877  for(int i = 0; i < 4;++i) { c = c && a[i] == b[i]; }
878  return c;
879 }
880 
881 inline int operator == (int a, const ivec4& b)
882 {
883  int c = 1;
884  for(int i = 0; i < 4;++i) { c = c && a == b[i]; }
885  return c;
886 }
887 
888 inline int operator == (const ivec4& a, int b)
889 {
890  int c = 1;
891  for(int i = 0; i < 4;++i) { c = c && a[i] == b; }
892  return c;
893 }
894 
895 
896 
897 inline int operator < (const ivec4& a, const ivec4& b)
898 {
899  int c = 1;
900  for(int i = 0; i < 4;++i) { c = c && a[i] < b[i]; }
901  return c;
902 }
903 
904 inline int operator < (int a, const ivec4& b)
905 {
906  int c = 1;
907  for(int i = 0; i < 4;++i) { c = c && a < b[i]; }
908  return c;
909 }
910 
911 inline int operator < (const ivec4& a, int b)
912 {
913  int c = 1;
914  for(int i = 0; i < 4;++i) { c = c && a[i] < b; }
915  return c;
916 }
917 
918 
919 
920 inline int operator <= (const ivec4& a, const ivec4& b)
921 {
922  int c = 1;
923  for(int i = 0; i < 4;++i) { c = c && a[i] <= b[i]; }
924  return c;
925 }
926 
927 inline int operator <= (int a, const ivec4& b)
928 {
929  int c = 1;
930  for(int i = 0; i < 4;++i) { c = c && a <= b[i]; }
931  return c;
932 }
933 
934 inline int operator <= (const ivec4& a, int b)
935 {
936  int c = 1;
937  for(int i = 0; i < 4;++i) { c = c && a[i] <= b; }
938  return c;
939 }
940 
941 
942 
943 inline int operator > (const ivec4& a, const ivec4& b)
944 {
945  int c = 1;
946  for(int i = 0; i < 4;++i) { c = c && a[i] > b[i]; }
947  return c;
948 }
949 
950 inline int operator > (int a, const ivec4& b)
951 {
952  int c = 1;
953  for(int i = 0; i < 4;++i) { c = c && a > b[i]; }
954  return c;
955 }
956 
957 inline int operator > (const ivec4& a, int b)
958 {
959  int c = 1;
960  for(int i = 0; i < 4;++i) { c = c && a[i] > b; }
961  return c;
962 }
963 
964 
965 
966 inline int operator >= (const ivec4& a, const ivec4& b)
967 {
968  int c = 1;
969  for(int i = 0; i < 4;++i) { c = c && a[i] >= b[i]; }
970  return c;
971 }
972 
973 inline int operator != (const ivec4& a, const ivec4& b)
974 {
975  int c = 1;
976  for(int i = 0; i < 4;++i) { c = c && a[i] != b[i]; }
977  return c;
978 }
979 
980 inline int operator >= (int a, const ivec4& b)
981 {
982  int c = 1;
983  for(int i = 0; i < 4;++i) { c = c && a >= b[i]; }
984  return c;
985 }
986 
987 inline int operator >= (const ivec4& a, int b)
988 {
989  int c = 1;
990  for(int i = 0; i < 4;++i) { c = c && a[i] >= b; }
991  return c;
992 }
993 
994 
995 
996 //| unary op : componentwise
997 inline ivec4 operator - (const ivec4& a)
998 {
999  ivec4 c;
1000  for(int i = 0; i < 4;++i) { c[i] = -a[i]; }
1001  return c;
1002 }
1003 
1004 }; //namespace oph
1005 
1006 #endif // !__ivec_h
ivec2 operator+=(ivec2 &a, const ivec2 &b)
Definition: ivec.h:194
ivec2 operator-(const ivec2 &a, const ivec2 &b)
Definition: ivec.h:122
int operator>=(const ivec2 &a, const ivec2 &b)
Definition: ivec.h:338
ivec2 operator+(const ivec2 &a, const ivec2 &b)
Definition: ivec.h:99
ivec2 operator*(const ivec2 &a, const ivec2 &b)
Definition: ivec.h:145
int operator<=(const ivec2 &a, const ivec2 &b)
Definition: ivec.h:291
ivec2 operator-=(ivec2 &a, const ivec2 &b)
Definition: ivec.h:206
int operator>(const ivec2 &a, const ivec2 &b)
Definition: ivec.h:314
int operator!=(const ivec2 &a, const ivec2 &b)
Definition: ivec.h:358
int operator==(const ivec2 &a, const ivec2 &b)
Definition: ivec.h:245
int operator<(const ivec2 &a, const ivec2 &b)
Definition: ivec.h:268
Definition: Bitmap.h:49
ivec2 operator*=(ivec2 &a, const ivec2 &b)
Definition: ivec.h:218