10 #ifndef __UT_Matrix3_h__
11 #define __UT_Matrix3_h__
38 template <
typename T,
typename S>
40 template <
typename T,
typename S>
42 template <
typename T,
typename S>
44 template <
typename T,
typename S>
46 template <
typename T,
typename S>
48 template <
typename T,
typename S>
50 template <
typename T,
typename S>
52 template <
typename T,
typename S>
54 template <
typename T,
typename S>
56 template <
typename T,
typename S>
58 template <
typename T,
typename S>
60 template <
typename T,
typename S>
67 template <
typename T,
typename S>
71 template <
typename T,
typename S>
78 template <
typename T,
typename S>
81 {
return v0 * (1 - u -
v) + v1 * u + v2 *v; }
97 static constexpr
int tuple_size = 9;
116 template <
typename S>
117 explicit constexpr
UT_Matrix3T(
const S m[3][3]) noexcept
119 {
T(m[0][0]),
T(m[0][1]),
T(m[0][2])},
120 {
T(m[1][0]),
T(m[1][1]),
T(m[1][2])},
121 {
T(m[2][0]),
T(m[2][1]),
T(m[2][2])}}
138 T val00,
T val01,
T val02,
139 T val10,
T val11,
T val12,
140 T val20,
T val21,
T val22) noexcept
148 template <
typename S>
151 {
T(m(0,0)),
T(m(0,1)),
T(m(0,2))},
152 {
T(m(1,0)),
T(m(1,1)),
T(m(1,2))},
153 {
T(m(2,0)),
T(m(2,1)),
T(m(2,2))}}
159 template <
typename S>
177 template <
typename S>
180 matx[0][0]=m(0,0); matx[0][1]=m(0,1); matx[0][2]=m(0,2);
181 matx[1][0]=m(1,0); matx[1][1]=m(1,1); matx[1][2]=m(1,2);
182 matx[2][0]=m(2,0); matx[2][1]=m(2,1); matx[2][2]=m(2,2);
187 template <
typename S>
192 matx[0][0] = l.q00; matx[0][1] = l.q10; matx[0][2] = l.q20;
193 matx[1][0] = l.q10; matx[1][1] = l.q11; matx[1][2] = l.q21;
194 matx[2][0] = l.q20; matx[2][1] = l.q21; matx[2][2] = l.q22;
202 matx[1][0], matx[1][1],
203 matx[2][0], matx[2][1], matx[2][2]);
210 matx[0][1], matx[1][1],
211 matx[0][2], matx[1][2], matx[2][2]);
218 (matx[0][1] + matx[1][0]) / 2,
220 (matx[0][2] + matx[2][0]) / 2,
221 (matx[1][2] + matx[2][1]) / 2,
228 -matx[1][0], -matx[1][1], -matx[1][2],
229 -matx[2][0], -matx[2][1], -matx[2][2]);
236 matx[0][0]+=k*m.
matx[0][0];
237 matx[0][1]+=k*m.
matx[0][1];
238 matx[0][2]+=k*m.
matx[0][2];
240 matx[1][0]+=k*m.
matx[1][0];
241 matx[1][1]+=k*m.
matx[1][1];
242 matx[1][2]+=k*m.
matx[1][2];
244 matx[2][0]+=k*m.
matx[2][0];
245 matx[2][1]+=k*m.
matx[2][1];
246 matx[2][2]+=k*m.
matx[2][2];
251 matx[0][0]+=m.
matx[0][0];
252 matx[0][1]+=m.
matx[0][1];
253 matx[0][2]+=m.
matx[0][2];
255 matx[1][0]+=m.
matx[1][0];
256 matx[1][1]+=m.
matx[1][1];
257 matx[1][2]+=m.
matx[1][2];
259 matx[2][0]+=m.
matx[2][0];
260 matx[2][1]+=m.
matx[2][1];
261 matx[2][2]+=m.
matx[2][2];
267 matx[0][0]-=m.
matx[0][0];
268 matx[0][1]-=m.
matx[0][1];
269 matx[0][2]-=m.
matx[0][2];
271 matx[1][0]-=m.
matx[1][0];
272 matx[1][1]-=m.
matx[1][1];
273 matx[1][2]-=m.
matx[1][2];
275 matx[2][0]-=m.
matx[2][0];
276 matx[2][1]-=m.
matx[2][1];
277 matx[2][2]-=m.
matx[2][2];
284 a = matx[0][0]; b = matx[0][1]; c = matx[0][2];
285 matx[0][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
286 matx[0][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
287 matx[0][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
289 a = matx[1][0]; b = matx[1][1]; c = matx[1][2];
290 matx[1][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
291 matx[1][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
292 matx[1][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
294 a = matx[2][0]; b = matx[2][1]; c = matx[2][2];
295 matx[2][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
296 matx[2][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
297 matx[2][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
302 template <
typename S>
310 a = matx[0][0]; b = matx[0][1]; c = matx[0][2];
311 matx[0][0] = a*l.q00 + b*l.q10 + c*l.q20;
312 matx[0][1] = a*l.q10 + b*l.q11 + c*l.q21;
313 matx[0][2] = a*l.q20 + b*l.q21 + c*l.q22;
315 a = matx[1][0]; b = matx[1][1]; c = matx[1][2];
316 matx[1][0] = a*l.q00 + b*l.q10 + c*l.q20;
317 matx[1][1] = a*l.q10 + b*l.q11 + c*l.q21;
318 matx[1][2] = a*l.q20 + b*l.q21 + c*l.q22;
320 a = matx[2][0]; b = matx[2][1]; c = matx[2][2];
321 matx[2][0] = a*l.q00 + b*l.q10 + c*l.q20;
322 matx[2][1] = a*l.q10 + b*l.q11 + c*l.q21;
323 matx[2][2] = a*l.q20 + b*l.q21 + c*l.q22;
329 template <
typename S>
337 a = matx[0][0]; b = matx[1][0]; c = matx[2][0];
338 matx[0][0] = a*l.q00 + b*l.q10 + c*l.q20;
339 matx[1][0] = a*l.q10 + b*l.q11 + c*l.q21;
340 matx[2][0] = a*l.q20 + b*l.q21 + c*l.q22;
342 a = matx[0][1]; b = matx[1][1]; c = matx[2][1];
343 matx[0][1] = a*l.q00 + b*l.q10 + c*l.q20;
344 matx[1][1] = a*l.q10 + b*l.q11 + c*l.q21;
345 matx[2][1] = a*l.q20 + b*l.q21 + c*l.q22;
347 a = matx[0][2]; b = matx[1][2]; c = matx[2][2];
348 matx[0][2] = a*l.q00 + b*l.q10 + c*l.q20;
349 matx[1][2] = a*l.q10 + b*l.q11 + c*l.q21;
350 matx[2][2] = a*l.q20 + b*l.q21 + c*l.q22;
354 template <
typename S>
359 a = matx[0][0]; b = matx[1][0]; c = matx[2][0];
360 matx[0][0] = a*m(0,0) + b*m(0,1) + c*m(0,2);
361 matx[1][0] = a*m(1,0) + b*m(1,1) + c*m(1,2);
362 matx[2][0] = a*m(2,0) + b*m(2,1) + c*m(2,2);
364 a = matx[0][1]; b = matx[1][1]; c = matx[2][1];
365 matx[0][1] = a*m(0,0) + b*m(0,1) + c*m(0,2);
366 matx[1][1] = a*m(1,0) + b*m(1,1) + c*m(1,2);
367 matx[2][1] = a*m(2,0) + b*m(2,1) + c*m(2,2);
369 a = matx[0][2]; b = matx[1][2]; c = matx[2][2];
370 matx[0][2] = a*m(0,0) + b*m(0,1) + c*m(0,2);
371 matx[1][2] = a*m(1,0) + b*m(1,1) + c*m(1,2);
372 matx[2][2] = a*m(2,0) + b*m(2,1) + c*m(2,2);
380 return (&m ==
this) || (
381 matx[0][0]==m(0,0) && matx[0][1]==m(0,1) && matx[0][2]==m(0,2) &&
382 matx[1][0]==m(1,0) && matx[1][1]==m(1,1) && matx[1][2]==m(1,2) &&
383 matx[2][0]==m(2,0) && matx[2][1]==m(2,1) && matx[2][2]==m(2,2) );
387 return !(*
this == m);
393 matx[0][0] =
val; matx[0][1] = 0; matx[0][2] = 0;
394 matx[1][0] = 0; matx[1][1] =
val; matx[1][2] = 0;
395 matx[2][0] = 0; matx[2][1] = 0; matx[2][2] =
val;
401 matx[0][0]*=scalar; matx[0][1]*=scalar; matx[0][2]*=scalar;
402 matx[1][0]*=scalar; matx[1][1]*=scalar; matx[1][2]*=scalar;
403 matx[2][0]*=scalar; matx[2][1]*=scalar; matx[2][2]*=scalar;
413 template <
typename S>
415 template <
typename S>
417 template <
typename S>
423 template <
typename S>
424 inline void outerproductUpdateT(
T b,
431 { outerproductUpdateT(b, v1, v2); }
436 { outerproductUpdateT(b, v1, v2); }
442 template <
typename S>
460 void arbitrary180rot();
465 template <
typename S>
481 template <
typename S>
485 template <
typename S>
499 template <
typename S>
502 template <
typename S>
514 template <
typename S>
516 template <
typename S>
529 template <
typename S>
538 { orientT(v, pscale, s3, up, q); }
543 { orientT(v, pscale, s3, up, q); }
544 template <
typename S>
553 { orientInverseT(v, pscale, s3, up, q); }
558 { orientInverseT(v, pscale, s3, up, q); }
574 return matx[r[0]][c[0]]*matx[r[1]][c[1]] -
575 matx[r[0]][c[1]]*matx[r[1]][c[0]];
580 return(matx[0][0]*coFactor(0,0) +
581 matx[0][1]*coFactor(0,1) +
582 matx[0][2]*coFactor(0,2));
585 {
return matx[0][0] + matx[1][1] + matx[2][2]; }
591 template <
typename S>
609 int invertKramer(
UT_Matrix3T<T> &m,
T abs_det_threshold = FLT_EPSILON)
const;
612 int invertKramer(
T abs_det_threshold = FLT_EPSILON);
622 int safeInvertSymmetric(
T tol=1e-6
f);
656 tmp=matx[0][1]; matx[0][1]=matx[1][0]; matx[1][0]=tmp;
657 tmp=matx[0][2]; matx[0][2]=matx[2][0]; matx[2][0]=tmp;
658 tmp=matx[1][2]; matx[1][2]=matx[2][1]; matx[2][1]=tmp;
663 matx[0][1], matx[1][1], matx[2][1],
664 matx[0][2], matx[1][2], matx[2][2]);
671 return (&m ==
this) || (
687 return (&m ==
this) || (
688 SYSalmostEqual( matx[0][0], m.
matx[0][0], ulps ) &&
689 SYSalmostEqual( matx[0][1], m.
matx[0][1], ulps ) &&
690 SYSalmostEqual( matx[0][2], m.
matx[0][2], ulps ) &&
692 SYSalmostEqual( matx[1][0], m.
matx[1][0], ulps ) &&
693 SYSalmostEqual( matx[1][1], m.
matx[1][1], ulps ) &&
694 SYSalmostEqual( matx[1][2], m.
matx[1][2], ulps ) &&
696 SYSalmostEqual( matx[2][0], m.
matx[2][0], ulps ) &&
697 SYSalmostEqual( matx[2][1], m.
matx[2][1], ulps ) &&
698 SYSalmostEqual( matx[2][2], m.
matx[2][2], ulps ) );
716 template <
typename S>
719 template<UT_Axis3::axis A>
725 template<UT_Axis3::axis A,
bool reverse=false>
735 matx[
row][col0] = -matx[
row][col1];
736 matx[
row][col1] =
v1;
740 matx[
row][col0] = matx[
row][col1];
741 matx[
row][col1] = -
v1;
748 template<UT_Axis3::axis A>
756 matx[
row][col0] = -matx[
row][col0];
757 matx[
row][col1] = -matx[
row][col1];
763 template<UT_Axis3::axis A>
779 template <
typename S>
786 template <
typename S>
789 template<UT_Axis3::axis A>
790 void prerotate(
T theta);
795 template<UT_Axis3::axis A,
bool reverse=false>
801 for (
uint col = 0; col < 3; ++col)
802 v1[col] = matx[row0][col];
805 for (
uint col = 0; col < 3; ++col)
806 matx[row0][col] = matx[row1][col];
807 for (
uint col = 0; col < 3; ++col)
808 matx[row1][col] = -v1[col];
812 for (
uint col = 0; col < 3; ++col)
813 matx[row0][col] = -matx[row1][col];
814 for (
uint col = 0; col < 3; ++col)
815 matx[row1][col] = v1[col];
821 template<UT_Axis3::axis A>
827 for (
uint col = 0; col < 3; ++col)
828 matx[row0][col] = -matx[row0][col];
829 for (
uint col = 0; col < 3; ++col)
830 matx[row1][col] = -matx[row1][col];
836 void prerotate(
T rx,
T ry,
T rz,
839 { prerotate(rad(0), rad(1), rad(2), order); }
849 {
rotate(rad(0), rad(1), rad(2), ord); }
856 matx[0][0] *= sx; matx[0][1] *= sy; matx[0][2] *= sz;
857 matx[1][0] *= sx; matx[1][1] *= sy; matx[1][2] *= sz;
858 matx[2][0] *= sx; matx[2][1] *= sy; matx[2][2] *= sz;
869 matx[0][0] *= sx; matx[1][0] *= sy; matx[2][0] *= sz;
870 matx[0][1] *= sx; matx[1][1] *= sy; matx[2][1] *= sz;
871 matx[0][2] *= sx; matx[1][2] *= sy; matx[2][2] *= sz;
875 { prescale(
s(0),
s(1),
s(2)); }
881 matx[0][0] = -matx[0][0]; matx[0][1] = -matx[0][1]; matx[0][2] = -matx[0][2];
882 matx[1][0] = -matx[1][0]; matx[1][1] = -matx[1][1]; matx[1][2] = -matx[1][2];
883 matx[2][0] = -matx[2][0]; matx[2][1] = -matx[2][1]; matx[2][2] = -matx[2][2];
890 matx[0][0] += matx[0][2] * dx;
891 matx[0][1] += matx[0][2] * dy;
892 matx[1][0] += matx[1][2] * dx;
893 matx[1][1] += matx[1][2] * dy;
894 matx[2][0] += matx[2][2] * dx;
895 matx[2][1] += matx[2][2] * dy;
906 matx[2][0] += matx[0][0] * dx + matx[1][0] * dy;
907 matx[2][1] += matx[0][1] * dx + matx[1][1] * dy;
908 matx[2][2] += matx[0][2] * dx + matx[1][2] * dy;
912 { pretranslate(delta(0), delta(1)); }
922 template <
typename S>
924 template <
typename S>
925 int crack2D(
S &
r)
const;
935 template <
typename S>
939 const int max_iter = 64,
940 const T rel_tol = FLT_EPSILON)
const;
945 template <
typename S>
962 const int max_iter = 64,
963 const T rel_tol = FLT_EPSILON);
975 bool makeRotationMatrix(
978 const int max_iter = 64,
979 const T rel_tol = FLT_EPSILON);
987 template <
typename S>
990 { conditionRotateT(scales); }
992 { conditionRotateT(scales); }
1000 template <
typename S>
1003 { extractScalesT(scales, shears); }
1005 { extractScalesT(scales, shears); }
1008 { extractScalesT(scales, shears); }
1014 template <
typename S>
1021 template <
typename S>
1028 template <
typename S>
1030 S *shears =
nullptr);
1034 void shearXY(
T val);
1035 void shearXZ(
T val);
1036 void shearYZ(
T val);
1042 matx[0][0] += matx[0][1]*s_xy + matx[0][2]*s_xz;
1043 matx[0][1] += matx[0][2]*s_yz;
1045 matx[1][0] += matx[1][1]*s_xy + matx[1][2]*s_xz;
1046 matx[1][1] += matx[1][2]*s_yz;
1048 matx[2][0] += matx[2][1]*s_xy + matx[2][2]*s_xz;
1049 matx[2][1] += matx[2][2]*s_yz;
1053 {
shear(sh(0), sh(1), sh(2)); }
1059 template <
typename S>
1062 template <
typename S>
1069 template <
typename S>
1070 int solveTranspose(
T cx,
T cy,
T cz,
1072 template <
typename S>
1082 template <
typename S>
1096 T tx=0,
T ty=0,
T rz=0,
1097 T sx=1,
T sy=1,
T px=0,
T py=0,
1111 template <
typename S>
1113 template <
typename S>
1119 int isNormalized() const;
1122 T dot(
unsigned i,
unsigned j)
const
1124 return rowDot( i, j );
1136 matx[0][0]==1 && matx[0][1]==0 &&
1137 matx[0][2]==0 && matx[1][0]==0 &&
1138 matx[1][1]==1 && matx[1][2]==0 &&
1139 matx[2][0]==0 && matx[2][1]==0 &&
1148 matx[0][0]==0 && matx[0][1]==0 &&
1149 matx[0][2]==0 && matx[1][0]==0 &&
1150 matx[1][1]==0 && matx[1][2]==0 &&
1151 matx[2][0]==0 && matx[2][1]==0 &&
1158 const T *
data()
const {
return myFloats; }
1163 unsigned hash()
const {
return SYSvector_hash(
data(), tuple_size); }
1170 return matx[
row][col];
1176 return matx[
row][col];
1203 {
return SYSsqrt(getEuclideanNorm2()); }
1205 T getEuclideanNorm2()
const;
1217 T getNormInf()
const;
1221 T getNormMax()
const;
1225 T getNormSpectral()
const;
1228 int save(std::ostream &os,
int binary)
const;
1231 void outAsciiNoName(std::ostream &os)
const;
1236 friend std::ostream &operator<<(std::ostream &os, const UT_Matrix3T<T> &
v)
1238 v.writeClassName(os);
1239 v.outAsciiNoName(os);
1257 template <
int ORDER>
1264 static uint reduceExactQuarterTurns(
T &angle_degrees);
1273 void coVals(
int k,
int r[2])
const
1277 case 0: r[0] = 1; r[1] = 2;
break;
1278 case 1: r[0] = 0; r[1] = 2;
break;
1279 case 2: r[0] = 0; r[1] = 1;
break;
1284 void writeClassName(std::ostream &os)
const;
1285 static const char *className();
1292 return (i <= 2 && j <= 2) ?
1293 matx[i][0]*matx[
j][0] +
1294 matx[i][1]*matx[
j][1] +
1295 matx[i][2]*matx[
j][2] : (
T)0;
1301 T myFloats[tuple_size];
1312 template <
typename T>
1313 template <
typename S>
1317 matx[0][0] = matx[0][1] = matx[0][2] = vec.
x();
1318 matx[1][0] = matx[1][1] = matx[1][2] = vec.
y();
1319 matx[2][0] = matx[2][1] = matx[2][2] = vec.
z();
1323 template <
typename T>
1324 template <
typename S>
1328 T x = vec.
x();
T y = vec.
y();
T z = vec.
z();
1329 matx[0][0]+=
x; matx[0][1]+=
x; matx[0][2]+=
x;
1330 matx[1][0]+=
y; matx[1][1]+=
y; matx[1][2]+=
y;
1331 matx[2][0]+=
z; matx[2][1]+=
z; matx[2][2]+=
z;
1335 template <
typename T>
1336 template <
typename S>
1340 T x = vec.
x();
T y = vec.
y();
T z = vec.
z();
1341 matx[0][0]-=
x; matx[0][1]-=
x; matx[0][2]-=
x;
1342 matx[1][0]-=
y; matx[1][1]-=
y; matx[1][2]-=
y;
1343 matx[2][0]-=
z; matx[2][1]-=
z; matx[2][2]-=
z;
1347 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1353 v4uf r2(m(2,0), m(2,1), m(2,2), 0.
f);
1357 const float m10 =
matx[1][0];
1358 const float m20 =
matx[2][0];
1379 matx[2][0] = row[0];
1380 matx[2][1] = row[1];
1381 matx[2][2] = row[2];
1390 v4uf r0(l.q00, l.q10, l.q20, 0.f);
1391 v4uf r1(l.q10, l.q11, l.q21, 0.f);
1392 v4uf r2(l.q20, l.q21, l.q22, 0.f);
1396 const float m10 =
matx[1][0];
1397 const float m20 =
matx[2][0];
1418 matx[2][0] = row[0];
1419 matx[2][1] = row[1];
1420 matx[2][2] = row[2];
1428 template <
typename T>
1429 template <
typename S>
1437 matx[0][0]+=bv1*v2.
x();
1438 matx[0][1]+=bv1*v2.
y();
1439 matx[0][2]+=bv1*v2.
z();
1441 matx[1][0]+=bv1*v2.
x();
1442 matx[1][1]+=bv1*v2.
y();
1443 matx[1][2]+=bv1*v2.
z();
1445 matx[2][0]+=bv1*v2.
x();
1446 matx[2][1]+=bv1*v2.
y();
1447 matx[2][2]+=bv1*v2.
z();
1450 template <
typename T>
1458 template <
typename T>
1468 template <
typename T,
typename S>
1475 template <
typename T,
typename S>
1482 template <
typename T,
typename S>
1486 return (m1 * (
T(1)/scalar));
1508 template <
typename T,
typename S>
1510 template <
typename T,
typename S>
1514 template <
typename T,
typename S>
1519 v.
x()*m(0,0) + v.
y()*m(1,0) + v.
z()*m(2,0),
1520 v.
x()*m(0,1) + v.
y()*m(1,1) + v.
z()*m(2,1),
1521 v.
x()*m(0,2) + v.
y()*m(1,2) + v.
z()*m(2,2)
1525 template <
typename T,
typename S>
1532 template <
typename T,
typename S>
1537 v.
x()*m(0,0) + v.
y()*m(0,1) + v.
z()*m(0,2),
1538 v.
x()*m(1,0) + v.
y()*m(1,1) + v.
z()*m(1,2),
1539 v.
x()*m(2,0) + v.
y()*m(2,1) + v.
z()*m(2,2)
1543 template <
typename T>
1549 template <
typename T>
1555 template <
typename T>
1561 template <
typename T>
1567 template <
typename T>
1568 template <
typename S>
1575 template <
typename T>
1576 template <
typename S>
1582 template <
typename T>
1583 template <
typename S>
1589 template <
typename T>
1590 template <
typename S>
1597 template <
typename T>
1603 template <
typename T>
1620 template <
typename T>
1637 template <
typename T,
typename S>
1654 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1668 vm_store(result.
data() + 4,
SYSlerp(l, r, t).vector);
1677 template<
typename T, ex
int D >
1680 template<
typename T>
1690 template<
typename T>
1696 template <
typename T>
1699 template<
typename TS >
1705 as[ 0], as[ 1], as[ 2],
1706 as[ 3], as[ 4], as[ 5],
1707 as[ 6], as[ 7], as[ 8]
1715 template<
typename TS >
1727 template <
typename V >
1731 template <
typename T>
1734 template <
typename T>
template<
int ORDER>
1741 if(rx) rotate<UT_Axis3::XAXIS>(rx);
1742 if(ry) rotate<UT_Axis3::YAXIS>(ry);
1743 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
1748 if(rx) rotate<UT_Axis3::XAXIS>(rx);
1749 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
1750 if(ry) rotate<UT_Axis3::YAXIS>(ry);
1755 if(ry) rotate<UT_Axis3::YAXIS>(ry);
1756 if(rx) rotate<UT_Axis3::XAXIS>(rx);
1757 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
1762 if(ry) rotate<UT_Axis3::YAXIS>(ry);
1763 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
1764 if(rx) rotate<UT_Axis3::XAXIS>(rx);
1769 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
1770 if(rx) rotate<UT_Axis3::XAXIS>(rx);
1771 if(ry) rotate<UT_Axis3::YAXIS>(ry);
1776 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
1777 if(ry) rotate<UT_Axis3::YAXIS>(ry);
1778 if(rx) rotate<UT_Axis3::XAXIS>(rx);
static int entries()
Returns the vector size.
UT_Vector3T< T > rowVecMult(const UT_Vector3T< T > &v, const UT_Matrix3T< S > &m)
SYS_FORCE_INLINE T & operator()(unsigned row, unsigned col) noexcept
Return a matrix entry. No bounds checking on subscripts.
UT_Matrix3T< T > & operator=(const UT_SymMatrix3T< S > &m)
Convert from a symmetric matrix to non-symmetric.
Mat3< typename promote< S, T >::type > operator*(S scalar, const Mat3< T > &m)
Multiply each element of the given matrix by scalar and return the result.
SYS_FORCE_INLINE T coFactor(int k, int l) const
SYS_FORCE_INLINE UT_Matrix3T< T > & operator/=(T scalar)
void leftMult(const UT_SymMatrix3T< S > &m)
Multiply given symmetric matrix on the left.
#define SYS_STATIC_ASSERT(expr)
UT_Matrix3T< T > transposedCopy() const
UT_SymMatrix3T< T > averagedSymMatrix3() const
Convert this to a symmetric matrix, using averaged components.
#define SYS_DEPRECATED(__V__)
UT_SymMatrix3T< T > upperTriangularSymMatrix3() const
Convert this to a symmetric matrix, using the upper-triangular portion.
void leftMult(const UT_Matrix3T< S > &m)
Multiply given matrix3 on the left.
constexpr bool operator!=(const UT_Matrix3T< T > &m) const noexcept
void orientInverse(const UT_Vector3F &v, T pscale, const UT_Vector3F *s3, const UT_Vector3F *up, const UT_QuaternionF *q)
const T * operator()(unsigned row) const
Return a matrix row. No bounds checking on subscript.
SYS_FORCE_INLINE void translate(const UT_Vector2T< T > &delta)
SYS_FORCE_INLINE void prerotateQuarter()
void scale(T sx, T sy, T sz)
MatType shear(Axis axis0, Axis axis1, typename MatType::value_type shear)
Set the matrix to a shear along axis0 by a fraction of axis1.
constexpr bool operator==(const UT_Matrix3T< T > &m) const noexcept
SYS_FORCE_INLINE void colVecMult(const UT_Matrix3F &m)
UT_Matrix3T< T > & operator*=(const UT_Matrix3T< T > &m)
Mat3< typename promote< T0, T1 >::type > operator+(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Add corresponding elements of m0 and m1 and return the result.
UT_Matrix3T(const UT_SymMatrix3T< S > m)
Construct from a symmetric 3x3 matrix.
void extractScales(UT_Vector3F &scales, UT_Vector3F *shears=0)
SYS_FORCE_INLINE T operator()(unsigned row, unsigned col) const noexcept
Return a matrix entry. No bounds checking on subscripts.
const GLuint GLenum const void * binary
GA_API const UT_StringHolder rot
GLdouble GLdouble GLdouble z
typename SYS_FixedArrayElement< T >::type SYS_FixedArrayElement_t
void prerotate(const UT_Vector3T< T > &rad, const UT_XformOrder &order)
UT_Matrix3T< T > SYSmax(const UT_Matrix3T< T > &v1, const UT_Matrix3T< T > &v2)
constexpr SYS_FORCE_INLINE T & z() noexcept
const LowerTri & lowerTri() const
Return reference to the lower triangular elements for symbolic access.
GLboolean GLboolean GLboolean GLboolean a
UT_API size_t format(char *buffer, size_t buffer_size, const UT_Matrix3T< T > &v)
void reverse(I begin, I end)
SYS_FORCE_INLINE UT_Matrix3T< T > & operator+=(const UT_Matrix3T< T > &m)
JSON reader class which handles parsing of JSON or bJSON files.
Generic symmetric 3x3 matrix.
T * operator()(unsigned row)
Return a matrix row. No bounds checking on subscript.
Class which writes ASCII or binary JSON streams.
void extractScales(UT_Vector3T< fpreal16 > &scales, UT_Vector3T< fpreal16 > *shears=0)
void prescale(T sx, T sy, T sz)
**But if you need a result
static const exint TupleSize
GLfloat GLfloat GLfloat v2
GLdouble GLdouble GLdouble q
void orient(const UT_Vector3D &v, T pscale, const UT_Vector3D *s3, const UT_Vector3D *up, const UT_QuaternionD *q)
UT_Matrix3T< T > SYSmin(const UT_Matrix3T< T > &v1, const UT_Matrix3T< T > &v2)
constexpr SYS_FORCE_INLINE UT_Vector3T & operator*=(const T &a) noexcept
const T * data() const
Return the raw matrix data.
SYS_FORCE_INLINE void pretranslate(const UT_Vector2T< T > &delta)
SYS_FORCE_INLINE void rotateQuarter()
SYS_FORCE_INLINE void prescale(const UT_Vector3T< T > &s)
UT_Matrix3T< T > SYSbilerp(const UT_Matrix3T< T > &u0v0, const UT_Matrix3T< T > &u1v0, const UT_Matrix3T< T > &u0v1, const UT_Matrix3T< T > &u1v1, S u, S v)
Bilinear interpolation.
SYS_FORCE_INLINE void outerproductUpdate(T b, const UT_Vector3F &v1, const UT_Vector3F &v2)
GA_API const UT_StringHolder scale
SYS_FORCE_INLINE void shear(const UT_Vector3T< T > &sh)
SYS_FORCE_INLINE void negate()
Negates this matrix, i.e. multiplies it by -1.
SYS_FORCE_INLINE void multiplyT(const UT_Matrix3T< S > &mat)
bool isEqual(const UT_Matrix3T< T > &m, T tolerance=T(SYS_FTOLERANCE)) const
Check for equality within a tolerance level.
void identity()
Set the matrix to identity.
UT_Matrix3T< T > SYSlerp(const UT_Matrix3T< T > &v1, const UT_Matrix3T< T > &v2, S t)
constexpr UT_Matrix3T< SYS_FixedArrayElement_t< TS > > UTmakeMatrix3T(const TS &as) noexcept
Mat3< typename promote< T0, T1 >::type > operator-(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Subtract corresponding elements of m0 and m1 and return the result.
OIIO_FORCEINLINE const vint4 & operator+=(vint4 &a, const vint4 &b)
SYS_FORCE_INLINE void scale(const UT_Vector3T< T > &s)
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
static const bool isVectorType
void outerproductUpdateT(T b, const UT_Vector3T< S > &v1, const UT_Vector3T< S > &v2)
UT_Matrix3T< T > SYSbarycentric(const UT_Matrix3T< T > &v0, const UT_Matrix3T< T > &v1, const UT_Matrix3T< T > &v2, S u, S v)
Barycentric interpolation.
SYS_FORCE_INLINE void rowVecMult(const UT_Matrix3F &m)
SYS_FORCE_INLINE void outerproductUpdate(T b, const UT_Vector3D &v1, const UT_Vector3D &v2)
GLdouble GLdouble GLint GLint order
UT_Matrix3T< T > & operator=(const UT_Matrix3T< S > &m) noexcept
constexpr UT_Matrix3T(fpreal64 val) noexcept
Construct identity matrix, multipled by scalar.
GLboolean GLboolean GLboolean b
void orientInverse(const UT_Vector3D &v, T pscale, const UT_Vector3D *s3, const UT_Vector3D *up, const UT_QuaternionD *q)
ImageBuf OIIO_API rotate(const ImageBuf &src, float angle, string_view filtername=string_view(), float filterwidth=0.0f, bool recompute_roi=false, ROI roi={}, int nthreads=0)
void translate(T dx, T dy)
GA_API const UT_StringHolder orient
IMATH_HOSTDEVICE const Vec2< S > & operator*=(Vec2< S > &v, const Matrix22< T > &m) IMATH_NOEXCEPT
Vector-matrix multiplication: v *= m.
UT_SymMatrix3T< T > lowerTriangularSymMatrix3() const
Convert this to a symmetric matrix, using the lower-triangular portion.
UT_Matrix3T< T > & operator=(const UT_Matrix3T< T > &m)=default
Default copy assignment operator.
UT_Matrix3T< T > & operator*=(const UT_SymMatrix3T< S > &m)
Multiply given symmetric matrix on the right.
SYS_FORCE_INLINE void rotateHalf()
UT_Matrix3T< T > operator-() const
const UT_Vector3T< T > & operator[](unsigned row) const
Return a matrix row. No bounds checking on subscript.
bool SYSequalZero(const UT_Vector3T< T > &v)
void shear(T s_xy, T s_xz, T s_yz)
Inner class to access the elements symbolically.
static UT_Matrix3T< T > reflectMat(const UT_Vector3T< S > &plane_normal)
GA_API const UT_StringHolder up
bool isSymmetric(const MatType &m)
Determine if a matrix is symmetric.
LeafData & operator=(const LeafData &)=delete
constexpr SYS_FORCE_INLINE UT_Matrix3T< T > operator()(const TS &as) const noexcept
SYS_FORCE_INLINE UT_Matrix3T< T > & operator-=(const UT_Matrix3T< T > &m)
void extractScales(UT_Vector3D &scales, UT_Vector3D *shears=0)
UT_Vector3T< T > colVecMult(const UT_Matrix3T< S > &m, const UT_Vector3T< T > &v)
GA_API const UT_StringHolder pscale
unsigned hash() const
Compute a hash.
Class to store JSON objects as C++ objects.
SYS_FORCE_INLINE void addScaledMat(T k, const UT_Matrix3T< T > &m)
bool isAlmostEqual(const UT_Matrix3T< T > &m, int ulps=50) const
T getEuclideanNorm() const
OIIO_FORCEINLINE const vint4 & operator-=(vint4 &a, const vint4 &b)
void orient(const UT_Vector3F &v, T pscale, const UT_Vector3F *s3, const UT_Vector3F *up, const UT_QuaternionF *q)
void zero()
Set the matrix to zero.
GLubyte GLubyte GLubyte GLubyte w
GLenum GLenum GLsizei void * row
void conditionRotate(UT_Vector3F *scales=0)
void conditionRotate(UT_Vector3D *scales)
void rotate(UT_Vector3T< S > &axis, T theta, int norm=1)
PUGI__FN char_t * translate(char_t *buffer, const char_t *from, const char_t *to, size_t to_length)
T dot(unsigned i, unsigned j) const
SYS_FORCE_INLINE void prerotateHalf()
constexpr SYS_FORCE_INLINE T & y() noexcept
SYS_FORCE_INLINE void multiply(UT_Vector3T< T > &dest, const UT_Matrix4T< S > &mat) const
bool SYSisEqual(const UT_Vector2T< T > &a, const UT_Vector2T< T > &b, S tol=SYS_FTOLERANCE)
Componentwise equality.
UT_Matrix3T< T > operator/(const UT_Matrix3T< T > &mat, S sc)
SYS_FORCE_INLINE void rotateWithQTurns(T theta, uint qturns)
void pretranslate(T dx, T dy)
UT_FixedVector< T, 9 > FixedVectorType
void rotate(const UT_Vector3T< T > &rad, const UT_XformOrder &ord)
SYS_FORCE_INLINE UT_Matrix3T< T > & operator*=(T scalar)
bool isLowerTriangular(T tolerance=T(SYS_FTOLERANCE)) const
Check for lower triangular within a tolerance level to 0.
T * data()
Return the raw matrix data.
constexpr SYS_FORCE_INLINE T & x() noexcept