10 #ifndef __UT_Matrix4_h__
11 #define __UT_Matrix4_h__
26 #ifndef UT_DISABLE_VECTORIZE_MATRIX
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>
62 template <
typename T,
typename S>
64 template <
typename T,
typename S>
66 template <
typename T,
typename S>
73 template <
typename T,
typename S>
77 template <
typename T,
typename S>
84 template <
typename T,
typename S>
87 {
return v0 * (1 - u -
v) + v1 * u + v2 *v; }
101 static constexpr
const int tuple_size = 16;
124 template <
typename S>
125 explicit constexpr
UT_Matrix4T(
const S m[4][4]) noexcept
127 {
T(m[0][0]),
T(m[0][1]),
T(m[0][2]),
T(m[0][3])},
128 {
T(m[1][0]),
T(m[1][1]),
T(m[1][2]),
T(m[1][3])},
129 {
T(m[2][0]),
T(m[2][1]),
T(m[2][2]),
T(m[2][3])},
130 {
T(m[3][0]),
T(m[3][1]),
T(m[3][2]),
T(m[3][3])}}
136 T val10,
T val11,
T val12,
T val13,
137 T val20,
T val21,
T val22,
T val23,
138 T val30,
T val31,
T val32,
T val33) noexcept
139 : matx{{
T(val00),
T(val01),
T(val02),
T(val03)},
140 {
T(val10),
T(val11),
T(val12),
T(val13)},
141 {
T(val20),
T(val21),
T(val22),
T(val23)},
142 {
T(val30),
T(val31),
T(val32),
T(val33)}}
147 template <
typename S>
150 matx[0][0]=m(0,0); matx[0][1]=m(0,1); matx[0][2]=m(0,2); matx[0][3]=m(0,3);
151 matx[1][0]=m(1,0); matx[1][1]=m(1,1); matx[1][2]=m(1,2); matx[1][3]=m(1,3);
152 matx[2][0]=m(2,0); matx[2][1]=m(2,1); matx[2][2]=m(2,2); matx[2][3]=m(2,3);
153 matx[3][0]=m(3,0); matx[3][1]=m(3,1); matx[3][2]=m(3,2); matx[3][3]=m(3,3);
155 template <
typename S>
158 matx[0][0]=m(0,0); matx[0][1]=m(0,1); matx[0][2]=m(0,2); matx[0][3]=(
T)0.;
159 matx[1][0]=m(1,0); matx[1][1]=m(1,1); matx[1][2]=m(1,2); matx[1][3]=(
T)0.;
160 matx[2][0]=m(2,0); matx[2][1]=m(2,1); matx[2][2]=m(2,2); matx[2][3]=(
T)0.;
161 matx[3][0]=(
T)0.; matx[3][1]=(
T)0.; matx[3][2]=(
T)0.; matx[3][3]=(
T)1.;
164 template <
typename S,
typename U>
167 matx[0][0]=m(0,0); matx[0][1]=m(0,1); matx[0][2]=m(0,2); matx[0][3]=(
T)0.;
168 matx[1][0]=m(1,0); matx[1][1]=m(1,1); matx[1][2]=m(1,2); matx[1][3]=(
T)0.;
169 matx[2][0]=m(2,0); matx[2][1]=m(2,1); matx[2][2]=m(2,2); matx[2][3]=(
T)0.;
170 matx[3][0]=(
T)t[0]; matx[3][1]=(
T)t[1]; matx[3][2]=(
T)t[2]; matx[3][3]=(
T)1.;
188 template <
typename S>
191 matx[0][0]=m(0,0); matx[0][1]=m(0,1);
192 matx[0][2]=m(0,2); matx[0][3]=(
T)0.;
193 matx[1][0]=m(1,0); matx[1][1]=m(1,1);
194 matx[1][2]=m(1,2); matx[1][3]=(
T)0.;
195 matx[2][0]=m(2,0); matx[2][1]=m(2,1);
196 matx[2][2]=m(2,2); matx[2][3]=(
T)0.;
197 matx[3][0]=(
T)0.; matx[3][1]=(
T)0.;
198 matx[3][2]=(
T)0.; matx[3][3]=(
T)1.;
202 template <
typename S>
205 matx[0][0]=m(0,0); matx[0][1]=m(0,1);
206 matx[0][2]=m(0,2); matx[0][3]=m(0,3);
207 matx[1][0]=m(1,0); matx[1][1]=m(1,1);
208 matx[1][2]=m(1,2); matx[1][3]=m(1,3);
209 matx[2][0]=m(2,0); matx[2][1]=m(2,1);
210 matx[2][2]=m(2,2); matx[2][3]=m(2,3);
211 matx[3][0]=m(3,0); matx[3][1]=m(3,1);
212 matx[3][2]=m(3,2); matx[3][3]=m(3,3);
217 template <
typename S>
220 matx[0][0] = m.q00; matx[0][1] = m.q01; matx[0][2] = m.q02;
221 matx[0][3] = m.q03; matx[1][0] = m.q01; matx[1][1] = m.q11;
222 matx[1][2] = m.q12; matx[1][3] = m.q13; matx[2][0] = m.q02;
223 matx[2][1] = m.q12; matx[2][2] = m.q22; matx[2][3] = m.q23;
224 matx[3][0] = m.q03; matx[3][1] = m.q13; matx[3][2] = m.q23;
232 -matx[0][0], -matx[0][1], -matx[0][2], -matx[0][3],
233 -matx[1][0], -matx[1][1], -matx[1][2], -matx[1][3],
234 -matx[2][0], -matx[2][1], -matx[2][2], -matx[2][3],
235 -matx[3][0], -matx[3][1], -matx[3][2], -matx[3][3]);
241 matx[0][0]+=m.
matx[0][0]; matx[0][1]+=m.
matx[0][1];
242 matx[0][2]+=m.
matx[0][2]; matx[0][3]+=m.
matx[0][3];
244 matx[1][0]+=m.
matx[1][0]; matx[1][1]+=m.
matx[1][1];
245 matx[1][2]+=m.
matx[1][2]; matx[1][3]+=m.
matx[1][3];
247 matx[2][0]+=m.
matx[2][0]; matx[2][1]+=m.
matx[2][1];
248 matx[2][2]+=m.
matx[2][2]; matx[2][3]+=m.
matx[2][3];
250 matx[3][0]+=m.
matx[3][0]; matx[3][1]+=m.
matx[3][1];
251 matx[3][2]+=m.
matx[3][2]; matx[3][3]+=m.
matx[3][3];
257 matx[0][0]-=m.
matx[0][0]; matx[0][1]-=m.
matx[0][1];
258 matx[0][2]-=m.
matx[0][2]; matx[0][3]-=m.
matx[0][3];
260 matx[1][0]-=m.
matx[1][0]; matx[1][1]-=m.
matx[1][1];
261 matx[1][2]-=m.
matx[1][2]; matx[1][3]-=m.
matx[1][3];
263 matx[2][0]-=m.
matx[2][0]; matx[2][1]-=m.
matx[2][1];
264 matx[2][2]-=m.
matx[2][2]; matx[2][3]-=m.
matx[2][3];
266 matx[3][0]-=m.
matx[3][0]; matx[3][1]-=m.
matx[3][1];
267 matx[3][2]-=m.
matx[3][2]; matx[3][3]-=m.
matx[3][3];
279 return (&m ==
this) || (
280 matx[0][0]==m.
matx[0][0] && matx[0][1]==m.
matx[0][1] &&
281 matx[0][2]==m.
matx[0][2] && matx[0][3]==m.
matx[0][3] &&
283 matx[1][0]==m.
matx[1][0] && matx[1][1]==m.
matx[1][1] &&
284 matx[1][2]==m.
matx[1][2] && matx[1][3]==m.
matx[1][3] &&
286 matx[2][0]==m.
matx[2][0] && matx[2][1]==m.
matx[2][1] &&
287 matx[2][2]==m.
matx[2][2] && matx[2][3]==m.
matx[2][3] &&
289 matx[3][0]==m.
matx[3][0] && matx[3][1]==m.
matx[3][1] &&
290 matx[3][2]==m.
matx[3][2] && matx[3][3]==m.
matx[3][3] );
295 return !(*
this == m);
301 matx[0][0]=
v; matx[0][1]= 0; matx[0][2]= 0; matx[0][3]= 0;
302 matx[1][0]= 0; matx[1][1]=
v; matx[1][2]= 0; matx[1][3]= 0;
303 matx[2][0]= 0; matx[2][1]= 0; matx[2][2]=
v; matx[2][3]= 0;
304 matx[3][0]= 0; matx[3][1]= 0; matx[3][2]= 0; matx[3][3]=
v;
314 matx[0][0]*=scalar; matx[0][1]*=scalar;
315 matx[0][2]*=scalar; matx[0][3]*=scalar;
317 matx[1][0]*=scalar; matx[1][1]*=scalar;
318 matx[1][2]*=scalar; matx[1][3]*=scalar;
320 matx[2][0]*=scalar; matx[2][1]*=scalar;
321 matx[2][2]*=scalar; matx[2][3]*=scalar;
323 matx[3][0]*=scalar; matx[3][1]*=scalar;
324 matx[3][2]*=scalar; matx[3][3]*=scalar;
334 template <
typename S>
336 template <
typename S>
338 template <
typename S>
363 det = matx[r[0]][c[0]]*
364 (matx[r[1]][c[1]]*matx[r[2]][c[2]]-
365 matx[r[1]][c[2]]*matx[r[2]][c[1]]) +
367 (matx[r[1]][c[2]]*matx[r[2]][c[0]]-
368 matx[r[1]][c[0]]*matx[r[2]][c[2]]) +
370 (matx[r[1]][c[0]]*matx[r[2]][c[1]]-
371 matx[r[1]][c[1]]*matx[r[2]][c[0]]);
381 return(matx[0][0]*coFactor(0,0) +
382 matx[0][1]*coFactor(0,1) +
383 matx[0][2]*coFactor(0,2) +
384 matx[0][3]*coFactor(0,3) );
390 (matx[1][1]*matx[2][2]-matx[1][2]*matx[2][1]) +
392 (matx[1][2]*matx[2][0]-matx[1][0]*matx[2][2]) +
394 (matx[1][0]*matx[2][1]-matx[1][1]*matx[2][0]) );
398 {
return matx[0][0]+matx[1][1]+matx[2][2]+matx[3][3]; }
440 template <
typename S>
447 template <
typename S>
466 template <
typename S>
477 { instanceT(p, v, s, s3, up, q, tr, orient,
pivot); }
483 { instanceT(p, v, s, s3, up, q, tr, orient,
pivot); }
485 template <
typename S>
496 { instanceInverseT(p, v, s, s3, up, q, tr, orient,
pivot); }
502 { instanceInverseT(p, v, s, s3, up, q, tr, orient,
pivot); }
508 tmp=matx[0][1]; matx[0][1]=matx[1][0]; matx[1][0]=tmp;
509 tmp=matx[0][2]; matx[0][2]=matx[2][0]; matx[2][0]=tmp;
510 tmp=matx[0][3]; matx[0][3]=matx[3][0]; matx[3][0]=tmp;
511 tmp=matx[1][2]; matx[1][2]=matx[2][1]; matx[2][1]=tmp;
512 tmp=matx[1][3]; matx[1][3]=matx[3][1]; matx[3][1]=tmp;
513 tmp=matx[2][3]; matx[2][3]=matx[3][2]; matx[3][2]=tmp;
517 return UT_Matrix4T<T>(matx[0][0], matx[1][0], matx[2][0], matx[3][0],
518 matx[0][1], matx[1][1], matx[2][1], matx[3][1],
519 matx[0][2], matx[1][2], matx[2][2], matx[3][2],
520 matx[0][3], matx[1][3], matx[2][3], matx[3][3]);
527 return (&m ==
this) || (
555 template <
typename S>
558 template<UT_Axis3::axis A>
564 template<UT_Axis3::axis A,
bool reverse=false>
574 matx[
row][col0] = -matx[
row][col1];
575 matx[
row][col1] =
v1;
579 matx[
row][col0] = matx[
row][col1];
580 matx[
row][col1] = -
v1;
587 template<UT_Axis3::axis A>
595 matx[
row][col0] = -matx[
row][col0];
596 matx[
row][col1] = -matx[
row][col1];
602 template<UT_Axis3::axis A>
618 template <
typename S>
629 template <
typename S>
632 template<UT_Axis3::axis A>
633 void prerotate(
T theta);
638 template<UT_Axis3::axis A,
bool reverse=false>
644 for (
uint col = 0; col < 4; ++col)
645 v1[col] = matx[row0][col];
648 for (
uint col = 0; col < 4; ++col)
649 matx[row0][col] = matx[row1][col];
650 for (
uint col = 0; col < 4; ++col)
651 matx[row1][col] = -v1[col];
655 for (
uint col = 0; col < 4; ++col)
656 matx[row0][col] = -matx[row1][col];
657 for (
uint col = 0; col < 4; ++col)
658 matx[row1][col] = v1[col];
664 template<UT_Axis3::axis A>
670 for (
uint col = 0; col < 4; ++col)
671 matx[row0][col] = -matx[row0][col];
672 for (
uint col = 0; col < 4; ++col)
673 matx[row1][col] = -matx[row1][col];
682 {
rotate(rad(0), rad(1), rad(2), ord); }
688 void prerotate(
T rx,
T ry,
T rz,
692 { prerotate(rad(0), rad(1), rad(2), ord); }
699 matx[0][0] *= sx; matx[0][1] *= sy;
700 matx[0][2] *= sz; matx[0][3] *= sw;
702 matx[1][0] *= sx; matx[1][1] *= sy;
703 matx[1][2] *= sz; matx[1][3] *= sw;
705 matx[2][0] *= sx; matx[2][1] *= sy;
706 matx[2][2] *= sz; matx[2][3] *= sw;
708 matx[3][0] *= sx; matx[3][1] *= sy;
709 matx[3][2] *= sz; matx[3][3] *= sw;
721 matx[0][0] *= sx; matx[1][0] *= sy;
722 matx[2][0] *= sz; matx[3][0] *= sw;
724 matx[0][1] *= sx; matx[1][1] *= sy;
725 matx[2][1] *= sz; matx[3][1] *= sw;
727 matx[0][2] *= sx; matx[1][2] *= sy;
728 matx[2][2] *= sz; matx[3][2] *= sw;
730 matx[0][3] *= sx; matx[1][3] *= sy;
731 matx[2][3] *= sz; matx[3][3] *= sw;
734 { prescale(
s(0),
s(1),
s(2)); }
736 { prescale(s, s, s); }
750 matx[0][0] += matx[0][1]*s_xy + matx[0][2]*s_xz;
751 matx[0][1] += matx[0][2]*s_yz;
753 matx[1][0] += matx[1][1]*s_xy + matx[1][2]*s_xz;
754 matx[1][1] += matx[1][2]*s_yz;
756 matx[2][0] += matx[2][1]*s_xy + matx[2][2]*s_xz;
757 matx[2][1] += matx[2][2]*s_yz;
759 matx[3][0] += matx[3][1]*s_xy + matx[3][2]*s_xz;
760 matx[3][1] += matx[3][2]*s_yz;
764 {
shear(sh(0), sh(1), sh(2)); }
773 matx[0][0] += a*dx; matx[0][1] += a*dy; matx[0][2] += a*dz;
775 matx[1][0] += a*dx; matx[1][1] += a*dy; matx[1][2] += a*dz;
777 matx[2][0] += a*dx; matx[2][1] += a*dy; matx[2][2] += a*dz;
779 matx[3][0] += a*dx; matx[3][1] += a*dy; matx[3][2] += a*dz;
783 {
translate(delta(0), delta(1), delta(2)); }
790 matx[3][0] += matx[0][0]*dx + matx[1][0]*dy + matx[2][0]*dz;
791 matx[3][1] += matx[0][1]*dx + matx[1][1]*dy + matx[2][1]*dz;
792 matx[3][2] += matx[0][2]*dx + matx[1][2]*dy + matx[2][2]*dz;
793 matx[3][3] += matx[0][3]*dx + matx[1][3]*dy + matx[2][3]*dz;
797 { pretranslate(delta(0), delta(1), delta(2)); }
806 template <
typename S>
820 T tx=0,
T ty=0,
T tz=0,
821 T rx=0,
T ry=0,
T rz=0,
822 T sx=1,
T sy=1,
T sz=1,
823 T px=0,
T py=0,
T pz=0,
831 T s_xy,
T s_xz,
T s_yz,
836 template <
typename S>
841 : myTranslate(0, 0, 0)
849 : myTranslate(translate)
873 T s_xy,
T s_xz,
T s_yz,
883 , myTranslate(0, 0, 0)
884 , myRotateOffset(0, 0, 0)
885 , myParentRotate(0, 0, 0)
887 , myChildRotate(0, 0, 0)
888 , myRotatePivot(0, 0, 0)
889 , myScaleOffset(0, 0, 0)
892 , myScalePivot(0, 0, 0)
894 , myPivotRotate(0, 0, 0)
926 enum applyType { BEFORE=1, EQUAL=2, AFTER=4, BEFORE_EQUAL=4, AFTER_EQUAL=6};
928 applyType
type,
char limit,
935 applyType
type,
char limit,
939 template <
typename S>
941 template <
typename S>
950 template <
typename S>
957 {
return explodeT(order, r, s, t, shears); }
961 {
return explodeT(order, r, s, t, shears); }
964 template <
typename S>
973 {
return explodeT(order, r, s, t, p, shears); }
978 {
return explodeT(order, r, s, t, p, shears); }
981 template <
typename S>
990 {
return explodeT(order, r, s, t, p, shears); }
995 {
return explodeT(order, r, s, t, p, shears); }
1000 template <
typename S>
1003 S *shears = 0)
const;
1005 template <
typename S>
1009 S *shears = 0)
const;
1013 template <
typename S>
1023 template <
typename S>
1028 const int max_iter = 64,
1029 const T rel_tol = FLT_EPSILON)
const;
1034 template <
typename S>
1053 bool polarDecompose(
1056 const int max_iter = 64,
1057 const T rel_tol = FLT_EPSILON);
1070 bool makeRigidMatrix(
1073 const int max_iter = 64,
1074 const T rel_tol = FLT_EPSILON);
1080 template <
typename S>
1085 return (i <= 3 && j <= 3) ?
1086 matx[i][0]*matx[
j][0] + matx[i][1]*matx[
j][1] +
1087 matx[i][2]*matx[
j][2] + matx[i][3]*matx[
j][3] : (
T)0;
1091 template <
typename S>
1092 void outerproductUpdate(
T b,
1097 template <
typename S>
1118 for (
size_t i = 0; i < tuple_size; i++)
1132 matx[0][0]==1 && matx[0][1]==0 &&
1133 matx[0][2]==0 && matx[0][3]==0 &&
1134 matx[1][0]==0 && matx[1][1]==1 &&
1135 matx[1][2]==0 && matx[1][3]==0 &&
1136 matx[2][0]==0 && matx[2][1]==0 &&
1137 matx[2][2]==1 && matx[2][3]==0 &&
1138 matx[3][0]==0 && matx[3][1]==0 &&
1139 matx[3][2]==0 && matx[3][3]==1);
1146 matx[0][0]==0 && matx[0][1]==0 &&
1147 matx[0][2]==0 && matx[0][3]==0 &&
1148 matx[1][0]==0 && matx[1][1]==0 &&
1149 matx[1][2]==0 && matx[1][3]==0 &&
1150 matx[2][0]==0 && matx[2][1]==0 &&
1151 matx[2][2]==0 && matx[2][3]==0 &&
1152 matx[3][0]==0 && matx[3][1]==0 &&
1153 matx[3][2]==0 && matx[3][3]==0);
1159 const T *
data()
const {
return myFloats; }
1164 unsigned hash()
const {
return SYSvector_hash(
data(), tuple_size); }
1172 return matx[
row][col];
1178 return matx[
row][col];
1209 {
return SYSsqrt(getEuclideanNorm2()); }
1211 T getEuclideanNorm2()
const;
1219 T getNormInf()
const;
1223 T getNormMax()
const;
1227 T getNormSpectral()
const;
1231 T getInfinityNorm()
const {
return getNormInf(); }
1243 int save(std::ostream &os,
int binary)
const;
1245 void dump(
const char *msg=
"")
const;
1247 void outAsciiNoName(std::ostream &os)
const;
1260 friend std::ostream &operator<<(std::ostream &os, const UT_Matrix4T<T> &
v)
1262 v.writeClassName(os);
1263 v.outAsciiNoName(os);
1274 T myFloats[tuple_size];
1310 void perspective(
fpreal zoom,
1350 void orthographic(
fpreal zoom,
1360 template <
int ORDER>
1366 void coVals(
int k,
int r[3])
const
1370 case 0: r[0] = 1; r[1] = 2; r[2] = 3;
break;
1371 case 1: r[0] = 0; r[1] = 2; r[2] = 3;
break;
1372 case 2: r[0] = 0; r[1] = 1; r[2] = 3;
break;
1373 case 3: r[0] = 0; r[1] = 1; r[2] = 2;
break;
1379 void writeClassName(std::ostream &os)
const;
1380 static const char *className();
1385 template <
typename T>
1386 template <
typename S>
1390 matx[0][0] = matx[0][1] = matx[0][2] = matx[0][3] = vec.
x();
1391 matx[1][0] = matx[1][1] = matx[1][2] = matx[1][3] = vec.
y();
1392 matx[2][0] = matx[2][1] = matx[2][2] = matx[2][3] = vec.
z();
1393 matx[3][0] = matx[3][1] = matx[3][2] = matx[3][3] = vec.
w();
1397 template <
typename T>
1398 template <
typename S>
1402 T x = vec.
x();
T y = vec.
y();
1403 T z = vec.
z();
T w = vec.
w();
1404 matx[0][0]+=
x; matx[0][1]+=
x; matx[0][2]+=
x; matx[0][3]+=
x;
1405 matx[1][0]+=
y; matx[1][1]+=
y; matx[1][2]+=
y; matx[1][3]+=
y;
1406 matx[2][0]+=
z; matx[2][1]+=
z; matx[2][2]+=
z; matx[2][3]+=
z;
1407 matx[3][0]+=
w; matx[3][1]+=
w; matx[3][2]+=
w; matx[3][3]+=
w;
1411 template <
typename T>
1412 template <
typename S>
1416 T x = vec.
x();
T y = vec.
y();
1417 T z = vec.
z();
T w = vec.
w();
1418 matx[0][0]-=
x; matx[0][1]-=
x; matx[0][2]-=
x; matx[0][3]-=
x;
1419 matx[1][0]-=
y; matx[1][1]-=
y; matx[1][2]-=
y; matx[1][3]-=
y;
1420 matx[2][0]-=
z; matx[2][1]-=
z; matx[2][2]-=
z; matx[2][3]-=
z;
1421 matx[3][0]-=
w; matx[3][1]-=
w; matx[3][2]-=
w; matx[3][3]-=
w;
1425 template <
typename T>
1426 template <
typename S>
1430 translates.
x() = matx[3][0];
1431 translates.
y() = matx[3][1];
1432 translates.
z() = matx[3][2];
1435 template <
typename T>
1436 template <
typename S>
1440 matx[3][0] = translates.
x();
1441 matx[3][1] = translates.
y();
1442 matx[3][2] = translates.
z();
1445 template <
typename T>
1453 template <
typename T>
1461 template <
typename T>
1462 template <
typename S>
1467 a = matx[0][0]; b = matx[0][1]; c = matx[0][2]; d = matx[0][3];
1468 matx[0][0] = a*m(0,0) + b*m(1,0) + c*m(2,0) + d*m(3,0);
1469 matx[0][1] = a*m(0,1) + b*m(1,1) + c*m(2,1) + d*m(3,1);
1470 matx[0][2] = a*m(0,2) + b*m(1,2) + c*m(2,2) + d*m(3,2);
1471 matx[0][3] = a*m(0,3) + b*m(1,3) + c*m(2,3) + d*m(3,3);
1473 a = matx[1][0]; b = matx[1][1]; c = matx[1][2]; d = matx[1][3];
1474 matx[1][0] = a*m(0,0) + b*m(1,0) + c*m(2,0) + d*m(3,0);
1475 matx[1][1] = a*m(0,1) + b*m(1,1) + c*m(2,1) + d*m(3,1);
1476 matx[1][2] = a*m(0,2) + b*m(1,2) + c*m(2,2) + d*m(3,2);
1477 matx[1][3] = a*m(0,3) + b*m(1,3) + c*m(2,3) + d*m(3,3);
1479 a = matx[2][0]; b = matx[2][1]; c = matx[2][2]; d = matx[2][3];
1480 matx[2][0] = a*m(0,0) + b*m(1,0) + c*m(2,0) + d*m(3,0);
1481 matx[2][1] = a*m(0,1) + b*m(1,1) + c*m(2,1) + d*m(3,1);
1482 matx[2][2] = a*m(0,2) + b*m(1,2) + c*m(2,2) + d*m(3,2);
1483 matx[2][3] = a*m(0,3) + b*m(1,3) + c*m(2,3) + d*m(3,3);
1485 a = matx[3][0]; b = matx[3][1]; c = matx[3][2]; d = matx[3][3];
1486 matx[3][0] = a*m(0,0) + b*m(1,0) + c*m(2,0) + d*m(3,0);
1487 matx[3][1] = a*m(0,1) + b*m(1,1) + c*m(2,1) + d*m(3,1);
1488 matx[3][2] = a*m(0,2) + b*m(1,2) + c*m(2,2) + d*m(3,2);
1489 matx[3][3] = a*m(0,3) + b*m(1,3) + c*m(2,3) + d*m(3,3);
1493 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1507 for (
int i = 0; i < 4; i++)
1520 template <
typename T>
1521 template <
typename S>
1526 a = matx[0][0]; b = matx[0][1]; c = matx[0][2];
1527 matx[0][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
1528 matx[0][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
1529 matx[0][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
1531 a = matx[1][0]; b = matx[1][1]; c = matx[1][2];
1532 matx[1][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
1533 matx[1][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
1534 matx[1][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
1536 a = matx[2][0]; b = matx[2][1]; c = matx[2][2];
1537 matx[2][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
1538 matx[2][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
1539 matx[2][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
1541 a = matx[3][0]; b = matx[3][1]; c = matx[3][2];
1542 matx[3][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
1543 matx[3][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
1544 matx[3][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
1548 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1555 const v4uf m0(m(0));
1556 const v4uf m1(m(1));
1557 const v4uf m2(m(2,0), m(2,1), m(2,2), 0);
1559 for (
int i = 0; i < 4; ++i)
1572 template <>
inline void
1576 for (
int i = 0; i < 4; ++i)
1587 template <
typename T>
1592 a = matx[0][0]; b = matx[1][0]; c = matx[2][0]; d = matx[3][0];
1593 matx[0][0] = a*m(0,0) + b*m(0,1) + c*m(0,2) + d*m(0,3);
1594 matx[1][0] = a*m(1,0) + b*m(1,1) + c*m(1,2) + d*m(1,3);
1595 matx[2][0] = a*m(2,0) + b*m(2,1) + c*m(2,2) + d*m(2,3);
1596 matx[3][0] = a*m(3,0) + b*m(3,1) + c*m(3,2) + d*m(3,3);
1598 a = matx[0][1]; b = matx[1][1]; c = matx[2][1]; d = matx[3][1];
1599 matx[0][1] = a*m(0,0) + b*m(0,1) + c*m(0,2) + d*m(0,3);
1600 matx[1][1] = a*m(1,0) + b*m(1,1) + c*m(1,2) + d*m(1,3);
1601 matx[2][1] = a*m(2,0) + b*m(2,1) + c*m(2,2) + d*m(2,3);
1602 matx[3][1] = a*m(3,0) + b*m(3,1) + c*m(3,2) + d*m(3,3);
1604 a = matx[0][2]; b = matx[1][2]; c = matx[2][2]; d = matx[3][2];
1605 matx[0][2] = a*m(0,0) + b*m(0,1) + c*m(0,2) + d*m(0,3);
1606 matx[1][2] = a*m(1,0) + b*m(1,1) + c*m(1,2) + d*m(1,3);
1607 matx[2][2] = a*m(2,0) + b*m(2,1) + c*m(2,2) + d*m(2,3);
1608 matx[3][2] = a*m(3,0) + b*m(3,1) + c*m(3,2) + d*m(3,3);
1610 a = matx[0][3]; b = matx[1][3]; c = matx[2][3]; d = matx[3][3];
1611 matx[0][3] = a*m(0,0) + b*m(0,1) + c*m(0,2) + d*m(0,3);
1612 matx[1][3] = a*m(1,0) + b*m(1,1) + c*m(1,2) + d*m(1,3);
1613 matx[2][3] = a*m(2,0) + b*m(2,1) + c*m(2,2) + d*m(2,3);
1614 matx[3][3] = a*m(3,0) + b*m(3,1) + c*m(3,2) + d*m(3,3);
1617 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1627 for (
int i = 0; i < 4; ++i)
1640 template <
typename T>
1645 m[0][0] = m1(0,0)+m2(0,0); m[0][1] = m1(0,1)+m2(0,1);
1646 m[0][2] = m1(0,2)+m2(0,2); m[0][3] = m1(0,3)+m2(0,3);
1648 m[1][0] = m1(1,0)+m2(1,0); m[1][1] = m1(1,1)+m2(1,1);
1649 m[1][2] = m1(1,2)+m2(1,2); m[1][3] = m1(1,3)+m2(1,3);
1651 m[2][0] = m1(2,0)+m2(2,0); m[2][1] = m1(2,1)+m2(2,1);
1652 m[2][2] = m1(2,2)+m2(2,2); m[2][3] = m1(2,3)+m2(2,3);
1654 m[3][0] = m1(3,0)+m2(3,0); m[3][1] = m1(3,1)+m2(3,1);
1655 m[3][2] = m1(3,2)+m2(3,2); m[3][3] = m1(3,3)+m2(3,3);
1658 template <
typename T>
1663 m[0][0] = m1(0,0)-m2(0,0); m[0][1] = m1(0,1)-m2(0,1);
1664 m[0][2] = m1(0,2)-m2(0,2); m[0][3] = m1(0,3)-m2(0,3);
1666 m[1][0] = m1(1,0)-m2(1,0); m[1][1] = m1(1,1)-m2(1,1);
1667 m[1][2] = m1(1,2)-m2(1,2); m[1][3] = m1(1,3)-m2(1,3);
1669 m[2][0] = m1(2,0)-m2(2,0); m[2][1] = m1(2,1)-m2(2,1);
1670 m[2][2] = m1(2,2)-m2(2,2); m[2][3] = m1(2,3)-m2(2,3);
1672 m[3][0] = m1(3,0)-m2(3,0); m[3][1] = m1(3,1)-m2(3,1);
1673 m[3][2] = m1(3,2)-m2(3,2); m[3][3] = m1(3,3)-m2(3,3);
1676 template <
typename T>
1681 m[0][0] = m1(0,0)*m2(0,0) + m1(0,1)*m2(1,0) +
1682 m1(0,2)*m2(2,0) + m1(0,3)*m2(3,0) ;
1683 m[0][1] = m1(0,0)*m2(0,1) + m1(0,1)*m2(1,1) +
1684 m1(0,2)*m2(2,1) + m1(0,3)*m2(3,1) ;
1685 m[0][2] = m1(0,0)*m2(0,2) + m1(0,1)*m2(1,2) +
1686 m1(0,2)*m2(2,2) + m1(0,3)*m2(3,2) ;
1687 m[0][3] = m1(0,0)*m2(0,3) + m1(0,1)*m2(1,3) +
1688 m1(0,2)*m2(2,3) + m1(0,3)*m2(3,3) ;
1690 m[1][0] = m1(1,0)*m2(0,0) + m1(1,1)*m2(1,0) +
1691 m1(1,2)*m2(2,0) + m1(1,3)*m2(3,0) ;
1692 m[1][1] = m1(1,0)*m2(0,1) + m1(1,1)*m2(1,1) +
1693 m1(1,2)*m2(2,1) + m1(1,3)*m2(3,1) ;
1694 m[1][2] = m1(1,0)*m2(0,2) + m1(1,1)*m2(1,2) +
1695 m1(1,2)*m2(2,2) + m1(1,3)*m2(3,2) ;
1696 m[1][3] = m1(1,0)*m2(0,3) + m1(1,1)*m2(1,3) +
1697 m1(1,2)*m2(2,3) + m1(1,3)*m2(3,3) ;
1699 m[2][0] = m1(2,0)*m2(0,0) + m1(2,1)*m2(1,0) +
1700 m1(2,2)*m2(2,0) + m1(2,3)*m2(3,0) ;
1701 m[2][1] = m1(2,0)*m2(0,1) + m1(2,1)*m2(1,1) +
1702 m1(2,2)*m2(2,1) + m1(2,3)*m2(3,1) ;
1703 m[2][2] = m1(2,0)*m2(0,2) + m1(2,1)*m2(1,2) +
1704 m1(2,2)*m2(2,2) + m1(2,3)*m2(3,2) ;
1705 m[2][3] = m1(2,0)*m2(0,3) + m1(2,1)*m2(1,3) +
1706 m1(2,2)*m2(2,3) + m1(2,3)*m2(3,3) ;
1708 m[3][0] = m1(3,0)*m2(0,0) + m1(3,1)*m2(1,0) +
1709 m1(3,2)*m2(2,0) + m1(3,3)*m2(3,0) ;
1710 m[3][1] = m1(3,0)*m2(0,1) + m1(3,1)*m2(1,1) +
1711 m1(3,2)*m2(2,1) + m1(3,3)*m2(3,1) ;
1712 m[3][2] = m1(3,0)*m2(0,2) + m1(3,1)*m2(1,2) +
1713 m1(3,2)*m2(2,2) + m1(3,3)*m2(3,2) ;
1714 m[3][3] = m1(3,0)*m2(0,3) + m1(3,1)*m2(1,3) +
1715 m1(3,2)*m2(2,3) + m1(3,3)*m2(3,3) ;
1718 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1730 for (
int i = 0; i < 4; ++i)
1743 template <
typename T,
typename S>
1749 m[0][0] = m1(0,0) +
x; m[0][1] = m1(0,1) +
x;
1750 m[0][2] = m1(0,2) +
x; m[0][3] = m1(0,3) +
x;
1752 m[1][0] = m1(1,0) +
y; m[1][1] = m1(1,1) +
y;
1753 m[1][2] = m1(1,2) +
y; m[1][3] = m1(1,3) +
y;
1755 m[2][0] = m1(2,0) +
z; m[2][1] = m1(2,1) +
z;
1756 m[2][2] = m1(2,2) +
z; m[2][3] = m1(2,3) +
z;
1758 m[3][0] = m1(3,0) +
w; m[3][1] = m1(3,1) +
w;
1759 m[3][2] = m1(3,2) +
w; m[3][3] = m1(3,3) +
w;
1763 template <
typename T,
typename S>
1770 template <
typename T,
typename S>
1776 m[0][0] = m1(0,0) -
x; m[0][1] = m1(0,1) -
x;
1777 m[0][2] = m1(0,2) -
x; m[0][3] = m1(0,3) -
x;
1779 m[1][0] = m1(1,0) -
y; m[1][1] = m1(1,1) -
y;
1780 m[1][2] = m1(1,2) -
y; m[1][3] = m1(1,3) -
y;
1782 m[2][0] = m1(2,0) -
z; m[2][1] = m1(2,1) -
z;
1783 m[2][2] = m1(2,2) -
z; m[2][3] = m1(2,3) -
z;
1785 m[3][0] = m1(3,0) -
w; m[3][1] = m1(3,1) -
w;
1786 m[3][2] = m1(3,2) -
w; m[3][3] = m1(3,3) -
w;
1790 template <
typename T,
typename S>
1796 m[0][0] = x - m1(0,0); m[0][1] = x - m1(0,1);
1797 m[0][2] = x - m1(0,2); m[0][3] = x - m1(0,3);
1799 m[1][0] = y - m1(1,0); m[1][1] = y - m1(1,1);
1800 m[1][2] = y - m1(1,2); m[1][3] = y - m1(1,3);
1802 m[2][0] = z - m1(2,0); m[2][1] = z - m1(2,1);
1803 m[2][2] = z - m1(2,2); m[2][3] = z - m1(2,3);
1805 m[3][0] = w - m1(3,0); m[3][1] = w - m1(3,1);
1806 m[3][2] = w - m1(3,2); m[3][3] = w - m1(3,3);
1810 template <
typename T,
typename S>
1815 m[0][0]=
n(0,0)+sc; m[0][1]=
n(0,1)+sc; m[0][2]=
n(0,2)+sc; m[0][3]=
n(0,3)+sc;
1816 m[1][0]=
n(1,0)+sc; m[1][1]=
n(1,1)+sc; m[1][2]=
n(1,2)+sc; m[1][3]=
n(1,3)+sc;
1817 m[2][0]=
n(2,0)+sc; m[2][1]=
n(2,1)+sc; m[2][2]=
n(2,2)+sc; m[2][3]=
n(2,3)+sc;
1818 m[3][0]=
n(3,0)+sc; m[3][1]=
n(3,1)+sc; m[3][2]=
n(3,2)+sc; m[3][3]=
n(3,3)+sc;
1822 template <
typename T,
typename S>
1827 m[0][0]=sc-
n(0,0); m[0][1]=sc-
n(0,1); m[0][2]=sc-
n(0,2); m[0][3]=sc-
n(0,3);
1828 m[1][0]=sc-
n(1,0); m[1][1]=sc-
n(1,1); m[1][2]=sc-
n(1,2); m[1][3]=sc-
n(1,3);
1829 m[2][0]=sc-
n(2,0); m[2][1]=sc-
n(2,1); m[2][2]=sc-
n(2,2); m[2][3]=sc-
n(2,3);
1830 m[3][0]=sc-
n(3,0); m[3][1]=sc-
n(3,1); m[3][2]=sc-
n(3,2); m[3][3]=sc-
n(3,3);
1834 template <
typename T,
typename S>
1841 template <
typename T,
typename S>
1846 m[0][0]=
n(0,0)*sc; m[0][1]=
n(0,1)*sc; m[0][2]=
n(0,2)*sc; m[0][3]=
n(0,3)*sc;
1847 m[1][0]=
n(1,0)*sc; m[1][1]=
n(1,1)*sc; m[1][2]=
n(1,2)*sc; m[1][3]=
n(1,3)*sc;
1848 m[2][0]=
n(2,0)*sc; m[2][1]=
n(2,1)*sc; m[2][2]=
n(2,2)*sc; m[2][3]=
n(2,3)*sc;
1849 m[3][0]=
n(3,0)*sc; m[3][1]=
n(3,1)*sc; m[3][2]=
n(3,2)*sc; m[3][3]=
n(3,3)*sc;
1853 template <
typename T,
typename S>
1858 return (m1 * (
T(1.0)/scalar));
1861 template <
typename T,
typename S>
1866 m[0][0]=sc/
n(0,0); m[0][1]=sc/
n(0,1); m[0][2]=sc/
n(0,2); m[0][3]=sc/
n(0,3);
1867 m[1][0]=sc/
n(1,0); m[1][1]=sc/
n(1,1); m[1][2]=sc/
n(1,2); m[1][3]=sc/
n(1,3);
1868 m[2][0]=sc/
n(2,0); m[2][1]=sc/
n(2,1); m[2][2]=sc/
n(2,2); m[2][3]=sc/
n(2,3);
1869 m[3][0]=sc/
n(3,0); m[3][1]=sc/
n(3,1); m[3][2]=sc/
n(3,2); m[3][3]=sc/
n(3,3);
1892 template <
typename T,
typename S>
1894 template <
typename T,
typename S>
1897 template <
typename T,
typename S>
1899 template <
typename T,
typename S>
1903 template <
typename T,
typename S>
1908 v.
x()*m(0,0) + v.
y()*m(1,0) + v.
z()*m(2,0) + m(3,0),
1909 v.
x()*m(0,1) + v.
y()*m(1,1) + v.
z()*m(2,1) + m(3,1),
1910 v.
x()*m(0,2) + v.
y()*m(1,2) + v.
z()*m(2,2) + m(3,2)
1913 template <
typename T,
typename S>
1920 template <
typename T,
typename S>
1925 v.
x()*m(0,0) + v.
y()*m(1,0) + v.
z()*m(2,0),
1926 v.
x()*m(0,1) + v.
y()*m(1,1) + v.
z()*m(2,1),
1927 v.
x()*m(0,2) + v.
y()*m(1,2) + v.
z()*m(2,2)
1931 template <
typename T,
typename S>
1936 v.
x()*m(0,0) + v.
y()*m(0,1) + v.
z()*m(0,2) + m(0,3),
1937 v.
x()*m(1,0) + v.
y()*m(1,1) + v.
z()*m(1,2) + m(1,3),
1938 v.
x()*m(2,0) + v.
y()*m(2,1) + v.
z()*m(2,2) + m(2,3)
1942 template <
typename T,
typename S>
1947 v.
x()*m(0,0) + v.
y()*m(0,1) + v.
z()*m(0,2),
1948 v.
x()*m(1,0) + v.
y()*m(1,1) + v.
z()*m(1,2),
1949 v.
x()*m(2,0) + v.
y()*m(2,1) + v.
z()*m(2,2)
1952 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1983 v4uf(m(0,0), m(1,0), m(2,0), m(3,0)) *
v4uf(v[0])
1984 +
v4uf(m(0,1), m(1,1), m(2,1), m(3,1)) *
v4uf(v[1])
1985 +
v4uf(m(0,2), m(1,2), m(2,2), m(3,2)) *
v4uf(v[2])
1986 +
v4uf(m(0,3), m(1,3), m(2,3), m(3,3));
1996 v4uf(m(0,0), m(1,0), m(2,0), m(3,0)) *
v4uf(v[0])
1997 +
v4uf(m(0,1), m(1,1), m(2,1), m(3,1)) *
v4uf(v[1])
1998 +
v4uf(m(0,2), m(1,2), m(2,2), m(3,2)) *
v4uf(v[2]);
2006 template <
typename T>
2012 template <
typename T>
2018 template <
typename T>
2024 template <
typename T>
2030 template <
typename T>
2036 template <
typename T>
2042 template <
typename T>
2048 template <
typename T>
2054 template <
typename T>
2055 template <
typename S>
2062 template <
typename T>
2063 template <
typename S>
2069 template <
typename T>
2070 template <
typename S>
2076 template <
typename T>
2077 template <
typename S>
2083 template <
typename T>
2084 template <
typename S>
2090 template <
typename T>
2091 template <
typename S>
2098 template <
typename T>
2104 template <
typename T>
2128 template <
typename T>
2152 template <
typename T,
typename S>
2175 #ifndef UT_DISABLE_VECTORIZE_MATRIX
2181 for (
int i = 0; i < 4; ++i)
2192 template<
typename T, ex
int D >
2195 template<
typename T>
2205 template<
typename T>
2212 template <
typename T>
2215 template<
typename TS >
2219 as[ 0], as[ 1], as[ 2], as[ 3],
2220 as[ 4], as[ 5], as[ 6], as[ 7],
2221 as[ 8], as[ 9], as[10], as[11],
2222 as[12], as[13], as[14], as[15]
2230 template <
typename V >
2234 template <
typename T>
2241 template <
typename T>
2244 template<
typename TS >
2256 template<
typename TS >
2268 template <
typename V >
2272 template <
typename T>
2275 template <
typename T>
template<
int ORDER>
2282 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2283 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2284 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2289 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2290 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2291 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2296 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2297 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2298 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2303 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2304 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2305 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2310 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2311 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2312 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2317 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2318 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2319 if(rx) rotate<UT_Axis3::XAXIS>(rx);
void shear(T s_xy, T s_xz, T s_yz)
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 void colVecMult3(const UT_Matrix4F &m)
void instance(const UT_Vector3D &p, const UT_Vector3D &v, T s, const UT_Vector3D *s3, const UT_Vector3D *up, const UT_QuaternionD *q, const UT_Vector3D *tr, const UT_QuaternionD *orient, const UT_Vector3D *pivot=NULL)
#define SYS_STATIC_ASSERT(expr)
SYS_FORCE_INLINE void prerotateHalf()
const UT_Vector4T< T > & operator[](unsigned row) const
Return a matrix row. No bounds checking on subscript.
bool operator!=(const UT_Matrix4T< T > &m) const
SYS_FORCE_INLINE void rotate(const UT_Vector3T< T > &rad, const UT_XformOrder &ord)
UT_Matrix4T(const UT_SymMatrix4T< S > &m)
SYS_FORCE_INLINE void prescale(T s)
UT_API size_t format(char *buffer, size_t buffer_size, const UT_Matrix4T< T > &v)
SYS_FORCE_INLINE UT_Matrix4T< T > & operator*=(T scalar)
UT_FromUnbounded creates a V from an unbounded array-like type.
MatType shear(Axis axis0, Axis axis1, typename MatType::value_type shear)
Set the matrix to a shear along axis0 by a fraction of axis1.
SYS_FORCE_INLINE void prerotateQuarter()
SYS_FORCE_INLINE void multiply3T(const UT_Matrix4T< S > &mat)
constexpr SYS_FORCE_INLINE T & y() noexcept
SYS_FORCE_INLINE void colVecMult(const UT_Matrix3F &m)
T * data()
Return the raw matrix data.
SYS_FORCE_INLINE T operator()(unsigned row, unsigned col) const
Return a matrix entry. No bounds checking on subscripts.
SYS_FORCE_INLINE T coFactor(int k, int l) const
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_FixedVector< T, 16 > FixedVectorType
PivotSpaceT()
Constructor with default values for data members.
const GLuint GLenum const void * binary
SYS_FORCE_INLINE T & operator()(unsigned row, unsigned col)
Return a matrix entry. No bounds checking on subscripts.
SYS_FORCE_INLINE void rotateQuarter()
GA_API const UT_StringHolder rot
vfloat4 sqrt(const vfloat4 &a)
GLdouble GLdouble GLdouble z
typename SYS_FixedArrayElement< T >::type SYS_FixedArrayElement_t
UT_Matrix4T< T > & operator=(const UT_Matrix4T< S > &m)
constexpr SYS_FORCE_INLINE T & z() noexcept
SYS_FORCE_INLINE void prerotate(const UT_Vector3T< T > &rad, const UT_XformOrder &ord)
GLboolean GLboolean GLboolean GLboolean a
PUGI__FN void reverse(I begin, I end)
bool isEqual(const UT_Matrix4T< T > &m, T tolerance=T(SYS_FTOLERANCE)) const
JSON reader class which handles parsing of JSON or bJSON files.
SYS_FORCE_INLINE void prescale(const UT_Vector3T< T > &s)
Class which writes ASCII or binary JSON streams.
**But if you need a result
static const exint TupleSize
GLfloat GLfloat GLfloat v2
GLdouble GLdouble GLdouble q
constexpr SYS_FORCE_INLINE UT_Vector3T & operator*=(const T &a) noexcept
SYS_FORCE_INLINE void shear(const UT_Vector3T< T > &sh)
UT_Vector3T< S > myTranslate
constexpr SYS_FORCE_INLINE T & x() noexcept
Define parameters for Houdini's pivot space.
UT_Matrix4T< T > SYSmin(const UT_Matrix4T< T > &v1, const UT_Matrix4T< T > &v2)
UT_Matrix4T< T > SYSbilerp(const UT_Matrix4T< T > &u0v0, const UT_Matrix4T< T > &u1v0, const UT_Matrix4T< T > &u0v1, const UT_Matrix4T< T > &u1v1, S u, S v)
Bilinear interpolation.
SYS_FORCE_INLINE void rotateHalf()
PivotSpaceT< T > PivotSpace
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
GA_API const UT_StringHolder scale
static int entries()
Returns the vector size.
GLint GLint GLsizei GLint GLenum GLenum type
void instanceInverse(const UT_Vector3F &p, const UT_Vector3F &v, T s, const UT_Vector3F *s3, const UT_Vector3F *up, const UT_QuaternionF *q, const UT_Vector3F *tr, const UT_QuaternionF *orient, const UT_Vector3F *pivot=NULL)
SYS_FORCE_INLINE UT_Matrix4T< T > & operator+=(const UT_Matrix4T< T > &m)
UT_Matrix4T< T > & operator=(const UT_Matrix3T< S > &m)
SYS_FORCE_INLINE UT_Matrix4T< T > & operator/=(T scalar)
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)
constexpr SYS_FORCE_INLINE T & z() noexcept
bool operator==(const UT_Matrix4T< T > &m) const
UT_Matrix4T< T > SYSbarycentric(const UT_Matrix4T< T > &v0, const UT_Matrix4T< T > &v1, const UT_Matrix4T< T > &v2, S u, S v)
Barycentric interpolation.
void rotate(UT_Vector3T< S > &axis, T theta, int norm=1)
int explode(const UT_XformOrder &order, UT_Vector3F &r, UT_Vector3F &s, UT_Vector3F &t, const UT_Vector3F &p, UT_Vector3F *shears=0) const
UT_Matrix4T< T > transpose() const
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
static const bool isVectorType
int explode(const UT_XformOrder &order, UT_Vector3F &r, UT_Vector3F &s, UT_Vector3F &t, UT_Vector3F *shears=0) const
UT_Vector3T< T > rowVecMult(const UT_Vector3T< T > &v, const UT_Matrix4T< S > &m)
T determinant3() const
Compute determinant of the upper-left 3x3 sub-matrix.
SYS_FORCE_INLINE void pretranslate(const UT_Vector3T< T > &delta)
void prescale(T sx, T sy, T sz, T sw=1)
SYS_FORCE_INLINE UT_Matrix4T< T > & operator-=(const UT_Matrix4T< T > &m)
constexpr UT_Matrix4T< SYS_FixedArrayElement_t< TS > > UTmakeMatrix4T(const TS &as) noexcept
SYS_FORCE_INLINE void rowVecMult(const UT_Matrix3F &m)
UT_Vector3T< T > colVecMult(const UT_Matrix4T< S > &m, const UT_Vector3T< T > &v)
GLdouble GLdouble GLint GLint order
void instance(const UT_Vector3F &p, const UT_Vector3F &v, T s, const UT_Vector3F *s3, const UT_Vector3F *up, const UT_QuaternionF *q, const UT_Vector3F *tr, const UT_QuaternionF *orient, const UT_Vector3F *pivot=NULL)
SYS_FORCE_INLINE void rowVecMult3(const UT_Matrix4F &m)
void identity()
Set the matrix to identity.
constexpr SYS_FORCE_INLINE UT_Matrix4T< T > operator()(const TS &as) const noexcept
UT_Matrix4T< T > SYSmax(const UT_Matrix4T< T > &v1, const UT_Matrix4T< T > &v2)
GLboolean GLboolean GLboolean b
UT_Vector3T< T > colVecMult3(const UT_Matrix4T< S > &m, const UT_Vector3T< T > &v)
SYS_FORCE_INLINE void translate(const UT_Vector3T< T > &delta)
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 lerp(const UT_Matrix4T< T > &a, const UT_Matrix4T< T > &b, T t)
void instanceInverse(const UT_Vector3D &p, const UT_Vector3D &v, T s, const UT_Vector3D *s3, const UT_Vector3D *up, const UT_QuaternionD *q, const UT_Vector3D *tr, const UT_QuaternionD *orient, const UT_Vector3D *pivot=NULL)
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.
SYS_FORCE_INLINE const T * operator()(unsigned row) const
Return a matrix row. No bounds checking on subscript.
void setTranslates(const UT_Vector3T< S > &translates)
SYS_FORCE_INLINE void scale(const UT_Vector3T< T > &s)
UT_Vector3T< S > myRotate
void scale(T sx, T sy, T sz, T sw=1)
__hostdev__ uint64_t last(uint32_t i) const
T dot(unsigned i, unsigned j) const
int explode(const UT_XformOrder &order, UT_Vector3D &r, UT_Vector3D &s, UT_Vector3D &t, const PivotSpaceT< fpreal64 > &p, UT_Vector3D *shears=0) const
GA_API const UT_StringHolder parms
SYS_FORCE_INLINE T * operator()(unsigned row)
Return a matrix row. No bounds checking on subscript.
UT_Matrix4T< T > operator-() const
const T * data() const
Return the raw matrix data.
UT_Matrix4T< T > SYSlerp(const UT_Matrix4T< T > &v1, const UT_Matrix4T< T > &v2, S t)
void translate(T dx, T dy, T dz=0)
UT_Vector3T< T > rowVecMult3(const UT_Vector3T< T > &v, const UT_Matrix4T< S > &m)
SYS_FORCE_INLINE void scale(T s)
T getEuclideanNorm() const
bool isSymmetric(const MatType &m)
Determine if a matrix is symmetric.
LeafData & operator=(const LeafData &)=delete
constexpr UT_Matrix4T(fpreal64 val) noexcept
Construct identity matrix, multipled by scalar.
void zero()
Set the matrix to zero.
constexpr SYS_FORCE_INLINE T & w() noexcept
UT_Matrix4T< T > & operator=(const UT_SymMatrix4T< S > &m)
Conversion from a symmetric to a non symmetric matrix.
GA_API const UT_StringHolder pivot
U UT_Matrix4T(const UT_Matrix3T< S > &m, const UT_Vector3T< U > &t)
int explode(const UT_XformOrder &order, UT_Vector3F &r, UT_Vector3F &s, UT_Vector3F &t, const PivotSpaceT< fpreal32 > &p, UT_Vector3F *shears=0) const
SYS_FORCE_INLINE void rotateWithQTurns(T theta, uint qturns)
Class to store JSON objects as C++ objects.
OIIO_FORCEINLINE const vint4 & operator-=(vint4 &a, const vint4 &b)
UT_Matrix4T< T > & operator=(const UT_Matrix4T< T > &m)=default
Default copy assignment operator.
GLubyte GLubyte GLubyte GLubyte w
void leftMult(const UT_Matrix4T< T > &m)
GLenum GLenum GLsizei void * row
UT_Matrix4T< T > operator/(const UT_Matrix4T< T > &mat, S sc)
static UT_Matrix4T< T > reflectMat(const UT_Vector3T< S > &plane_origin, const UT_Vector3T< S > &plane_normal)
PUGI__FN char_t * translate(char_t *buffer, const char_t *from, const char_t *to, size_t to_length)
PivotSpaceT(const UT_Vector3T< S > &translate, const UT_Vector3T< S > &rotate)
Convenience constructor with translate and rotate.
OIIO_FORCEINLINE T log(const T &v)
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.
constexpr SYS_FORCE_INLINE UT_Matrix4T< T > operator()(const TS &as) const noexcept
SYS_FORCE_INLINE void multiply3(const UT_Matrix4T< S > &mat)
int explode(const UT_XformOrder &order, UT_Vector3D &r, UT_Vector3D &s, UT_Vector3D &t, UT_Vector3D *shears=0) const
void pretranslate(T dx, T dy, T dz=0)
UT_Matrix4T< T > & operator*=(const UT_Matrix4T< S > &m)
int explode(const UT_XformOrder &order, UT_Vector3D &r, UT_Vector3D &s, UT_Vector3D &t, const UT_Vector3D &p, UT_Vector3D *shears=0) const
void getTranslates(UT_Vector3T< S > &translates) const
void preMultiply(const UT_Matrix4T< T > &m)
unsigned hash() const
Compute a hash.
constexpr SYS_FORCE_INLINE T & x() noexcept