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)
140 matx[0][0] = val00; matx[0][1] = val01; matx[0][2] = val02;
142 matx[1][0] = val10; matx[1][1] = val11; matx[1][2] = val12;
144 matx[2][0] = val20; matx[2][1] = val21; matx[2][2] = val22;
146 matx[3][0] = val30; matx[3][1] = val31; matx[3][2] = val32;
151 template <
typename S>
154 matx[0][0]=m(0,0); matx[0][1]=m(0,1); matx[0][2]=m(0,2); matx[0][3]=m(0,3);
155 matx[1][0]=m(1,0); matx[1][1]=m(1,1); matx[1][2]=m(1,2); matx[1][3]=m(1,3);
156 matx[2][0]=m(2,0); matx[2][1]=m(2,1); matx[2][2]=m(2,2); matx[2][3]=m(2,3);
157 matx[3][0]=m(3,0); matx[3][1]=m(3,1); matx[3][2]=m(3,2); matx[3][3]=m(3,3);
159 template <
typename S>
162 matx[0][0]=m(0,0); matx[0][1]=m(0,1); matx[0][2]=m(0,2); matx[0][3]=(
T)0.;
163 matx[1][0]=m(1,0); matx[1][1]=m(1,1); matx[1][2]=m(1,2); matx[1][3]=(
T)0.;
164 matx[2][0]=m(2,0); matx[2][1]=m(2,1); matx[2][2]=m(2,2); matx[2][3]=(
T)0.;
165 matx[3][0]=(
T)0.; matx[3][1]=(
T)0.; matx[3][2]=(
T)0.; matx[3][3]=(
T)1.;
168 template <
typename S,
typename U>
171 matx[0][0]=m(0,0); matx[0][1]=m(0,1); matx[0][2]=m(0,2); matx[0][3]=(
T)0.;
172 matx[1][0]=m(1,0); matx[1][1]=m(1,1); matx[1][2]=m(1,2); matx[1][3]=(
T)0.;
173 matx[2][0]=m(2,0); matx[2][1]=m(2,1); matx[2][2]=m(2,2); matx[2][3]=(
T)0.;
174 matx[3][0]=(
T)t[0]; matx[3][1]=(
T)t[1]; matx[3][2]=(
T)t[2]; matx[3][3]=(
T)1.;
192 template <
typename S>
195 matx[0][0]=m(0,0); matx[0][1]=m(0,1);
196 matx[0][2]=m(0,2); matx[0][3]=(
T)0.;
197 matx[1][0]=m(1,0); matx[1][1]=m(1,1);
198 matx[1][2]=m(1,2); matx[1][3]=(
T)0.;
199 matx[2][0]=m(2,0); matx[2][1]=m(2,1);
200 matx[2][2]=m(2,2); matx[2][3]=(
T)0.;
201 matx[3][0]=(
T)0.; matx[3][1]=(
T)0.;
202 matx[3][2]=(
T)0.; matx[3][3]=(
T)1.;
206 template <
typename S>
209 matx[0][0]=m(0,0); matx[0][1]=m(0,1);
210 matx[0][2]=m(0,2); matx[0][3]=m(0,3);
211 matx[1][0]=m(1,0); matx[1][1]=m(1,1);
212 matx[1][2]=m(1,2); matx[1][3]=m(1,3);
213 matx[2][0]=m(2,0); matx[2][1]=m(2,1);
214 matx[2][2]=m(2,2); matx[2][3]=m(2,3);
215 matx[3][0]=m(3,0); matx[3][1]=m(3,1);
216 matx[3][2]=m(3,2); matx[3][3]=m(3,3);
221 template <
typename S>
224 matx[0][0] = m.q00; matx[0][1] = m.q01; matx[0][2] = m.q02;
225 matx[0][3] = m.q03; matx[1][0] = m.q01; matx[1][1] = m.q11;
226 matx[1][2] = m.q12; matx[1][3] = m.q13; matx[2][0] = m.q02;
227 matx[2][1] = m.q12; matx[2][2] = m.q22; matx[2][3] = m.q23;
228 matx[3][0] = m.q03; matx[3][1] = m.q13; matx[3][2] = m.q23;
236 -matx[0][0], -matx[0][1], -matx[0][2], -matx[0][3],
237 -matx[1][0], -matx[1][1], -matx[1][2], -matx[1][3],
238 -matx[2][0], -matx[2][1], -matx[2][2], -matx[2][3],
239 -matx[3][0], -matx[3][1], -matx[3][2], -matx[3][3]);
245 matx[0][0]+=m.
matx[0][0]; matx[0][1]+=m.
matx[0][1];
246 matx[0][2]+=m.
matx[0][2]; matx[0][3]+=m.
matx[0][3];
248 matx[1][0]+=m.
matx[1][0]; matx[1][1]+=m.
matx[1][1];
249 matx[1][2]+=m.
matx[1][2]; matx[1][3]+=m.
matx[1][3];
251 matx[2][0]+=m.
matx[2][0]; matx[2][1]+=m.
matx[2][1];
252 matx[2][2]+=m.
matx[2][2]; matx[2][3]+=m.
matx[2][3];
254 matx[3][0]+=m.
matx[3][0]; matx[3][1]+=m.
matx[3][1];
255 matx[3][2]+=m.
matx[3][2]; matx[3][3]+=m.
matx[3][3];
261 matx[0][0]-=m.
matx[0][0]; matx[0][1]-=m.
matx[0][1];
262 matx[0][2]-=m.
matx[0][2]; matx[0][3]-=m.
matx[0][3];
264 matx[1][0]-=m.
matx[1][0]; matx[1][1]-=m.
matx[1][1];
265 matx[1][2]-=m.
matx[1][2]; matx[1][3]-=m.
matx[1][3];
267 matx[2][0]-=m.
matx[2][0]; matx[2][1]-=m.
matx[2][1];
268 matx[2][2]-=m.
matx[2][2]; matx[2][3]-=m.
matx[2][3];
270 matx[3][0]-=m.
matx[3][0]; matx[3][1]-=m.
matx[3][1];
271 matx[3][2]-=m.
matx[3][2]; matx[3][3]-=m.
matx[3][3];
283 return (&m ==
this) || (
284 matx[0][0]==m.
matx[0][0] && matx[0][1]==m.
matx[0][1] &&
285 matx[0][2]==m.
matx[0][2] && matx[0][3]==m.
matx[0][3] &&
287 matx[1][0]==m.
matx[1][0] && matx[1][1]==m.
matx[1][1] &&
288 matx[1][2]==m.
matx[1][2] && matx[1][3]==m.
matx[1][3] &&
290 matx[2][0]==m.
matx[2][0] && matx[2][1]==m.
matx[2][1] &&
291 matx[2][2]==m.
matx[2][2] && matx[2][3]==m.
matx[2][3] &&
293 matx[3][0]==m.
matx[3][0] && matx[3][1]==m.
matx[3][1] &&
294 matx[3][2]==m.
matx[3][2] && matx[3][3]==m.
matx[3][3] );
299 return !(*
this == m);
305 matx[0][0]=
v; matx[0][1]= 0; matx[0][2]= 0; matx[0][3]= 0;
306 matx[1][0]= 0; matx[1][1]=
v; matx[1][2]= 0; matx[1][3]= 0;
307 matx[2][0]= 0; matx[2][1]= 0; matx[2][2]=
v; matx[2][3]= 0;
308 matx[3][0]= 0; matx[3][1]= 0; matx[3][2]= 0; matx[3][3]=
v;
318 matx[0][0]*=scalar; matx[0][1]*=scalar;
319 matx[0][2]*=scalar; matx[0][3]*=scalar;
321 matx[1][0]*=scalar; matx[1][1]*=scalar;
322 matx[1][2]*=scalar; matx[1][3]*=scalar;
324 matx[2][0]*=scalar; matx[2][1]*=scalar;
325 matx[2][2]*=scalar; matx[2][3]*=scalar;
327 matx[3][0]*=scalar; matx[3][1]*=scalar;
328 matx[3][2]*=scalar; matx[3][3]*=scalar;
338 template <
typename S>
340 template <
typename S>
342 template <
typename S>
367 det = matx[r[0]][c[0]]*
368 (matx[r[1]][c[1]]*matx[r[2]][c[2]]-
369 matx[r[1]][c[2]]*matx[r[2]][c[1]]) +
371 (matx[r[1]][c[2]]*matx[r[2]][c[0]]-
372 matx[r[1]][c[0]]*matx[r[2]][c[2]]) +
374 (matx[r[1]][c[0]]*matx[r[2]][c[1]]-
375 matx[r[1]][c[1]]*matx[r[2]][c[0]]);
385 return(matx[0][0]*coFactor(0,0) +
386 matx[0][1]*coFactor(0,1) +
387 matx[0][2]*coFactor(0,2) +
388 matx[0][3]*coFactor(0,3) );
394 (matx[1][1]*matx[2][2]-matx[1][2]*matx[2][1]) +
396 (matx[1][2]*matx[2][0]-matx[1][0]*matx[2][2]) +
398 (matx[1][0]*matx[2][1]-matx[1][1]*matx[2][0]) );
402 {
return matx[0][0]+matx[1][1]+matx[2][2]+matx[3][3]; }
444 template <
typename S>
451 template <
typename S>
470 template <
typename S>
481 { instanceT(p, v, s, s3, up, q, tr, orient,
pivot); }
487 { instanceT(p, v, s, s3, up, q, tr, orient,
pivot); }
489 template <
typename S>
500 { instanceInverseT(p, v, s, s3, up, q, tr, orient,
pivot); }
506 { instanceInverseT(p, v, s, s3, up, q, tr, orient,
pivot); }
512 tmp=matx[0][1]; matx[0][1]=matx[1][0]; matx[1][0]=tmp;
513 tmp=matx[0][2]; matx[0][2]=matx[2][0]; matx[2][0]=tmp;
514 tmp=matx[0][3]; matx[0][3]=matx[3][0]; matx[3][0]=tmp;
515 tmp=matx[1][2]; matx[1][2]=matx[2][1]; matx[2][1]=tmp;
516 tmp=matx[1][3]; matx[1][3]=matx[3][1]; matx[3][1]=tmp;
517 tmp=matx[2][3]; matx[2][3]=matx[3][2]; matx[3][2]=tmp;
521 return UT_Matrix4T<T>(matx[0][0], matx[1][0], matx[2][0], matx[3][0],
522 matx[0][1], matx[1][1], matx[2][1], matx[3][1],
523 matx[0][2], matx[1][2], matx[2][2], matx[3][2],
524 matx[0][3], matx[1][3], matx[2][3], matx[3][3]);
531 return (&m ==
this) || (
559 template <
typename S>
562 template<UT_Axis3::axis A>
568 template<UT_Axis3::axis A,
bool reverse=false>
578 matx[
row][col0] = -matx[
row][col1];
579 matx[
row][col1] =
v1;
583 matx[
row][col0] = matx[
row][col1];
584 matx[
row][col1] = -
v1;
591 template<UT_Axis3::axis A>
599 matx[
row][col0] = -matx[
row][col0];
600 matx[
row][col1] = -matx[
row][col1];
606 template<UT_Axis3::axis A>
622 template <
typename S>
633 template <
typename S>
636 template<UT_Axis3::axis A>
637 void prerotate(
T theta);
642 template<UT_Axis3::axis A,
bool reverse=false>
648 for (
uint col = 0; col < 4; ++col)
649 v1[col] = matx[row0][col];
652 for (
uint col = 0; col < 4; ++col)
653 matx[row0][col] = matx[row1][col];
654 for (
uint col = 0; col < 4; ++col)
655 matx[row1][col] = -v1[col];
659 for (
uint col = 0; col < 4; ++col)
660 matx[row0][col] = -matx[row1][col];
661 for (
uint col = 0; col < 4; ++col)
662 matx[row1][col] = v1[col];
668 template<UT_Axis3::axis A>
674 for (
uint col = 0; col < 4; ++col)
675 matx[row0][col] = -matx[row0][col];
676 for (
uint col = 0; col < 4; ++col)
677 matx[row1][col] = -matx[row1][col];
686 {
rotate(rad(0), rad(1), rad(2), ord); }
692 void prerotate(
T rx,
T ry,
T rz,
696 { prerotate(rad(0), rad(1), rad(2), ord); }
703 matx[0][0] *= sx; matx[0][1] *= sy;
704 matx[0][2] *= sz; matx[0][3] *= sw;
706 matx[1][0] *= sx; matx[1][1] *= sy;
707 matx[1][2] *= sz; matx[1][3] *= sw;
709 matx[2][0] *= sx; matx[2][1] *= sy;
710 matx[2][2] *= sz; matx[2][3] *= sw;
712 matx[3][0] *= sx; matx[3][1] *= sy;
713 matx[3][2] *= sz; matx[3][3] *= sw;
725 matx[0][0] *= sx; matx[1][0] *= sy;
726 matx[2][0] *= sz; matx[3][0] *= sw;
728 matx[0][1] *= sx; matx[1][1] *= sy;
729 matx[2][1] *= sz; matx[3][1] *= sw;
731 matx[0][2] *= sx; matx[1][2] *= sy;
732 matx[2][2] *= sz; matx[3][2] *= sw;
734 matx[0][3] *= sx; matx[1][3] *= sy;
735 matx[2][3] *= sz; matx[3][3] *= sw;
738 { prescale(
s(0),
s(1),
s(2)); }
740 { prescale(s, s, s); }
754 matx[0][0] += matx[0][1]*s_xy + matx[0][2]*s_xz;
755 matx[0][1] += matx[0][2]*s_yz;
757 matx[1][0] += matx[1][1]*s_xy + matx[1][2]*s_xz;
758 matx[1][1] += matx[1][2]*s_yz;
760 matx[2][0] += matx[2][1]*s_xy + matx[2][2]*s_xz;
761 matx[2][1] += matx[2][2]*s_yz;
763 matx[3][0] += matx[3][1]*s_xy + matx[3][2]*s_xz;
764 matx[3][1] += matx[3][2]*s_yz;
768 {
shear(sh(0), sh(1), sh(2)); }
777 matx[0][0] += a*dx; matx[0][1] += a*dy; matx[0][2] += a*dz;
779 matx[1][0] += a*dx; matx[1][1] += a*dy; matx[1][2] += a*dz;
781 matx[2][0] += a*dx; matx[2][1] += a*dy; matx[2][2] += a*dz;
783 matx[3][0] += a*dx; matx[3][1] += a*dy; matx[3][2] += a*dz;
787 {
translate(delta(0), delta(1), delta(2)); }
794 matx[3][0] += matx[0][0]*dx + matx[1][0]*dy + matx[2][0]*dz;
795 matx[3][1] += matx[0][1]*dx + matx[1][1]*dy + matx[2][1]*dz;
796 matx[3][2] += matx[0][2]*dx + matx[1][2]*dy + matx[2][2]*dz;
797 matx[3][3] += matx[0][3]*dx + matx[1][3]*dy + matx[2][3]*dz;
801 { pretranslate(delta(0), delta(1), delta(2)); }
810 template <
typename S>
824 T tx=0,
T ty=0,
T tz=0,
825 T rx=0,
T ry=0,
T rz=0,
826 T sx=1,
T sy=1,
T sz=1,
827 T px=0,
T py=0,
T pz=0,
835 T s_xy,
T s_xz,
T s_yz,
840 template <
typename S>
845 : myTranslate(0, 0, 0)
853 : myTranslate(translate)
877 T s_xy,
T s_xz,
T s_yz,
887 , myTranslate(0, 0, 0)
888 , myRotateOffset(0, 0, 0)
889 , myParentRotate(0, 0, 0)
891 , myChildRotate(0, 0, 0)
892 , myRotatePivot(0, 0, 0)
893 , myScaleOffset(0, 0, 0)
896 , myScalePivot(0, 0, 0)
898 , myPivotRotate(0, 0, 0)
930 enum applyType { BEFORE=1, EQUAL=2, AFTER=4, BEFORE_EQUAL=4, AFTER_EQUAL=6};
932 applyType
type,
char limit,
939 applyType
type,
char limit,
943 template <
typename S>
945 template <
typename S>
954 template <
typename S>
961 {
return explodeT(order, r, s, t, shears); }
965 {
return explodeT(order, r, s, t, shears); }
968 template <
typename S>
977 {
return explodeT(order, r, s, t, p, shears); }
982 {
return explodeT(order, r, s, t, p, shears); }
985 template <
typename S>
994 {
return explodeT(order, r, s, t, p, shears); }
999 {
return explodeT(order, r, s, t, p, shears); }
1004 template <
typename S>
1007 S *shears = 0)
const;
1009 template <
typename S>
1013 S *shears = 0)
const;
1017 template <
typename S>
1027 template <
typename S>
1032 const int max_iter = 64,
1033 const T rel_tol = FLT_EPSILON)
const;
1038 template <
typename S>
1057 bool polarDecompose(
1060 const int max_iter = 64,
1061 const T rel_tol = FLT_EPSILON);
1074 bool makeRigidMatrix(
1077 const int max_iter = 64,
1078 const T rel_tol = FLT_EPSILON);
1084 template <
typename S>
1089 return (i <= 3 && j <= 3) ?
1090 matx[i][0]*matx[
j][0] + matx[i][1]*matx[
j][1] +
1091 matx[i][2]*matx[
j][2] + matx[i][3]*matx[
j][3] : (
T)0;
1095 template <
typename S>
1096 void outerproductUpdate(
T b,
1101 template <
typename S>
1122 for (
size_t i = 0; i < tuple_size; i++)
1136 matx[0][0]==1 && matx[0][1]==0 &&
1137 matx[0][2]==0 && matx[0][3]==0 &&
1138 matx[1][0]==0 && matx[1][1]==1 &&
1139 matx[1][2]==0 && matx[1][3]==0 &&
1140 matx[2][0]==0 && matx[2][1]==0 &&
1141 matx[2][2]==1 && matx[2][3]==0 &&
1142 matx[3][0]==0 && matx[3][1]==0 &&
1143 matx[3][2]==0 && matx[3][3]==1);
1150 matx[0][0]==0 && matx[0][1]==0 &&
1151 matx[0][2]==0 && matx[0][3]==0 &&
1152 matx[1][0]==0 && matx[1][1]==0 &&
1153 matx[1][2]==0 && matx[1][3]==0 &&
1154 matx[2][0]==0 && matx[2][1]==0 &&
1155 matx[2][2]==0 && matx[2][3]==0 &&
1156 matx[3][0]==0 && matx[3][1]==0 &&
1157 matx[3][2]==0 && matx[3][3]==0);
1163 const T *
data()
const {
return myFloats; }
1168 unsigned hash()
const {
return SYSvector_hash(
data(), tuple_size); }
1176 return matx[
row][col];
1182 return matx[
row][col];
1213 {
return SYSsqrt(getEuclideanNorm2()); }
1215 T getEuclideanNorm2()
const;
1223 T getNormInf()
const;
1227 T getNormMax()
const;
1231 T getNormSpectral()
const;
1235 T getInfinityNorm()
const {
return getNormInf(); }
1247 int save(std::ostream &os,
int binary)
const;
1249 void dump(
const char *msg=
"")
const;
1251 void outAsciiNoName(std::ostream &os)
const;
1264 friend std::ostream &operator<<(std::ostream &os, const UT_Matrix4T<T> &
v)
1266 v.writeClassName(os);
1267 v.outAsciiNoName(os);
1278 T myFloats[tuple_size];
1314 void perspective(
fpreal zoom,
1354 void orthographic(
fpreal zoom,
1364 template <
int ORDER>
1370 void coVals(
int k,
int r[3])
const
1374 case 0: r[0] = 1; r[1] = 2; r[2] = 3;
break;
1375 case 1: r[0] = 0; r[1] = 2; r[2] = 3;
break;
1376 case 2: r[0] = 0; r[1] = 1; r[2] = 3;
break;
1377 case 3: r[0] = 0; r[1] = 1; r[2] = 2;
break;
1383 void writeClassName(std::ostream &os)
const;
1384 static const char *className();
1389 template <
typename T>
1390 template <
typename S>
1394 matx[0][0] = matx[0][1] = matx[0][2] = matx[0][3] = vec.
x();
1395 matx[1][0] = matx[1][1] = matx[1][2] = matx[1][3] = vec.
y();
1396 matx[2][0] = matx[2][1] = matx[2][2] = matx[2][3] = vec.
z();
1397 matx[3][0] = matx[3][1] = matx[3][2] = matx[3][3] = vec.
w();
1401 template <
typename T>
1402 template <
typename S>
1406 T x = vec.
x();
T y = vec.
y();
1407 T z = vec.
z();
T w = vec.
w();
1408 matx[0][0]+=
x; matx[0][1]+=
x; matx[0][2]+=
x; matx[0][3]+=
x;
1409 matx[1][0]+=
y; matx[1][1]+=
y; matx[1][2]+=
y; matx[1][3]+=
y;
1410 matx[2][0]+=
z; matx[2][1]+=
z; matx[2][2]+=
z; matx[2][3]+=
z;
1411 matx[3][0]+=
w; matx[3][1]+=
w; matx[3][2]+=
w; matx[3][3]+=
w;
1415 template <
typename T>
1416 template <
typename S>
1420 T x = vec.
x();
T y = vec.
y();
1421 T z = vec.
z();
T w = vec.
w();
1422 matx[0][0]-=
x; matx[0][1]-=
x; matx[0][2]-=
x; matx[0][3]-=
x;
1423 matx[1][0]-=
y; matx[1][1]-=
y; matx[1][2]-=
y; matx[1][3]-=
y;
1424 matx[2][0]-=
z; matx[2][1]-=
z; matx[2][2]-=
z; matx[2][3]-=
z;
1425 matx[3][0]-=
w; matx[3][1]-=
w; matx[3][2]-=
w; matx[3][3]-=
w;
1429 template <
typename T>
1430 template <
typename S>
1434 translates.
x() = matx[3][0];
1435 translates.
y() = matx[3][1];
1436 translates.
z() = matx[3][2];
1439 template <
typename T>
1440 template <
typename S>
1444 matx[3][0] = translates.
x();
1445 matx[3][1] = translates.
y();
1446 matx[3][2] = translates.
z();
1449 template <
typename T>
1457 template <
typename T>
1465 template <
typename T>
1466 template <
typename S>
1471 a = matx[0][0]; b = matx[0][1]; c = matx[0][2]; d = matx[0][3];
1472 matx[0][0] = a*m(0,0) + b*m(1,0) + c*m(2,0) + d*m(3,0);
1473 matx[0][1] = a*m(0,1) + b*m(1,1) + c*m(2,1) + d*m(3,1);
1474 matx[0][2] = a*m(0,2) + b*m(1,2) + c*m(2,2) + d*m(3,2);
1475 matx[0][3] = a*m(0,3) + b*m(1,3) + c*m(2,3) + d*m(3,3);
1477 a = matx[1][0]; b = matx[1][1]; c = matx[1][2]; d = matx[1][3];
1478 matx[1][0] = a*m(0,0) + b*m(1,0) + c*m(2,0) + d*m(3,0);
1479 matx[1][1] = a*m(0,1) + b*m(1,1) + c*m(2,1) + d*m(3,1);
1480 matx[1][2] = a*m(0,2) + b*m(1,2) + c*m(2,2) + d*m(3,2);
1481 matx[1][3] = a*m(0,3) + b*m(1,3) + c*m(2,3) + d*m(3,3);
1483 a = matx[2][0]; b = matx[2][1]; c = matx[2][2]; d = matx[2][3];
1484 matx[2][0] = a*m(0,0) + b*m(1,0) + c*m(2,0) + d*m(3,0);
1485 matx[2][1] = a*m(0,1) + b*m(1,1) + c*m(2,1) + d*m(3,1);
1486 matx[2][2] = a*m(0,2) + b*m(1,2) + c*m(2,2) + d*m(3,2);
1487 matx[2][3] = a*m(0,3) + b*m(1,3) + c*m(2,3) + d*m(3,3);
1489 a = matx[3][0]; b = matx[3][1]; c = matx[3][2]; d = matx[3][3];
1490 matx[3][0] = a*m(0,0) + b*m(1,0) + c*m(2,0) + d*m(3,0);
1491 matx[3][1] = a*m(0,1) + b*m(1,1) + c*m(2,1) + d*m(3,1);
1492 matx[3][2] = a*m(0,2) + b*m(1,2) + c*m(2,2) + d*m(3,2);
1493 matx[3][3] = a*m(0,3) + b*m(1,3) + c*m(2,3) + d*m(3,3);
1497 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1511 for (
int i = 0; i < 4; i++)
1524 template <
typename T>
1525 template <
typename S>
1530 a = matx[0][0]; b = matx[0][1]; c = matx[0][2];
1531 matx[0][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
1532 matx[0][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
1533 matx[0][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
1535 a = matx[1][0]; b = matx[1][1]; c = matx[1][2];
1536 matx[1][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
1537 matx[1][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
1538 matx[1][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
1540 a = matx[2][0]; b = matx[2][1]; c = matx[2][2];
1541 matx[2][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
1542 matx[2][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
1543 matx[2][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
1545 a = matx[3][0]; b = matx[3][1]; c = matx[3][2];
1546 matx[3][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
1547 matx[3][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
1548 matx[3][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
1552 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1559 const v4uf m0(m(0));
1560 const v4uf m1(m(1));
1561 const v4uf m2(m(2,0), m(2,1), m(2,2), 0);
1563 for (
int i = 0; i < 4; ++i)
1576 template <>
inline void
1580 for (
int i = 0; i < 4; ++i)
1591 template <
typename T>
1596 a = matx[0][0]; b = matx[1][0]; c = matx[2][0]; d = matx[3][0];
1597 matx[0][0] = a*m(0,0) + b*m(0,1) + c*m(0,2) + d*m(0,3);
1598 matx[1][0] = a*m(1,0) + b*m(1,1) + c*m(1,2) + d*m(1,3);
1599 matx[2][0] = a*m(2,0) + b*m(2,1) + c*m(2,2) + d*m(2,3);
1600 matx[3][0] = a*m(3,0) + b*m(3,1) + c*m(3,2) + d*m(3,3);
1602 a = matx[0][1]; b = matx[1][1]; c = matx[2][1]; d = matx[3][1];
1603 matx[0][1] = a*m(0,0) + b*m(0,1) + c*m(0,2) + d*m(0,3);
1604 matx[1][1] = a*m(1,0) + b*m(1,1) + c*m(1,2) + d*m(1,3);
1605 matx[2][1] = a*m(2,0) + b*m(2,1) + c*m(2,2) + d*m(2,3);
1606 matx[3][1] = a*m(3,0) + b*m(3,1) + c*m(3,2) + d*m(3,3);
1608 a = matx[0][2]; b = matx[1][2]; c = matx[2][2]; d = matx[3][2];
1609 matx[0][2] = a*m(0,0) + b*m(0,1) + c*m(0,2) + d*m(0,3);
1610 matx[1][2] = a*m(1,0) + b*m(1,1) + c*m(1,2) + d*m(1,3);
1611 matx[2][2] = a*m(2,0) + b*m(2,1) + c*m(2,2) + d*m(2,3);
1612 matx[3][2] = a*m(3,0) + b*m(3,1) + c*m(3,2) + d*m(3,3);
1614 a = matx[0][3]; b = matx[1][3]; c = matx[2][3]; d = matx[3][3];
1615 matx[0][3] = a*m(0,0) + b*m(0,1) + c*m(0,2) + d*m(0,3);
1616 matx[1][3] = a*m(1,0) + b*m(1,1) + c*m(1,2) + d*m(1,3);
1617 matx[2][3] = a*m(2,0) + b*m(2,1) + c*m(2,2) + d*m(2,3);
1618 matx[3][3] = a*m(3,0) + b*m(3,1) + c*m(3,2) + d*m(3,3);
1621 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1631 for (
int i = 0; i < 4; ++i)
1644 template <
typename T>
1649 m[0][0] = m1(0,0)+m2(0,0); m[0][1] = m1(0,1)+m2(0,1);
1650 m[0][2] = m1(0,2)+m2(0,2); m[0][3] = m1(0,3)+m2(0,3);
1652 m[1][0] = m1(1,0)+m2(1,0); m[1][1] = m1(1,1)+m2(1,1);
1653 m[1][2] = m1(1,2)+m2(1,2); m[1][3] = m1(1,3)+m2(1,3);
1655 m[2][0] = m1(2,0)+m2(2,0); m[2][1] = m1(2,1)+m2(2,1);
1656 m[2][2] = m1(2,2)+m2(2,2); m[2][3] = m1(2,3)+m2(2,3);
1658 m[3][0] = m1(3,0)+m2(3,0); m[3][1] = m1(3,1)+m2(3,1);
1659 m[3][2] = m1(3,2)+m2(3,2); m[3][3] = m1(3,3)+m2(3,3);
1662 template <
typename T>
1667 m[0][0] = m1(0,0)-m2(0,0); m[0][1] = m1(0,1)-m2(0,1);
1668 m[0][2] = m1(0,2)-m2(0,2); m[0][3] = m1(0,3)-m2(0,3);
1670 m[1][0] = m1(1,0)-m2(1,0); m[1][1] = m1(1,1)-m2(1,1);
1671 m[1][2] = m1(1,2)-m2(1,2); m[1][3] = m1(1,3)-m2(1,3);
1673 m[2][0] = m1(2,0)-m2(2,0); m[2][1] = m1(2,1)-m2(2,1);
1674 m[2][2] = m1(2,2)-m2(2,2); m[2][3] = m1(2,3)-m2(2,3);
1676 m[3][0] = m1(3,0)-m2(3,0); m[3][1] = m1(3,1)-m2(3,1);
1677 m[3][2] = m1(3,2)-m2(3,2); m[3][3] = m1(3,3)-m2(3,3);
1680 template <
typename T>
1685 m[0][0] = m1(0,0)*m2(0,0) + m1(0,1)*m2(1,0) +
1686 m1(0,2)*m2(2,0) + m1(0,3)*m2(3,0) ;
1687 m[0][1] = m1(0,0)*m2(0,1) + m1(0,1)*m2(1,1) +
1688 m1(0,2)*m2(2,1) + m1(0,3)*m2(3,1) ;
1689 m[0][2] = m1(0,0)*m2(0,2) + m1(0,1)*m2(1,2) +
1690 m1(0,2)*m2(2,2) + m1(0,3)*m2(3,2) ;
1691 m[0][3] = m1(0,0)*m2(0,3) + m1(0,1)*m2(1,3) +
1692 m1(0,2)*m2(2,3) + m1(0,3)*m2(3,3) ;
1694 m[1][0] = m1(1,0)*m2(0,0) + m1(1,1)*m2(1,0) +
1695 m1(1,2)*m2(2,0) + m1(1,3)*m2(3,0) ;
1696 m[1][1] = m1(1,0)*m2(0,1) + m1(1,1)*m2(1,1) +
1697 m1(1,2)*m2(2,1) + m1(1,3)*m2(3,1) ;
1698 m[1][2] = m1(1,0)*m2(0,2) + m1(1,1)*m2(1,2) +
1699 m1(1,2)*m2(2,2) + m1(1,3)*m2(3,2) ;
1700 m[1][3] = m1(1,0)*m2(0,3) + m1(1,1)*m2(1,3) +
1701 m1(1,2)*m2(2,3) + m1(1,3)*m2(3,3) ;
1703 m[2][0] = m1(2,0)*m2(0,0) + m1(2,1)*m2(1,0) +
1704 m1(2,2)*m2(2,0) + m1(2,3)*m2(3,0) ;
1705 m[2][1] = m1(2,0)*m2(0,1) + m1(2,1)*m2(1,1) +
1706 m1(2,2)*m2(2,1) + m1(2,3)*m2(3,1) ;
1707 m[2][2] = m1(2,0)*m2(0,2) + m1(2,1)*m2(1,2) +
1708 m1(2,2)*m2(2,2) + m1(2,3)*m2(3,2) ;
1709 m[2][3] = m1(2,0)*m2(0,3) + m1(2,1)*m2(1,3) +
1710 m1(2,2)*m2(2,3) + m1(2,3)*m2(3,3) ;
1712 m[3][0] = m1(3,0)*m2(0,0) + m1(3,1)*m2(1,0) +
1713 m1(3,2)*m2(2,0) + m1(3,3)*m2(3,0) ;
1714 m[3][1] = m1(3,0)*m2(0,1) + m1(3,1)*m2(1,1) +
1715 m1(3,2)*m2(2,1) + m1(3,3)*m2(3,1) ;
1716 m[3][2] = m1(3,0)*m2(0,2) + m1(3,1)*m2(1,2) +
1717 m1(3,2)*m2(2,2) + m1(3,3)*m2(3,2) ;
1718 m[3][3] = m1(3,0)*m2(0,3) + m1(3,1)*m2(1,3) +
1719 m1(3,2)*m2(2,3) + m1(3,3)*m2(3,3) ;
1722 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1734 for (
int i = 0; i < 4; ++i)
1747 template <
typename T,
typename S>
1753 m[0][0] = m1(0,0) +
x; m[0][1] = m1(0,1) +
x;
1754 m[0][2] = m1(0,2) +
x; m[0][3] = m1(0,3) +
x;
1756 m[1][0] = m1(1,0) +
y; m[1][1] = m1(1,1) +
y;
1757 m[1][2] = m1(1,2) +
y; m[1][3] = m1(1,3) +
y;
1759 m[2][0] = m1(2,0) +
z; m[2][1] = m1(2,1) +
z;
1760 m[2][2] = m1(2,2) +
z; m[2][3] = m1(2,3) +
z;
1762 m[3][0] = m1(3,0) +
w; m[3][1] = m1(3,1) +
w;
1763 m[3][2] = m1(3,2) +
w; m[3][3] = m1(3,3) +
w;
1767 template <
typename T,
typename S>
1774 template <
typename T,
typename S>
1780 m[0][0] = m1(0,0) -
x; m[0][1] = m1(0,1) -
x;
1781 m[0][2] = m1(0,2) -
x; m[0][3] = m1(0,3) -
x;
1783 m[1][0] = m1(1,0) -
y; m[1][1] = m1(1,1) -
y;
1784 m[1][2] = m1(1,2) -
y; m[1][3] = m1(1,3) -
y;
1786 m[2][0] = m1(2,0) -
z; m[2][1] = m1(2,1) -
z;
1787 m[2][2] = m1(2,2) -
z; m[2][3] = m1(2,3) -
z;
1789 m[3][0] = m1(3,0) -
w; m[3][1] = m1(3,1) -
w;
1790 m[3][2] = m1(3,2) -
w; m[3][3] = m1(3,3) -
w;
1794 template <
typename T,
typename S>
1800 m[0][0] = x - m1(0,0); m[0][1] = x - m1(0,1);
1801 m[0][2] = x - m1(0,2); m[0][3] = x - m1(0,3);
1803 m[1][0] = y - m1(1,0); m[1][1] = y - m1(1,1);
1804 m[1][2] = y - m1(1,2); m[1][3] = y - m1(1,3);
1806 m[2][0] = z - m1(2,0); m[2][1] = z - m1(2,1);
1807 m[2][2] = z - m1(2,2); m[2][3] = z - m1(2,3);
1809 m[3][0] = w - m1(3,0); m[3][1] = w - m1(3,1);
1810 m[3][2] = w - m1(3,2); m[3][3] = w - m1(3,3);
1814 template <
typename T,
typename S>
1819 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;
1820 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;
1821 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;
1822 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;
1826 template <
typename T,
typename S>
1831 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);
1832 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);
1833 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);
1834 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);
1838 template <
typename T,
typename S>
1845 template <
typename T,
typename S>
1850 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;
1851 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;
1852 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;
1853 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;
1857 template <
typename T,
typename S>
1862 return (m1 * (
T(1.0)/scalar));
1865 template <
typename T,
typename S>
1870 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);
1871 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);
1872 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);
1873 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);
1896 template <
typename T,
typename S>
1898 template <
typename T,
typename S>
1901 template <
typename T,
typename S>
1903 template <
typename T,
typename S>
1907 template <
typename T,
typename S>
1912 v.
x()*m(0,0) + v.
y()*m(1,0) + v.
z()*m(2,0) + m(3,0),
1913 v.
x()*m(0,1) + v.
y()*m(1,1) + v.
z()*m(2,1) + m(3,1),
1914 v.
x()*m(0,2) + v.
y()*m(1,2) + v.
z()*m(2,2) + m(3,2)
1917 template <
typename T,
typename S>
1924 template <
typename T,
typename S>
1929 v.
x()*m(0,0) + v.
y()*m(1,0) + v.
z()*m(2,0),
1930 v.
x()*m(0,1) + v.
y()*m(1,1) + v.
z()*m(2,1),
1931 v.
x()*m(0,2) + v.
y()*m(1,2) + v.
z()*m(2,2)
1935 template <
typename T,
typename S>
1940 v.
x()*m(0,0) + v.
y()*m(0,1) + v.
z()*m(0,2) + m(0,3),
1941 v.
x()*m(1,0) + v.
y()*m(1,1) + v.
z()*m(1,2) + m(1,3),
1942 v.
x()*m(2,0) + v.
y()*m(2,1) + v.
z()*m(2,2) + m(2,3)
1946 template <
typename T,
typename S>
1951 v.
x()*m(0,0) + v.
y()*m(0,1) + v.
z()*m(0,2),
1952 v.
x()*m(1,0) + v.
y()*m(1,1) + v.
z()*m(1,2),
1953 v.
x()*m(2,0) + v.
y()*m(2,1) + v.
z()*m(2,2)
1956 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1987 v4uf(m(0,0), m(1,0), m(2,0), m(3,0)) *
v4uf(v[0])
1988 +
v4uf(m(0,1), m(1,1), m(2,1), m(3,1)) *
v4uf(v[1])
1989 +
v4uf(m(0,2), m(1,2), m(2,2), m(3,2)) *
v4uf(v[2])
1990 +
v4uf(m(0,3), m(1,3), m(2,3), m(3,3));
2000 v4uf(m(0,0), m(1,0), m(2,0), m(3,0)) *
v4uf(v[0])
2001 +
v4uf(m(0,1), m(1,1), m(2,1), m(3,1)) *
v4uf(v[1])
2002 +
v4uf(m(0,2), m(1,2), m(2,2), m(3,2)) *
v4uf(v[2]);
2010 template <
typename T>
2016 template <
typename T>
2022 template <
typename T>
2028 template <
typename T>
2034 template <
typename T>
2040 template <
typename T>
2046 template <
typename T>
2052 template <
typename T>
2058 template <
typename T>
2059 template <
typename S>
2066 template <
typename T>
2067 template <
typename S>
2073 template <
typename T>
2074 template <
typename S>
2080 template <
typename T>
2081 template <
typename S>
2087 template <
typename T>
2088 template <
typename S>
2094 template <
typename T>
2095 template <
typename S>
2102 template <
typename T>
2108 template <
typename T>
2132 template <
typename T>
2156 template <
typename T,
typename S>
2179 #ifndef UT_DISABLE_VECTORIZE_MATRIX
2185 for (
int i = 0; i < 4; ++i)
2196 template<
typename T, ex
int D >
2199 template<
typename T>
2209 template<
typename T>
2215 template <
typename T>
2218 template<
typename TS >
2224 as[ 0], as[ 1], as[ 2], as[ 3],
2225 as[ 4], as[ 5], as[ 6], as[ 7],
2226 as[ 8], as[ 9], as[10], as[11],
2227 as[12], as[13], as[14], as[15]
2235 template<
typename TS >
2247 template <
typename V >
2251 template <
typename T>
2254 template <
typename T>
template<
int ORDER>
2261 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2262 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2263 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2268 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2269 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2270 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2275 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2276 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2277 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2282 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2283 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2284 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2289 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2290 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2291 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2296 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2297 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2298 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)
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
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.
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.
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
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)
GA_API const UT_StringHolder up
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