6 #ifndef _EULE_NO_INTRINSICS_
24 #ifndef _EULE_NO_INTRINSICS_
27 __m256 __vector_self = _mm256_set_ps(0,0,0,0,0, (
float)z, (
float)y, (
float)x);
28 __m256 __vector_other = _mm256_set_ps(0,0,0,0,0, (
float)other.
z, (
float)other.
y, (
float)other.
x);
31 const int mask = 0x71;
32 __m256 __dot = _mm256_dp_ps(__vector_self, __vector_other, mask);
36 _mm256_storeu_ps(result, __dot);
41 return (x * other.
x) +
50 int iDot = (x * other.
x) + (y * other.
y) + (z * other.
z);
60 cp.
x = (y * other.
z) - (z * other.
y);
61 cp.
y = (z * other.
x) - (x * other.
z);
62 cp.
z = (x * other.
y) - (y * other.
x);
71 cp.
x = ((double)y * (
double)other.
z) - ((
double)z * (double)other.
y);
72 cp.
y = ((double)z * (
double)other.
x) - ((
double)x * (double)other.
z);
73 cp.
z = ((double)x * (
double)other.
y) - ((
double)y * (double)other.
x);
84 return DotProduct(*
this);
90 int iSqrMag = x*x + y*y + z*z;
91 return (
double)iSqrMag;
97 return sqrt(SqrMagnitude());
104 #ifndef _EULE_NO_INTRINSICS_
107 __m256d __vector_self = _mm256_set_pd(0, z, y, x);
108 __m256d __vector_scalar = _mm256_set_pd(0, scalar.
z, scalar.
y, scalar.
x);
111 __m256d __product = _mm256_mul_pd(__vector_self, __vector_scalar);
115 _mm256_storeu_pd(result, __product);
158 const double length = Magnitude();
169 #ifndef _EULE_NO_INTRINSICS_
172 __m256d __vec = _mm256_set_pd(0, z, y, x);
173 __m256d __len = _mm256_set1_pd(length);
176 __m256d __prod = _mm256_div_pd(__vec, __len);
180 _mm256_storeu_pd(prod, __prod);
202 std::cerr <<
"Stop normalizing int-vectors!!" << std::endl;
216 (::Math::Similar(x, other.
x, epsilon)) &&
217 (::Math::Similar(y, other.
y, epsilon)) &&
218 (::Math::Similar(z, other.
z, epsilon))
246 throw std::out_of_range(
"Array descriptor on Vector3<T> out of range!");
262 throw std::out_of_range(
"Array descriptor on Vector3<T> out of range!");
271 const double it = 1.0 - t;
273 #ifndef _EULE_NO_INTRINSICS_
276 __m256d __vector_self = _mm256_set_pd(0, z, y, x);
277 __m256d __vector_other = _mm256_set_pd(0, other.
z, other.
y, other.
x);
278 __m256d __t = _mm256_set1_pd(t);
279 __m256d __it = _mm256_set1_pd(it);
284 __m256d __sum = _mm256_set1_pd(0);
286 __sum = _mm256_fmadd_pd(__vector_self, __it, __sum);
287 __sum = _mm256_fmadd_pd(__vector_other, __t, __sum);
291 _mm256_storeu_pd(sum, __sum);
299 x = it*x + t*other.
x;
300 y = it*y + t*other.
y;
301 z = it*z + t*other.
z;
313 const double it = 1.0 - t;
315 x = (int)(it * (
double)x + t * (double)other.
x);
316 y = (int)(it * (
double)y + t * (double)other.
y);
317 z = (int)(it * (
double)z + t * (double)other.
z);
325 copy.LerpSelf(other, t);
342 #ifndef _EULE_NO_INTRINSICS_
345 __m256d __vector_self = _mm256_set_pd(0, z, y, x);
346 __m256d __vector_other = _mm256_set_pd(0, other.
z, other.
y, other.
x);
349 __m256d __sum = _mm256_add_pd(__vector_self, __vector_other);
353 _mm256_storeu_pd(sum, __sum);
385 #ifndef _EULE_NO_INTRINSICS_
388 __m256d __vector_self = _mm256_set_pd(0, z, y, x);
389 __m256d __vector_other = _mm256_set_pd(0, other.
z, other.
y, other.
x);
392 __m256d __sum = _mm256_add_pd(__vector_self, __vector_other);
396 _mm256_storeu_pd(sum, __sum);
426 #ifndef _EULE_NO_INTRINSICS_
429 __m256d __vector_self = _mm256_set_pd(0, z, y, x);
430 __m256d __vector_other = _mm256_set_pd(0, other.
z, other.
y, other.
x);
433 __m256d __diff = _mm256_sub_pd(__vector_self, __vector_other);
437 _mm256_storeu_pd(diff, __diff);
469 #ifndef _EULE_NO_INTRINSICS_
472 __m256d __vector_self = _mm256_set_pd(0, z, y, x);
473 __m256d __vector_other = _mm256_set_pd(0, other.
z, other.
y, other.
x);
476 __m256d __diff = _mm256_sub_pd(__vector_self, __vector_other);
480 _mm256_storeu_pd(diff, __diff);
510 #ifndef _EULE_NO_INTRINSICS_
513 __m256d __vector_self = _mm256_set_pd(0, z, y, x);
514 __m256d __scalar = _mm256_set1_pd(scale);
517 __m256d __prod = _mm256_mul_pd(__vector_self, __scalar);
521 _mm256_storeu_pd(prod, __prod);
554 #ifndef _EULE_NO_INTRINSICS_
557 __m256d __vector_self = _mm256_set_pd(0, z, y, x);
558 __m256d __scalar = _mm256_set1_pd(scale);
561 __m256d __prod = _mm256_mul_pd(__vector_self, __scalar);
565 _mm256_storeu_pd(prod, __prod);
595 #ifndef _EULE_NO_INTRINSICS_
598 __m256d __vector_self = _mm256_set_pd(0, z, y, x);
599 __m256d __scalar = _mm256_set1_pd(scale);
602 __m256d __prod = _mm256_div_pd(__vector_self, __scalar);
606 _mm256_storeu_pd(prod, __prod);
639 #ifndef _EULE_NO_INTRINSICS_
642 __m256d __vector_self = _mm256_set_pd(0, z, y, x);
643 __m256d __scalar = _mm256_set1_pd(scale);
646 __m256d __prod = _mm256_div_pd(__vector_self, __scalar);
650 _mm256_storeu_pd(prod, __prod);
682 #ifndef _EULE_NO_INTRINSICS_
684 __m256d __vecx = _mm256_set1_pd(x);
685 __m256d __vecy = _mm256_set1_pd(y);
686 __m256d __vecz = _mm256_set1_pd(z);
689 __m256d __mat_row0 = _mm256_set_pd(mat[0][0], mat[1][0], mat[2][0], 0);
690 __m256d __mat_row1 = _mm256_set_pd(mat[0][1], mat[1][1], mat[2][1], 0);
691 __m256d __mat_row2 = _mm256_set_pd(mat[0][2], mat[1][2], mat[2][2], 0);
694 __m256d __mul_vecx_row0 = _mm256_mul_pd(__vecx, __mat_row0);
695 __m256d __mul_vecy_row1 = _mm256_mul_pd(__vecy, __mat_row1);
696 __m256d __mul_vecz_row2 = _mm256_mul_pd(__vecz, __mat_row2);
699 __m256d __sum = _mm256_add_pd(__mul_vecx_row0, _mm256_add_pd(__mul_vecy_row1, __mul_vecz_row2));
702 __m256d __translation = _mm256_set_pd(mat[0][3], mat[1][3], mat[2][3], 0);
705 __m256d __final = _mm256_add_pd(__sum, __translation);
709 _mm256_storeu_pd(dfinal, __final);
711 newVec.
x = dfinal[3];
712 newVec.
y = dfinal[2];
713 newVec.
z = dfinal[1];
717 newVec.
x = (mat[0][0] * x) + (mat[1][0] * y) + (mat[2][0] * z);
718 newVec.
y = (mat[0][1] * x) + (mat[1][1] * y) + (mat[2][1] * z);
719 newVec.
z = (mat[0][2] * x) + (mat[1][2] * y) + (mat[2][2] * z);
722 newVec.
x += mat[0][3];
723 newVec.
y += mat[1][3];
724 newVec.
z += mat[2][3];
736 newVec.
x = ((mat[0][0] * x) + (mat[1][0] * y) + (mat[2][0] * z));
737 newVec.
y = ((mat[0][1] * x) + (mat[1][1] * y) + (mat[2][1] * z));
738 newVec.
z = ((mat[0][2] * x) + (mat[1][2] * y) + (mat[2][2] * z));
741 newVec.
x += mat[0][3];
742 newVec.
y += mat[1][3];
743 newVec.
z += mat[2][3];
757 #ifndef _EULE_NO_INTRINSICS_
759 __m256d __vecx = _mm256_set1_pd(x);
760 __m256d __vecy = _mm256_set1_pd(y);
761 __m256d __vecz = _mm256_set1_pd(z);
764 __m256d __mat_row0 = _mm256_set_pd(mat[0][0], mat[1][0], mat[2][0], 0);
765 __m256d __mat_row1 = _mm256_set_pd(mat[0][1], mat[1][1], mat[2][1], 0);
766 __m256d __mat_row2 = _mm256_set_pd(mat[0][2], mat[1][2], mat[2][2], 0);
769 __m256d __mul_vecx_row0 = _mm256_mul_pd(__vecx, __mat_row0);
770 __m256d __mul_vecy_row1 = _mm256_mul_pd(__vecy, __mat_row1);
771 __m256d __mul_vecz_row2 = _mm256_mul_pd(__vecz, __mat_row2);
774 __m256d __sum = _mm256_add_pd(__mul_vecx_row0, _mm256_add_pd(__mul_vecy_row1, __mul_vecz_row2));
777 __m256d __translation = _mm256_set_pd(mat[0][3], mat[1][3], mat[2][3], 0);
780 __m256d __final = _mm256_add_pd(__sum, __translation);
784 _mm256_storeu_pd(dfinal, __final);
792 x = (mat[0][0] * buffer.
x) + (mat[0][1] * buffer.
y) + (mat[0][2] * buffer.
z);
793 y = (mat[1][0] * buffer.
x) + (mat[1][1] * buffer.
y) + (mat[1][2] * buffer.
z);
794 z = (mat[2][0] * buffer.
x) + (mat[2][1] * buffer.
y) + (mat[2][2] * buffer.
z);
828 x = std::move(other.
x);
829 y = std::move(other.
y);
830 z = std::move(other.
z);
840 x = (int)((mat[0][0] * buffer.
x) + (mat[0][1] * buffer.
y) + (mat[0][2] * buffer.
z));
841 y = (int)((mat[1][0] * buffer.
x) + (mat[1][1] * buffer.
y) + (mat[1][2] * buffer.
z));
842 z = (int)((mat[2][0] * buffer.
x) + (mat[2][1] * buffer.
y) + (mat[2][2] * buffer.
z));
866 return !operator==(other);
888 template <
typename T>
890 template <
typename T>
892 template <
typename T>
894 template <
typename T>
896 template <
typename T>
898 template <
typename T>
900 template <
typename T>
902 template <
typename T>