VectorXD.h
Go to the documentation of this file.
1#ifndef __GfxTL_VECTORXD_HEADER__
2#define __GfxTL_VECTORXD_HEADER__
3#include <assert.h>
4#ifndef _USE_MATH_DEFINES
5#define _USE_MATH_DEFINES
6#endif
7#include <algorithm>
8#include <cmath>
9#include <iostream>
10
11#include <GfxTL/MathHelper.h>
12#include <GfxTL/MatrixXX.h>
13#include <GfxTL/NullClass.h>
14#include <GfxTL/StdOverrides.h>
15#include <memory.h>
16
17namespace GfxTL
18{
19 template <unsigned int D, class T>
20 class VectorXD : public MatrixXX<1, D, T>
21 {
22 public:
23 typedef T ScalarType;
24 typedef T value_type;
27
28 enum
29 {
30 Dim = D
31 };
32
34 {
35 }
36
38 {
39 }
40
41 explicit VectorXD(const T* v)
42 {
43 memcpy(SuperType::_m, v, sizeof(SuperType::_m));
44 }
45
46 template <class S>
47 explicit VectorXD(const S* v)
48 {
49 for (unsigned int i = 0; i < Dim; ++i)
50 {
51 SuperType::_m[i] = (T)v[i];
52 }
53 }
54
55 template <class S>
56 explicit VectorXD(const VectorXD<D, S>& v)
57 {
58 for (unsigned int i = 0; i < Dim; ++i)
59 {
60 SuperType::_m[i] = (T)v[i];
61 }
62 }
63
65 {
66 }
67
68 explicit VectorXD(T x)
69 {
70 for (unsigned int i = 0; i < Dim; ++i)
71 {
72 SuperType::_m[i] = x;
73 }
74 }
75
76 template <class S>
77 explicit VectorXD(const S x,
78 typename std::enable_if<std::is_convertible<S, ScalarType>::value,
79 NullClass>::type& dummy = *((NullClass*)0))
80 {
81 for (unsigned int i = 0; i < Dim; ++i)
82 {
84 }
85 }
86
87 template <unsigned int X>
88 explicit VectorXD(const VectorXD<X, T>& vec)
89 {
90 for (unsigned int i = 0; i < std::min(D, X); ++i)
91 {
92 SuperType::_m[i] = vec[i];
93 }
94 for (unsigned int i = X; i < D; ++i)
95 {
96 SuperType::_m[i] = 0;
97 }
98 }
99
100 explicit VectorXD(const VectorXD<D - 1, T>& v, T s)
101 {
102 for (unsigned int i = 0; i < D - 1; ++i)
103 {
104 SuperType::_m[i] = v[i];
105 }
106 SuperType::_m[D - 1] = s;
107 }
108
109 explicit VectorXD(const VectorXD<D - 2, T>& v, T s, T s2)
110 {
111 for (unsigned int i = 0; i < D - 2; ++i)
112 {
113 SuperType::_m[i] = v[i];
114 }
115 SuperType::_m[D - 2] = s;
116 SuperType::_m[D - 1] = s2;
117 }
118
119 explicit VectorXD(const VectorXD<D - 3, T>& v, T s, T s2, T s3)
120 {
121 for (unsigned int i = 0; i < D - 2; ++i)
122 {
123 SuperType::_m[i] = v[i];
124 }
125 SuperType::_m[D - 3] = s;
126 SuperType::_m[D - 2] = s2;
127 SuperType::_m[D - 1] = s3;
128 }
129
131 {
132#ifdef WIN32
134#endif
135 SuperType::_m[0] = x;
136 SuperType::_m[1] = y;
137 }
138
139 VectorXD(T x, T y, T z)
140 {
141#ifdef WIN32
143#endif
144 SuperType::_m[0] = x;
145 SuperType::_m[1] = y;
146 SuperType::_m[2] = z;
147 }
148
149 VectorXD(T x, T y, T z, T w)
150 {
151#ifdef WIN32
153#endif
154 SuperType::_m[0] = x;
155 SuperType::_m[1] = y;
156 SuperType::_m[2] = z;
157 SuperType::_m[3] = w;
158 }
159
160 ThisType&
162 {
163 return (ThisType&)(SuperType::operator=(v));
164 }
165
166 ThisType&
168 {
169 return (ThisType&)(SuperType::operator=(s));
170 }
171
172 template <class S>
173 ThisType&
175 {
176 for (unsigned int i = 0; i < D; ++i)
177 {
178 SuperType::_m[i] = (T)v[0][i];
179 }
180 return *this;
181 }
182
183 inline ScalarType&
184 operator[](unsigned int i)
185 {
186 return SuperType::_m[i];
187 }
188
189 inline ScalarType
190 operator[](unsigned int i) const
191 {
192 return SuperType::_m[i];
193 }
194
195 /*operator ScalarType *()
196 {
197 return SuperType::_m;
198 }
199
200 operator const ScalarType *() const
201 {
202 return SuperType::_m;
203 }*/
204
207 {
208 for (unsigned int i = 0; i < D; ++i)
209 {
210 SuperType::_m[i] += a.Data()[i];
211 }
212 return *this;
213 }
214
217 {
218 for (unsigned int i = 0; i < D; ++i)
219 {
220 SuperType::_m[i] -= a.Data()[i];
221 }
222 return *this;
223 }
224
225 template <class S>
228 {
229 for (unsigned int i = 0; i < D; ++i)
230 {
231 SuperType::_m[i] *= s;
232 }
233 return *this;
234 }
235
236 template <class S>
239 {
240 for (unsigned int i = 0; i < D; ++i)
241 {
242 SuperType::_m[i] /= s;
243 }
244 return *this;
245 }
246
248 operator-() const
249 {
250 return ScalarType(-1) * (*this);
251 }
252
254 Length() const
255 {
256 return sqrt(SqrLength());
257 }
258
260 SqrLength() const
261 {
262 ScalarType s = 0;
263 for (unsigned int i = 0; i < D; ++i)
264 {
265 s += SuperType::_m[i] * SuperType::_m[i];
266 }
267 return s;
268 }
269
271 L1Length() const
272 {
273 ScalarType s = 0;
274 for (unsigned int i = 0; i < D; ++i)
275 {
276 s += abs(SuperType::_m[i]);
277 }
278 return s;
279 }
280
281 void
283 {
284 memset(SuperType::_m, 0, sizeof(SuperType::_m));
285 }
286
287 bool
289 {
290 return memcmp(SuperType::_m, a._m, sizeof(SuperType::_m)) == 0;
291 }
292
295 {
296 ScalarType diff, d;
297 diff = SuperType::_m[0] - v[0];
298 d = diff * diff;
299 for (unsigned int i = 1; i < Dim; ++i)
300 {
301 diff = SuperType::_m[i] - v[i];
302 d += diff * diff;
303 }
304 return d;
305 }
306
308 Distance(const VectorXD<D, T>& v) const
309 {
310 return sqrt(SqrDistance(v));
311 }
312
315 {
317 for (unsigned int i = 1; i < Dim; ++i)
318 {
319 d += Math<ScalarType>::Abs(SuperType::_m[i] - v[i]);
320 }
321 return d;
322 }
323
326 {
328 for (unsigned int i = 1; i < Dim; ++i)
329 {
330 di = Math<ScalarType>::Abs(SuperType::_m[i] - v[i]);
331 if (di > d)
332 {
333 d = di;
334 }
335 }
336 return d;
337 }
338
340 Homogene() const
341 {
343 for (unsigned int i = 0; i < Dim; ++i)
344 {
345 p[i] = SuperType::_m[i];
346 }
347 p[Dim] = 1;
348 return p;
349 }
350
353
356 {
357 return SuperType::_m;
358 }
359
362 {
363 return SuperType::_m + D;
364 }
365
366 const ScalarType*
367 begin() const
368 {
369 return SuperType::_m;
370 }
371
372 const ScalarType*
373 end() const
374 {
375 return SuperType::_m + D;
376 }
377 };
378
379 template <unsigned int D, class T>
380 std::ostream&
381 operator<<(std::ostream& o, const VectorXD<D, T>& vec)
382 {
383 o << "[";
384 for (unsigned int i = 0; i < D; ++i)
385 {
386 o << vec[i];
387 if (i < D - 1)
388 {
389 o << ", ";
390 }
391 }
392 o << "]";
393 return o;
394 }
395
396 template <unsigned int D, class T>
397 inline const VectorXD<D, T>
399 {
401 for (unsigned int i = 0; i < D; ++i)
402 {
403 v[i] = a[i] + b[i];
404 }
405 return v;
406 }
407
408 template <class T>
409 inline const VectorXD<1, T>
411 {
412 return VectorXD<1, T>(a[0] + b[0]);
413 }
414
415 template <class T>
416 inline const VectorXD<2, T>
418 {
419 return VectorXD<2, T>(a[0] + b[0], a[1] + b[1]);
420 }
421
422 template <class T>
423 inline const VectorXD<3, T>
425 {
426 return VectorXD<3, T>(a[0] + b[0], a[1] + b[1], a[2] + b[2]);
427 }
428
429 template <class T>
430 inline const VectorXD<4, T>
432 {
433 return VectorXD<4, T>(a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]);
434 }
435
436 template <unsigned int D, class T>
437 inline const VectorXD<D, T>
439 {
441 for (unsigned int i = 0; i < D; ++i)
442 {
443 v[i] = a[i] - b[i];
444 }
445 return v;
446 }
447
448 template <class T>
449 inline const VectorXD<1, T>
451 {
452 return VectorXD<1, T>(a[0] - b[0]);
453 }
454
455 template <class T>
456 inline const VectorXD<2, T>
458 {
459 return VectorXD<2, T>(a[0] - b[0], a[1] - b[1]);
460 }
461
462 template <class T>
463 inline const VectorXD<3, T>
465 {
466 return VectorXD<3, T>(a[0] - b[0], a[1] - b[1], a[2] - b[2]);
467 }
468
469 template <class T>
470 inline const VectorXD<4, T>
472 {
473 return VectorXD<4, T>(a[0] - b[0], a[1] - b[1], a[2] - b[2], a[3] - b[3]);
474 }
475
476 // scalar product (inner product)
477 template <unsigned int D, class T>
478 inline typename VectorXD<D, T>::ScalarType
480 {
481 typename VectorXD<D, T>::ScalarType retVal = a[0] * b[0];
482 for (unsigned int i = 1; i < D; ++i)
483 {
484 retVal += a[i] * b[i];
485 }
486 return retVal;
487 }
488
489 // outer product
490 template <unsigned int A, unsigned int B, class T>
491 inline MatrixXX<B, A, T>
493 {
495 for (unsigned int c = 0; c < B; ++c)
496 for (unsigned int r = 0; r < A; ++r)
497 {
498 m[c][r] = a[r] * b[c];
499 }
500 return m;
501 }
502
503 template <unsigned int D, class T>
504 inline MatrixXX<D, D, T>
506 {
508 for (unsigned int c = 0; c < D; ++c)
509 {
510 m[c][c] = a[c] * a[c];
511 for (unsigned int r = c + 1; r < D; ++r)
512 {
513 m[c][r] = a[r] * a[c];
514 m[r][c] = m[c][r];
515 }
516 }
517 return m;
518 }
519
520 template <class T>
521 inline typename VectorXD<1, T>::ScalarType
523 {
524 return a[0] * b[0];
525 }
526
527 template <class T>
528 inline typename VectorXD<2, T>::ScalarType
530 {
531 return a[0] * b[0] + a[1] * b[1];
532 }
533
534 template <class T>
535 inline typename VectorXD<3, T>::ScalarType
537 {
538 return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
539 }
540
541 template <class T>
542 inline typename VectorXD<4, T>::ScalarType
544 {
545 return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
546 }
547
548 template <unsigned int D, class T>
549 inline VectorXD<D, T>
551 {
553 for (unsigned int i = 0; i < D; ++i)
554 {
555 v[i] = s * a[i];
556 }
557 return v;
558 }
559
560 template <class T>
561 inline const VectorXD<1, T>
563 {
564 return VectorXD<1, T>(s * a[0]);
565 }
566
567 template <class T>
568 inline const VectorXD<2, T>
570 {
571 return VectorXD<2, T>(s * a[0], s * a[1]);
572 }
573
574 template <class T>
575 inline const VectorXD<3, T>
577 {
578 return VectorXD<3, T>(s * a[0], s * a[1], s * a[2]);
579 }
580
581 template <class T>
582 inline const VectorXD<4, T>
584 {
585 return VectorXD<4, T>(s * a[0], s * a[1], s * a[2], s * a[3]);
586 }
587
588 template <unsigned int D, class T>
589 inline VectorXD<D, T>
591 {
593 for (unsigned int i = 0; i < D; ++i)
594 {
595 v[i] = a[i] * s;
596 }
597 return v;
598 }
599
600 template <class T>
601 inline const VectorXD<1, T>
603 {
604 return VectorXD<1, T>(a[0] * s);
605 }
606
607 template <class T>
608 inline const VectorXD<2, T>
610 {
611 return VectorXD<2, T>(a[0] * s, a[1] * s);
612 }
613
614 template <class T>
615 inline const VectorXD<3, T>
617 {
618 return VectorXD<3, T>(a[0] * s, a[1] * s, a[2] * s);
619 }
620
621 template <class T>
622 inline const VectorXD<4, T>
624 {
625 return VectorXD<4, T>(a[0] * s, a[1] * s, a[2] * s, a[3] * s);
626 }
627
628 template <unsigned int D, class T>
629 inline VectorXD<D, T>
631 {
633 for (unsigned int i = 0; i < D; ++i)
634 {
635 v[i] = a[i] / s;
636 }
637 return v;
638 }
639
640 template <class T>
641 inline const VectorXD<1, T>
643 {
644 return VectorXD<1, T>(a[0] / s);
645 }
646
647 template <class T>
648 inline const VectorXD<2, T>
650 {
651 return VectorXD<2, T>(a[0] / s, a[1] / s);
652 }
653
654 template <class T>
655 inline const VectorXD<3, T>
657 {
658 return VectorXD<3, T>(a[0] / s, a[1] / s, a[2] / s);
659 }
660
661 template <class T>
662 inline const VectorXD<4, T>
664 {
665 return VectorXD<4, T>(a[0] / s, a[1] / s, a[2] / s, a[3] / s);
666 }
667
668 template <class T>
669 inline const VectorXD<3, T>
671 {
672 return VectorXD<3, T>(
673 a[1] * b[2] - b[1] * a[2], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]);
674 }
675
676 template <unsigned int D, class T>
677 inline VectorXD<D, T>
679 {
680 using namespace std;
682 for (unsigned int r = 0; r < D; ++r)
683 {
684 m[r] = min(a[r], b[r]);
685 }
686 return m;
687 }
688
689 template <unsigned int D, class T>
690 inline VectorXD<D, T>
692 {
693 using namespace std;
695 for (unsigned int r = 0; r < D; ++r)
696 {
697 m[r] = max(a[r], b[r]);
698 }
699 return m;
700 }
701
702 template <unsigned int D, class T>
703 inline VectorXD<D, T>
705 {
707 for (unsigned int i = 0; i < D; ++i)
708 {
709 v[i] = sqrt(a[i]);
710 }
711 return v;
712 }
713
722
747
748 template <class T>
749 class Quaternion : public VectorXD<4, T>
750 {
751 public:
752 typedef T ScalarType;
754
756 {
757 }
758
759 Quaternion(T w, T x, T y, T z) : VectorXD<4, T>(w, x, y, z)
760 {
761 }
762
765 {
766 Quaternion q = (*this) * b;
767 *this = q;
768 return *this;
769 }
770
771 void
772 Rotation(T deg, T a0, T a1, T a2)
773 {
774 T rad = (deg * (T)M_PI / (T)180.0) / (T)2.0;
775 (*this)[0] = std::cos(rad);
776 T s = std::sin(rad);
777 (*this)[1] = a0 * s;
778 (*this)[2] = a1 * s;
779 (*this)[3] = a2 * s;
780 (*this) /= SuperType::Length();
781 }
782
783 void
784 RotationRad(T rad, T a0, T a1, T a2)
785 {
786 (*this)[0] = std::cos(rad / 2);
787 T s = std::sin(rad / 2);
788 (*this)[1] = a0 * s;
789 (*this)[2] = a1 * s;
790 (*this)[3] = a2 * s;
791 (*this) /= SuperType::Length();
792 }
793
794 void
795 Rotation(T deg, const VectorXD<3, T>& a)
796 {
797 T l = a.Length();
798 Rotation(deg, a[0] / l, a[1] / l, a[2] / l);
799 }
800
801 void
802 Rotation(T* deg, T* a0, T* a1, T* a2) const
803 {
804 *deg = ((T)std::acos((*this)[0]) * (T)2.0) * (T)180.0 / (T)M_PI;
805 T sinA = (T)std::sqrt(1.0 - (*this)[0] * (*this)[0]);
806 T absSin = sinA < 0 ? -sinA : sinA;
807 if (absSin < (T)0.00005)
808 {
809 sinA = (T)1.0;
810 }
811 *a0 = (*this)[1] / sinA;
812 *a1 = (*this)[2] / sinA;
813 *a2 = (*this)[3] / sinA;
814 }
815
816 void
817 RotationRad(T* rad, T* a0, T* a1, T* a2) const
818 {
819 *rad = ((T)std::acos((*this)[0]) * (T)2.0);
820 T sinA = (T)std::sqrt(1.0 - (*this)[0] * (*this)[0]);
821 T absSin = sinA < 0 ? -sinA : sinA;
822 if (absSin < (T)0.00005)
823 {
824 sinA = (T)1.0;
825 }
826 *a0 = (*this)[1] / sinA;
827 *a1 = (*this)[2] / sinA;
828 *a2 = (*this)[3] / sinA;
829 }
830
831 void
832 Rotation(T* deg, VectorXD<3, T>* axis) const
833 {
834 Rotation(deg, &(*axis)[0], &(*axis)[1], &(*axis)[2]);
835 }
836
837 template <class V>
838 void
839 Rotate(const V& p, V* r) const
840 {
841 Quaternion<T> pp(0, p[0], p[1], p[2]);
842 Quaternion<T> rr = (*this) * pp * Conjugate();
843 (*r)[0] = rr[1];
844 (*r)[1] = rr[2];
845 (*r)[2] = rr[3];
846 }
847
849 Conjugate() const
850 {
851 return Quaternion<T>((*this)[0], -(*this)[1], -(*this)[2], -(*this)[3]);
852 }
853
855 Inverse() const
856 {
858 T s = 1 / (c.Length() * SuperType::Length());
859 for (unsigned int i = 0; i < 4; ++i)
860 {
861 c[i] *= s;
862 }
863 return c;
864 }
865
866 template <class M>
867 void
869 {
870 Quaternion<T>& q = *this;
871 T ww = q[0] * q[0];
872 T xx = q[1] * q[1];
873 T yy = q[2] * q[2];
874 T zz = q[3] * q[3];
875 T xy = q[1] * q[2] * 2;
876 T zw = q[0] * q[3] * 2;
877 T xz = q[1] * q[3] * 2;
878 T xw = q[1] * q[0] * 2;
879 T yw = q[0] * q[2] * 2;
880 T yz = q[2] * q[3] * 2;
881
882 (*mat)[0][0] = ww + xx - yy - zz;
883 (*mat)[0][1] = xy + zw;
884 (*mat)[0][2] = xz - yw;
885
886 (*mat)[1][0] = xy - zw;
887 (*mat)[1][1] = ww - xx + yy - zz;
888 (*mat)[1][2] = yz + xw;
889
890 (*mat)[2][0] = xz + yw;
891 (*mat)[2][1] = yz - xw;
892 (*mat)[2][2] = ww - xx - yy + zz;
893
894 /*(*mat)[0][0] = (T)1.0 - y2 - z2;
895 (*mat)[0][1] = xy - wz;
896 (*mat)[0][2] = xz + wy;
897
898 (*mat)[1][0] = xy + wz;
899 (*mat)[1][1] = (T)1.0 - x2 - z2;
900 (*mat)[1][2] = yz - wx;
901
902 (*mat)[2][0] = xz - wy;
903 (*mat)[2][1] = yz + wx;
904 (*mat)[2][2] = (T)1.0 - x2 - y2;*/
905 }
906 };
907
908 template <class T>
909 const Quaternion<T>
911 {
912 return Quaternion<T>(a[0] * b[0] - a[1] * b[1] - a[2] * b[2] - a[3] * b[3],
913 a[0] * b[1] + a[1] * b[0] + a[2] * b[3] - a[3] * b[2],
914 a[0] * b[2] - a[1] * b[3] + a[2] * b[0] + a[3] * b[1],
915 a[0] * b[3] + a[1] * b[2] - a[2] * b[1] + a[3] * b[0]);
916 }
917}; // namespace GfxTL
918#endif
class A(deque< T, A >)) ARMARX_OVERLOAD_STD_HASH_FOR_ITERABLE((class T
Enables hashing of std::list.
#define M_PI
Definition MathTools.h:17
constexpr T c
static ScalarT Abs(ScalarT s)
Definition MathHelper.h:15
ThisType & operator=(T v)
Definition MatrixXX.h:192
VectorXD< 4, T > SuperType
Definition VectorXD.h:753
Quaternion(T w, T x, T y, T z)
Definition VectorXD.h:759
Quaternion< T > Inverse() const
Definition VectorXD.h:855
void Rotation(T deg, const VectorXD< 3, T > &a)
Definition VectorXD.h:795
void Rotation(T *deg, T *a0, T *a1, T *a2) const
Definition VectorXD.h:802
void RotationRad(T rad, T a0, T a1, T a2)
Definition VectorXD.h:784
Quaternion< T > & operator*=(const Quaternion< T > &b)
Definition VectorXD.h:764
void Rotate(const V &p, V *r) const
Definition VectorXD.h:839
void Rotation(T *deg, VectorXD< 3, T > *axis) const
Definition VectorXD.h:832
void Rotation(T deg, T a0, T a1, T a2)
Definition VectorXD.h:772
void RotationRad(T *rad, T *a0, T *a1, T *a2) const
Definition VectorXD.h:817
Quaternion< T > Conjugate() const
Definition VectorXD.h:849
void RotationMatrix(M *mat)
Definition VectorXD.h:868
ThisType & operator=(const MatrixXX< 1, D, S > &v)
Definition VectorXD.h:174
ScalarType SqrLength() const
Definition VectorXD.h:260
ScalarType Distance(const VectorXD< D, T > &v) const
Definition VectorXD.h:308
ScalarType * begin()
Definition VectorXD.h:355
VectorXD(const VectorXD< D, T > &v)
Definition VectorXD.h:37
VectorXD(const SuperType &s)
Definition VectorXD.h:64
VectorXD(const VectorXD< D, S > &v)
Definition VectorXD.h:56
const ScalarType * begin() const
Definition VectorXD.h:367
ScalarType Length() const
Definition VectorXD.h:254
VectorXD< D, T > & operator-=(const MatrixXX< 1, D, T > &a)
Definition VectorXD.h:216
VectorXD(T x, T y, T z, T w)
Definition VectorXD.h:149
VectorXD(const VectorXD< D - 3, T > &v, T s, T s2, T s3)
Definition VectorXD.h:119
ScalarType * end()
Definition VectorXD.h:361
VectorXD(const VectorXD< D - 1, T > &v, T s)
Definition VectorXD.h:100
const ScalarType * const_iterator
Definition VectorXD.h:352
VectorXD(const T *v)
Definition VectorXD.h:41
ScalarType MaxDistance(const VectorXD< D, T > &v) const
Definition VectorXD.h:325
VectorXD(const VectorXD< X, T > &vec)
Definition VectorXD.h:88
ThisType & operator=(const SuperType &s)
Definition VectorXD.h:167
ScalarType L1Distance(const VectorXD< D, T > &v) const
Definition VectorXD.h:314
bool operator==(const VectorXD< D, T > &a) const
Definition VectorXD.h:288
VectorXD(T x, T y, T z)
Definition VectorXD.h:139
const ScalarType * end() const
Definition VectorXD.h:373
VectorXD(const VectorXD< D - 2, T > &v, T s, T s2)
Definition VectorXD.h:109
ScalarType & operator[](unsigned int i)
Definition VectorXD.h:184
ScalarType L1Length() const
Definition VectorXD.h:271
VectorXD< D, T > operator-() const
Definition VectorXD.h:248
VectorXD< Dim+1, T > Homogene() const
Definition VectorXD.h:340
MatrixXX< 1, D, ScalarType > SuperType
Definition VectorXD.h:26
VectorXD< D, T > & operator*=(S s)
Definition VectorXD.h:227
ThisType & operator=(const ThisType &v)
Definition VectorXD.h:161
ScalarType SqrDistance(const VectorXD< D, T > &v) const
Definition VectorXD.h:294
VectorXD(const S *v)
Definition VectorXD.h:47
ScalarType operator[](unsigned int i) const
Definition VectorXD.h:190
VectorXD(T x, T y)
Definition VectorXD.h:130
VectorXD< D, ScalarType > ThisType
Definition VectorXD.h:25
VectorXD< D, T > & operator+=(const MatrixXX< 1, D, T > &a)
Definition VectorXD.h:206
VectorXD(const S x, typename std::enable_if< std::is_convertible< S, ScalarType >::value, NullClass >::type &dummy= *((NullClass *) 0))
Definition VectorXD.h:77
VectorXD< D, T > & operator/=(S s)
Definition VectorXD.h:238
#define q
Definition AABox.h:10
VectorXD< 1, unsigned int > uvec1
Definition VectorXD.h:743
VectorXD< 2, float > vec2
Definition VectorXD.h:724
VectorXD< 4, double > Vec4d
Definition VectorXD.h:738
VectorXD< 3, float > Vec3f
Definition VectorXD.h:733
VectorXD< 3, int > ivec3
Definition VectorXD.h:741
VectorXD< 4, float > Vector4Df
Definition VectorXD.h:720
MatrixXX< C, R, T > min(const MatrixXX< C, R, T > &a, const MatrixXX< C, R, T > &b)
Definition MatrixXX.h:616
const MatrixXX< C, R, T > operator+(const MatrixXX< C, R, T > &a, const MatrixXX< C, R, T > &b)
Definition MatrixXX.h:454
VectorXD< 2, float > vec2f
Definition VectorXD.h:728
VectorXD< 2, double > Vec2d
Definition VectorXD.h:736
const MatrixXX< C, R, T > operator*(T s, const MatrixXX< C, R, T > &a)
Definition MatrixXX.h:418
VectorXD< 2, unsigned int > uvec2
Definition VectorXD.h:744
VectorXD< 1, double > Vector1Dd
Definition VectorXD.h:715
std::ostream & operator<<(std::ostream &o, const Array< DimT, IteratorT > &a)
Definition Array.h:189
VectorXD< 1, float > Vec1f
Definition VectorXD.h:731
VectorXD< 4, double > Vector4Dd
Definition VectorXD.h:721
VectorXD< 3, double > Vector3Dd
Definition VectorXD.h:719
VectorXD< 3, double > Vec3d
Definition VectorXD.h:737
VectorXD< 3, float > Vector3Df
Definition VectorXD.h:718
VectorXD< 2, float > Vec2f
Definition VectorXD.h:732
MatrixXX< C, R, T > operator-(const MatrixXX< C, R, T > &a)
Definition MatrixXX.h:376
VectorXD< 4, float > vec4f
Definition VectorXD.h:730
VectorXD< 3, unsigned int > uvec3
Definition VectorXD.h:745
MatrixXX< B, A, T > OuterProduct(const VectorXD< A, T > &a, const VectorXD< B, T > &b)
Definition VectorXD.h:492
VectorXD< 4, int > ivec4
Definition VectorXD.h:742
VectorXD< 3, float > vec3
Definition VectorXD.h:725
VectorXD< 2, int > ivec2
Definition VectorXD.h:740
const VectorXD< 3, T > operator%(const VectorXD< 3, T > &a, const VectorXD< 3, T > &b)
Definition VectorXD.h:670
VectorXD< 2, double > Vector2Dd
Definition VectorXD.h:717
VectorXD< D, T > sqrt(const VectorXD< D, T > &a)
Definition VectorXD.h:704
VectorXD< 1, double > Vec1d
Definition VectorXD.h:735
VectorXD< 1, int > ivec1
Definition VectorXD.h:739
VectorXD< 4, unsigned int > uvec4
Definition VectorXD.h:746
VectorXD< D, T > operator/(const VectorXD< D, T > &a, T s)
Definition VectorXD.h:630
VectorXD< 1, float > Vector1Df
Definition VectorXD.h:714
MatrixXX< C, R, T > max(const MatrixXX< C, R, T > &a, const MatrixXX< C, R, T > &b)
Definition MatrixXX.h:630
VectorXD< 2, float > Vector2Df
Definition VectorXD.h:716
VectorXD< 4, float > Vec4f
Definition VectorXD.h:734
VectorXD< 4, float > vec4
Definition VectorXD.h:726
MatrixXX< D, D, T > SqrOuterProduct(const VectorXD< D, T > &a)
Definition VectorXD.h:505
VectorXD< 1, float > vec1f
Definition VectorXD.h:727
VectorXD< 1, float > vec1
Definition VectorXD.h:723
VectorXD< 3, float > vec3f
Definition VectorXD.h:729
This file offers overloads of toIce() and fromIce() functions for STL container types.