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>
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])}}
135 template <
typename S>
138 matx[0][0]=v[0]; matx[0][1]=v[1]; matx[0][2]=v[2]; matx[0][3]=v[3];
139 matx[1][0]=v[4]; matx[1][1]=v[5]; matx[1][2]=v[6]; matx[1][3]=v[7];
140 matx[2][0]=v[8]; matx[2][1]=v[9]; matx[2][2]=v[10];matx[2][3]=v[11];
141 matx[3][0]=v[12];matx[3][1]=v[13];matx[3][2]=v[14];matx[3][3]=v[15];
146 T val10,
T val11,
T val12,
T val13,
147 T val20,
T val21,
T val22,
T val23,
148 T val30,
T val31,
T val32,
T val33)
150 matx[0][0] = val00; matx[0][1] = val01; matx[0][2] = val02;
152 matx[1][0] = val10; matx[1][1] = val11; matx[1][2] = val12;
154 matx[2][0] = val20; matx[2][1] = val21; matx[2][2] = val22;
156 matx[3][0] = val30; matx[3][1] = val31; matx[3][2] = val32;
161 template <
typename S>
164 matx[0][0]=
m(0,0); matx[0][1]=
m(0,1); matx[0][2]=
m(0,2); matx[0][3]=
m(0,3);
165 matx[1][0]=
m(1,0); matx[1][1]=
m(1,1); matx[1][2]=
m(1,2); matx[1][3]=
m(1,3);
166 matx[2][0]=
m(2,0); matx[2][1]=
m(2,1); matx[2][2]=
m(2,2); matx[2][3]=
m(2,3);
167 matx[3][0]=
m(3,0); matx[3][1]=
m(3,1); matx[3][2]=
m(3,2); matx[3][3]=
m(3,3);
169 template <
typename S>
172 matx[0][0]=
m(0,0); matx[0][1]=
m(0,1); matx[0][2]=
m(0,2); matx[0][3]=(
T)0.;
173 matx[1][0]=
m(1,0); matx[1][1]=
m(1,1); matx[1][2]=
m(1,2); matx[1][3]=(
T)0.;
174 matx[2][0]=
m(2,0); matx[2][1]=
m(2,1); matx[2][2]=
m(2,2); matx[2][3]=(
T)0.;
175 matx[3][0]=(
T)0.; matx[3][1]=(
T)0.; matx[3][2]=(
T)0.; matx[3][3]=(
T)1.;
193 template <
typename S>
196 matx[0][0]=
m(0,0); matx[0][1]=
m(0,1);
197 matx[0][2]=
m(0,2); matx[0][3]=(
T)0.;
198 matx[1][0]=
m(1,0); matx[1][1]=
m(1,1);
199 matx[1][2]=
m(1,2); matx[1][3]=(
T)0.;
200 matx[2][0]=
m(2,0); matx[2][1]=
m(2,1);
201 matx[2][2]=
m(2,2); matx[2][3]=(
T)0.;
202 matx[3][0]=(
T)0.; matx[3][1]=(
T)0.;
203 matx[3][2]=(
T)0.; matx[3][3]=(
T)1.;
207 template <
typename S>
210 matx[0][0]=
m(0,0); matx[0][1]=
m(0,1);
211 matx[0][2]=
m(0,2); matx[0][3]=
m(0,3);
212 matx[1][0]=
m(1,0); matx[1][1]=
m(1,1);
213 matx[1][2]=
m(1,2); matx[1][3]=
m(1,3);
214 matx[2][0]=
m(2,0); matx[2][1]=
m(2,1);
215 matx[2][2]=
m(2,2); matx[2][3]=
m(2,3);
216 matx[3][0]=
m(3,0); matx[3][1]=
m(3,1);
217 matx[3][2]=
m(3,2); matx[3][3]=
m(3,3);
222 template <
typename S>
225 matx[0][0] = m.q00; matx[0][1] = m.q01; matx[0][2] = m.q02;
226 matx[0][3] = m.q03; matx[1][0] = m.q01; matx[1][1] = m.q11;
227 matx[1][2] = m.q12; matx[1][3] = m.q13; matx[2][0] = m.q02;
228 matx[2][1] = m.q12; matx[2][2] = m.q22; matx[2][3] = m.q23;
229 matx[3][0] = m.q03; matx[3][1] = m.q13; matx[3][2] = m.q23;
237 -matx[0][0], -matx[0][1], -matx[0][2], -matx[0][3],
238 -matx[1][0], -matx[1][1], -matx[1][2], -matx[1][3],
239 -matx[2][0], -matx[2][1], -matx[2][2], -matx[2][3],
240 -matx[3][0], -matx[3][1], -matx[3][2], -matx[3][3]);
246 matx[0][0]+=m.
matx[0][0]; matx[0][1]+=m.
matx[0][1];
247 matx[0][2]+=m.
matx[0][2]; matx[0][3]+=m.
matx[0][3];
249 matx[1][0]+=m.
matx[1][0]; matx[1][1]+=m.
matx[1][1];
250 matx[1][2]+=m.
matx[1][2]; matx[1][3]+=m.
matx[1][3];
252 matx[2][0]+=m.
matx[2][0]; matx[2][1]+=m.
matx[2][1];
253 matx[2][2]+=m.
matx[2][2]; matx[2][3]+=m.
matx[2][3];
255 matx[3][0]+=m.
matx[3][0]; matx[3][1]+=m.
matx[3][1];
256 matx[3][2]+=m.
matx[3][2]; matx[3][3]+=m.
matx[3][3];
262 matx[0][0]-=m.
matx[0][0]; matx[0][1]-=m.
matx[0][1];
263 matx[0][2]-=m.
matx[0][2]; matx[0][3]-=m.
matx[0][3];
265 matx[1][0]-=m.
matx[1][0]; matx[1][1]-=m.
matx[1][1];
266 matx[1][2]-=m.
matx[1][2]; matx[1][3]-=m.
matx[1][3];
268 matx[2][0]-=m.
matx[2][0]; matx[2][1]-=m.
matx[2][1];
269 matx[2][2]-=m.
matx[2][2]; matx[2][3]-=m.
matx[2][3];
271 matx[3][0]-=m.
matx[3][0]; matx[3][1]-=m.
matx[3][1];
272 matx[3][2]-=m.
matx[3][2]; matx[3][3]-=m.
matx[3][3];
284 return (&m ==
this) || (
285 matx[0][0]==m.
matx[0][0] && matx[0][1]==m.
matx[0][1] &&
286 matx[0][2]==m.
matx[0][2] && matx[0][3]==m.
matx[0][3] &&
288 matx[1][0]==m.
matx[1][0] && matx[1][1]==m.
matx[1][1] &&
289 matx[1][2]==m.
matx[1][2] && matx[1][3]==m.
matx[1][3] &&
291 matx[2][0]==m.
matx[2][0] && matx[2][1]==m.
matx[2][1] &&
292 matx[2][2]==m.
matx[2][2] && matx[2][3]==m.
matx[2][3] &&
294 matx[3][0]==m.
matx[3][0] && matx[3][1]==m.
matx[3][1] &&
295 matx[3][2]==m.
matx[3][2] && matx[3][3]==m.
matx[3][3] );
300 return !(*
this ==
m);
306 matx[0][0]=
v; matx[0][1]= 0; matx[0][2]= 0; matx[0][3]= 0;
307 matx[1][0]= 0; matx[1][1]=
v; matx[1][2]= 0; matx[1][3]= 0;
308 matx[2][0]= 0; matx[2][1]= 0; matx[2][2]=
v; matx[2][3]= 0;
309 matx[3][0]= 0; matx[3][1]= 0; matx[3][2]= 0; matx[3][3]=
v;
319 matx[0][0]*=scalar; matx[0][1]*=scalar;
320 matx[0][2]*=scalar; matx[0][3]*=scalar;
322 matx[1][0]*=scalar; matx[1][1]*=scalar;
323 matx[1][2]*=scalar; matx[1][3]*=scalar;
325 matx[2][0]*=scalar; matx[2][1]*=scalar;
326 matx[2][2]*=scalar; matx[2][3]*=scalar;
328 matx[3][0]*=scalar; matx[3][1]*=scalar;
329 matx[3][2]*=scalar; matx[3][3]*=scalar;
339 template <
typename S>
341 template <
typename S>
343 template <
typename S>
368 det = matx[r[0]][c[0]]*
369 (matx[r[1]][c[1]]*matx[r[2]][c[2]]-
370 matx[r[1]][c[2]]*matx[r[2]][c[1]]) +
372 (matx[r[1]][c[2]]*matx[r[2]][c[0]]-
373 matx[r[1]][c[0]]*matx[r[2]][c[2]]) +
375 (matx[r[1]][c[0]]*matx[r[2]][c[1]]-
376 matx[r[1]][c[1]]*matx[r[2]][c[0]]);
386 return(matx[0][0]*coFactor(0,0) +
387 matx[0][1]*coFactor(0,1) +
388 matx[0][2]*coFactor(0,2) +
389 matx[0][3]*coFactor(0,3) );
395 (matx[1][1]*matx[2][2]-matx[1][2]*matx[2][1]) +
397 (matx[1][2]*matx[2][0]-matx[1][0]*matx[2][2]) +
399 (matx[1][0]*matx[2][1]-matx[1][1]*matx[2][0]) );
403 {
return matx[0][0]+matx[1][1]+matx[2][2]+matx[3][3]; }
435 template <
typename S>
446 { instanceT(p, v, s, s3, up, q, tr, orient,
pivot); }
452 { instanceT(p, v, s, s3, up, q, tr, orient,
pivot); }
454 template <
typename S>
465 { instanceInverseT(p, v, s, s3, up, q, tr, orient,
pivot); }
471 { instanceInverseT(p, v, s, s3, up, q, tr, orient,
pivot); }
477 tmp=matx[0][1]; matx[0][1]=matx[1][0]; matx[1][0]=tmp;
478 tmp=matx[0][2]; matx[0][2]=matx[2][0]; matx[2][0]=tmp;
479 tmp=matx[0][3]; matx[0][3]=matx[3][0]; matx[3][0]=tmp;
480 tmp=matx[1][2]; matx[1][2]=matx[2][1]; matx[2][1]=tmp;
481 tmp=matx[1][3]; matx[1][3]=matx[3][1]; matx[3][1]=tmp;
482 tmp=matx[2][3]; matx[2][3]=matx[3][2]; matx[3][2]=tmp;
489 return (&m ==
this) || (
490 SYSisEqual( matx[0][0], m.
matx[0][0], tolerance ) &&
491 SYSisEqual( matx[0][1], m.
matx[0][1], tolerance ) &&
492 SYSisEqual( matx[0][2], m.
matx[0][2], tolerance ) &&
493 SYSisEqual( matx[0][3], m.
matx[0][3], tolerance ) &&
495 SYSisEqual( matx[1][0], m.
matx[1][0], tolerance ) &&
496 SYSisEqual( matx[1][1], m.
matx[1][1], tolerance ) &&
497 SYSisEqual( matx[1][2], m.
matx[1][2], tolerance ) &&
498 SYSisEqual( matx[1][3], m.
matx[1][3], tolerance ) &&
500 SYSisEqual( matx[2][0], m.
matx[2][0], tolerance ) &&
501 SYSisEqual( matx[2][1], m.
matx[2][1], tolerance ) &&
502 SYSisEqual( matx[2][2], m.
matx[2][2], tolerance ) &&
503 SYSisEqual( matx[2][3], m.
matx[2][3], tolerance ) &&
505 SYSisEqual( matx[3][0], m.
matx[3][0], tolerance ) &&
506 SYSisEqual( matx[3][1], m.
matx[3][1], tolerance ) &&
507 SYSisEqual( matx[3][2], m.
matx[3][2], tolerance ) &&
508 SYSisEqual( matx[3][3], m.
matx[3][3], tolerance ) );
517 template <
typename S>
520 template<UT_Axis3::axis A>
526 template<UT_Axis3::axis A,
bool reverse=false>
536 matx[
row][col0] = -matx[
row][col1];
537 matx[
row][col1] =
v1;
541 matx[
row][col0] = matx[
row][col1];
542 matx[
row][col1] = -
v1;
549 template<UT_Axis3::axis A>
557 matx[
row][col0] = -matx[
row][col0];
558 matx[
row][col1] = -matx[
row][col1];
564 template<UT_Axis3::axis A>
580 template <
typename S>
591 template <
typename S>
594 template<UT_Axis3::axis A>
595 void prerotate(
T theta);
600 template<UT_Axis3::axis A,
bool reverse=false>
606 for (
uint col = 0; col < 4; ++col)
607 v1[col] = matx[row0][col];
610 for (
uint col = 0; col < 4; ++col)
611 matx[row0][col] = matx[row1][col];
612 for (
uint col = 0; col < 4; ++col)
613 matx[row1][col] = -v1[col];
617 for (
uint col = 0; col < 4; ++col)
618 matx[row0][col] = -matx[row1][col];
619 for (
uint col = 0; col < 4; ++col)
620 matx[row1][col] = v1[col];
626 template<UT_Axis3::axis A>
632 for (
uint col = 0; col < 4; ++col)
633 matx[row0][col] = -matx[row0][col];
634 for (
uint col = 0; col < 4; ++col)
635 matx[row1][col] = -matx[row1][col];
644 {
rotate(rad(0), rad(1), rad(2), ord); }
650 void prerotate(
T rx,
T ry,
T rz,
654 { prerotate(rad(0), rad(1), rad(2), ord); }
661 matx[0][0] *= sx; matx[0][1] *= sy;
662 matx[0][2] *= sz; matx[0][3] *= sw;
664 matx[1][0] *= sx; matx[1][1] *= sy;
665 matx[1][2] *= sz; matx[1][3] *= sw;
667 matx[2][0] *= sx; matx[2][1] *= sy;
668 matx[2][2] *= sz; matx[2][3] *= sw;
670 matx[3][0] *= sx; matx[3][1] *= sy;
671 matx[3][2] *= sz; matx[3][3] *= sw;
683 matx[0][0] *= sx; matx[1][0] *= sy;
684 matx[2][0] *= sz; matx[3][0] *= sw;
686 matx[0][1] *= sx; matx[1][1] *= sy;
687 matx[2][1] *= sz; matx[3][1] *= sw;
689 matx[0][2] *= sx; matx[1][2] *= sy;
690 matx[2][2] *= sz; matx[3][2] *= sw;
692 matx[0][3] *= sx; matx[1][3] *= sy;
693 matx[2][3] *= sz; matx[3][3] *= sw;
696 { prescale(
s(0),
s(1),
s(2)); }
698 { prescale(s, s, s); }
705 matx[0][0] += matx[0][1]*s_xy + matx[0][2]*s_xz;
706 matx[0][1] += matx[0][2]*s_yz;
708 matx[1][0] += matx[1][1]*s_xy + matx[1][2]*s_xz;
709 matx[1][1] += matx[1][2]*s_yz;
711 matx[2][0] += matx[2][1]*s_xy + matx[2][2]*s_xz;
712 matx[2][1] += matx[2][2]*s_yz;
714 matx[3][0] += matx[3][1]*s_xy + matx[3][2]*s_xz;
715 matx[3][1] += matx[3][2]*s_yz;
719 {
shear(sh(0), sh(1), sh(2)); }
728 matx[0][0] += a*dx; matx[0][1] += a*dy; matx[0][2] += a*dz;
730 matx[1][0] += a*dx; matx[1][1] += a*dy; matx[1][2] += a*dz;
732 matx[2][0] += a*dx; matx[2][1] += a*dy; matx[2][2] += a*dz;
734 matx[3][0] += a*dx; matx[3][1] += a*dy; matx[3][2] += a*dz;
738 {
translate(delta(0), delta(1), delta(2)); }
745 matx[3][0] += matx[0][0]*dx + matx[1][0]*dy + matx[2][0]*dz;
746 matx[3][1] += matx[0][1]*dx + matx[1][1]*dy + matx[2][1]*dz;
747 matx[3][2] += matx[0][2]*dx + matx[1][2]*dy + matx[2][2]*dz;
748 matx[3][3] += matx[0][3]*dx + matx[1][3]*dy + matx[2][3]*dz;
752 { pretranslate(delta(0), delta(1), delta(2)); }
761 template <
typename S>
775 T tx=0.0
f,
T ty=0.0
f,
T tz=0.0
f,
776 T rx=0.0
f,
T ry=0.0
f,
T rz=0.0
f,
777 T sx=1.0
f,
T sy=1.0
f,
T sz=1.0
f,
786 T s_xy,
T s_xz,
T s_yz,
791 template <
typename S>
796 : myTranslate(0, 0, 0)
804 : myTranslate(translate)
828 T s_xy,
T s_xz,
T s_yz,
838 , myTranslate(0, 0, 0)
839 , myRotateOffset(0, 0, 0)
840 , myParentRotate(0, 0, 0)
842 , myChildRotate(0, 0, 0)
843 , myRotatePivot(0, 0, 0)
844 , myScaleOffset(0, 0, 0)
847 , myScalePivot(0, 0, 0)
849 , myPivotRotate(0, 0, 0)
881 enum applyType { BEFORE=1, EQUAL=2, AFTER=4, BEFORE_EQUAL=4, AFTER_EQUAL=6};
894 template <
typename S>
896 template <
typename S>
905 template <
typename S>
912 {
return explodeT(order, r, s, t, shears); }
916 {
return explodeT(order, r, s, t, shears); }
919 template <
typename S>
928 {
return explodeT(order, r, s, t, p, shears); }
933 {
return explodeT(order, r, s, t, p, shears); }
936 template <
typename S>
945 {
return explodeT(order, r, s, t, p, shears); }
950 {
return explodeT(order, r, s, t, p, shears); }
955 template <
typename S>
958 S *shears = 0)
const;
960 template <
typename S>
964 S *shears = 0)
const;
968 template <
typename S>
987 const int max_iter = 64,
988 const T rel_tol = FLT_EPSILON);
1001 bool makeRigidMatrix(
1004 const int max_iter = 64,
1005 const T rel_tol = FLT_EPSILON);
1011 template <
typename S>
1014 T dot(
unsigned i,
unsigned j)
const
1016 return (i <= 3 && j <= 3) ?
1017 matx[i][0]*matx[j][0] + matx[i][1]*matx[j][1] +
1018 matx[i][2]*matx[j][2] + matx[i][3]*matx[j][3] : (
T)0;
1022 template <
typename S>
1023 void outerproductUpdate(
T b,
1036 for (
size_t i = 0; i < tuple_size; i++)
1050 matx[0][0]==1.0
f && matx[0][1]==0.0
f &&
1051 matx[0][2]==0.0
f && matx[0][3]==0.0
f &&
1052 matx[1][0]==0.0
f && matx[1][1]==1.0
f &&
1053 matx[1][2]==0.0
f && matx[1][3]==0.0
f &&
1054 matx[2][0]==0.0
f && matx[2][1]==0.0
f &&
1055 matx[2][2]==1.0
f && matx[2][3]==0.0
f &&
1056 matx[3][0]==0.0
f && matx[3][1]==0.0
f &&
1057 matx[3][2]==0.0
f && matx[3][3]==1.0
f);
1064 matx[0][0]==0.0
f && matx[0][1]==0.0
f &&
1065 matx[0][2]==0.0
f && matx[0][3]==0.0
f &&
1066 matx[1][0]==0.0
f && matx[1][1]==0.0
f &&
1067 matx[1][2]==0.0
f && matx[1][3]==0.0
f &&
1068 matx[2][0]==0.0
f && matx[2][1]==0.0
f &&
1069 matx[2][2]==0.0
f && matx[2][3]==0.0
f &&
1070 matx[3][0]==0.0
f && matx[3][1]==0.0
f &&
1071 matx[3][2]==0.0
f && matx[3][3]==0.0
f);
1077 const T *
data()
const {
return myFloats; }
1082 unsigned hash()
const {
return SYSvector_hash(
data(), tuple_size); }
1090 return matx[
row][col];
1096 return matx[
row][col];
1123 {
return SYSsqrt(getEuclideanNorm2()); }
1125 T getEuclideanNorm2()
const;
1128 T getInfinityNorm()
const;
1140 int save(std::ostream &os,
int binary)
const;
1142 void dump(
const char *msg=
"")
const;
1144 void outAsciiNoName(std::ostream &os)
const;
1157 friend std::ostream &operator<<(std::ostream &os, const UT_Matrix4T<T> &
v)
1159 v.writeClassName(os);
1160 v.outAsciiNoName(os);
1171 T myFloats[tuple_size];
1207 void perspective(
fpreal zoom,
1247 void orthographic(
fpreal zoom,
1257 template <
int ORDER>
1263 void coVals(
int k,
int r[3])
const
1267 case 0: r[0] = 1; r[1] = 2; r[2] = 3;
break;
1268 case 1: r[0] = 0; r[1] = 2; r[2] = 3;
break;
1269 case 2: r[0] = 0; r[1] = 1; r[2] = 3;
break;
1270 case 3: r[0] = 0; r[1] = 1; r[2] = 2;
break;
1276 void writeClassName(std::ostream &os)
const;
1277 static const char *className();
1282 template <
typename T>
1283 template <
typename S>
1287 matx[0][0] = matx[0][1] = matx[0][2] = matx[0][3] = vec.
x();
1288 matx[1][0] = matx[1][1] = matx[1][2] = matx[1][3] = vec.
y();
1289 matx[2][0] = matx[2][1] = matx[2][2] = matx[2][3] = vec.
z();
1290 matx[3][0] = matx[3][1] = matx[3][2] = matx[3][3] = vec.
w();
1294 template <
typename T>
1295 template <
typename S>
1299 T x = vec.
x();
T y = vec.
y();
1300 T z = vec.
z();
T w = vec.
w();
1301 matx[0][0]+=
x; matx[0][1]+=
x; matx[0][2]+=
x; matx[0][3]+=
x;
1302 matx[1][0]+=
y; matx[1][1]+=
y; matx[1][2]+=
y; matx[1][3]+=
y;
1303 matx[2][0]+=
z; matx[2][1]+=
z; matx[2][2]+=
z; matx[2][3]+=
z;
1304 matx[3][0]+=
w; matx[3][1]+=
w; matx[3][2]+=
w; matx[3][3]+=
w;
1308 template <
typename T>
1309 template <
typename S>
1313 T x = vec.
x();
T y = vec.
y();
1314 T z = vec.
z();
T w = vec.
w();
1315 matx[0][0]-=
x; matx[0][1]-=
x; matx[0][2]-=
x; matx[0][3]-=
x;
1316 matx[1][0]-=
y; matx[1][1]-=
y; matx[1][2]-=
y; matx[1][3]-=
y;
1317 matx[2][0]-=
z; matx[2][1]-=
z; matx[2][2]-=
z; matx[2][3]-=
z;
1318 matx[3][0]-=
w; matx[3][1]-=
w; matx[3][2]-=
w; matx[3][3]-=
w;
1322 template <
typename T>
1323 template <
typename S>
1327 translates.
x() = matx[3][0];
1328 translates.
y() = matx[3][1];
1329 translates.
z() = matx[3][2];
1332 template <
typename T>
1333 template <
typename S>
1337 matx[3][0] = translates.
x();
1338 matx[3][1] = translates.
y();
1339 matx[3][2] = translates.
z();
1342 template <
typename T>
1350 template <
typename T>
1358 template <
typename T>
1359 template <
typename S>
1364 a = matx[0][0]; b = matx[0][1]; c = matx[0][2]; d = matx[0][3];
1365 matx[0][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0) + d*
m(3,0);
1366 matx[0][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1) + d*
m(3,1);
1367 matx[0][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2) + d*
m(3,2);
1368 matx[0][3] = a*
m(0,3) + b*
m(1,3) + c*
m(2,3) + d*
m(3,3);
1370 a = matx[1][0]; b = matx[1][1]; c = matx[1][2]; d = matx[1][3];
1371 matx[1][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0) + d*
m(3,0);
1372 matx[1][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1) + d*
m(3,1);
1373 matx[1][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2) + d*
m(3,2);
1374 matx[1][3] = a*
m(0,3) + b*
m(1,3) + c*
m(2,3) + d*
m(3,3);
1376 a = matx[2][0]; b = matx[2][1]; c = matx[2][2]; d = matx[2][3];
1377 matx[2][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0) + d*
m(3,0);
1378 matx[2][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1) + d*
m(3,1);
1379 matx[2][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2) + d*
m(3,2);
1380 matx[2][3] = a*
m(0,3) + b*
m(1,3) + c*
m(2,3) + d*
m(3,3);
1382 a = matx[3][0]; b = matx[3][1]; c = matx[3][2]; d = matx[3][3];
1383 matx[3][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0) + d*
m(3,0);
1384 matx[3][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1) + d*
m(3,1);
1385 matx[3][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2) + d*
m(3,2);
1386 matx[3][3] = a*
m(0,3) + b*
m(1,3) + c*
m(2,3) + d*
m(3,3);
1390 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1404 for (
int i = 0; i < 4; i++)
1417 template <
typename T>
1418 template <
typename S>
1423 a = matx[0][0]; b = matx[0][1]; c = matx[0][2];
1424 matx[0][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0);
1425 matx[0][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1);
1426 matx[0][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2);
1428 a = matx[1][0]; b = matx[1][1]; c = matx[1][2];
1429 matx[1][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0);
1430 matx[1][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1);
1431 matx[1][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2);
1433 a = matx[2][0]; b = matx[2][1]; c = matx[2][2];
1434 matx[2][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0);
1435 matx[2][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1);
1436 matx[2][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2);
1438 a = matx[3][0]; b = matx[3][1]; c = matx[3][2];
1439 matx[3][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0);
1440 matx[3][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1);
1441 matx[3][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2);
1445 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1452 const v4uf m0(
m(0));
1453 const v4uf m1(
m(1));
1454 const v4uf m2(
m(2,0),
m(2,1),
m(2,2), 0);
1456 for (
int i = 0; i < 4; ++i)
1463 const float last =
matx[i][3];
1469 template <>
inline void
1473 for (
int i = 0; i < 4; ++i)
1484 template <
typename T>
1489 a = matx[0][0]; b = matx[1][0]; c = matx[2][0]; d = matx[3][0];
1490 matx[0][0] = a*
m(0,0) + b*
m(0,1) + c*
m(0,2) + d*
m(0,3);
1491 matx[1][0] = a*
m(1,0) + b*
m(1,1) + c*
m(1,2) + d*
m(1,3);
1492 matx[2][0] = a*
m(2,0) + b*
m(2,1) + c*
m(2,2) + d*
m(2,3);
1493 matx[3][0] = a*
m(3,0) + b*
m(3,1) + c*
m(3,2) + d*
m(3,3);
1495 a = matx[0][1]; b = matx[1][1]; c = matx[2][1]; d = matx[3][1];
1496 matx[0][1] = a*
m(0,0) + b*
m(0,1) + c*
m(0,2) + d*
m(0,3);
1497 matx[1][1] = a*
m(1,0) + b*
m(1,1) + c*
m(1,2) + d*
m(1,3);
1498 matx[2][1] = a*
m(2,0) + b*
m(2,1) + c*
m(2,2) + d*
m(2,3);
1499 matx[3][1] = a*
m(3,0) + b*
m(3,1) + c*
m(3,2) + d*
m(3,3);
1501 a = matx[0][2]; b = matx[1][2]; c = matx[2][2]; d = matx[3][2];
1502 matx[0][2] = a*
m(0,0) + b*
m(0,1) + c*
m(0,2) + d*
m(0,3);
1503 matx[1][2] = a*
m(1,0) + b*
m(1,1) + c*
m(1,2) + d*
m(1,3);
1504 matx[2][2] = a*
m(2,0) + b*
m(2,1) + c*
m(2,2) + d*
m(2,3);
1505 matx[3][2] = a*
m(3,0) + b*
m(3,1) + c*
m(3,2) + d*
m(3,3);
1507 a = matx[0][3]; b = matx[1][3]; c = matx[2][3]; d = matx[3][3];
1508 matx[0][3] = a*
m(0,0) + b*
m(0,1) + c*
m(0,2) + d*
m(0,3);
1509 matx[1][3] = a*
m(1,0) + b*
m(1,1) + c*
m(1,2) + d*
m(1,3);
1510 matx[2][3] = a*
m(2,0) + b*
m(2,1) + c*
m(2,2) + d*
m(2,3);
1511 matx[3][3] = a*
m(3,0) + b*
m(3,1) + c*
m(3,2) + d*
m(3,3);
1514 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1524 for (
int i = 0; i < 4; ++i)
1537 template <
typename T>
1542 m[0][0] = m1(0,0)+m2(0,0); m[0][1] = m1(0,1)+m2(0,1);
1543 m[0][2] = m1(0,2)+m2(0,2); m[0][3] = m1(0,3)+m2(0,3);
1545 m[1][0] = m1(1,0)+m2(1,0); m[1][1] = m1(1,1)+m2(1,1);
1546 m[1][2] = m1(1,2)+m2(1,2); m[1][3] = m1(1,3)+m2(1,3);
1548 m[2][0] = m1(2,0)+m2(2,0); m[2][1] = m1(2,1)+m2(2,1);
1549 m[2][2] = m1(2,2)+m2(2,2); m[2][3] = m1(2,3)+m2(2,3);
1551 m[3][0] = m1(3,0)+m2(3,0); m[3][1] = m1(3,1)+m2(3,1);
1552 m[3][2] = m1(3,2)+m2(3,2); m[3][3] = m1(3,3)+m2(3,3);
1555 template <
typename T>
1560 m[0][0] = m1(0,0)-m2(0,0); m[0][1] = m1(0,1)-m2(0,1);
1561 m[0][2] = m1(0,2)-m2(0,2); m[0][3] = m1(0,3)-m2(0,3);
1563 m[1][0] = m1(1,0)-m2(1,0); m[1][1] = m1(1,1)-m2(1,1);
1564 m[1][2] = m1(1,2)-m2(1,2); m[1][3] = m1(1,3)-m2(1,3);
1566 m[2][0] = m1(2,0)-m2(2,0); m[2][1] = m1(2,1)-m2(2,1);
1567 m[2][2] = m1(2,2)-m2(2,2); m[2][3] = m1(2,3)-m2(2,3);
1569 m[3][0] = m1(3,0)-m2(3,0); m[3][1] = m1(3,1)-m2(3,1);
1570 m[3][2] = m1(3,2)-m2(3,2); m[3][3] = m1(3,3)-m2(3,3);
1573 template <
typename T>
1578 m[0][0] = m1(0,0)*m2(0,0) + m1(0,1)*m2(1,0) +
1579 m1(0,2)*m2(2,0) + m1(0,3)*m2(3,0) ;
1580 m[0][1] = m1(0,0)*m2(0,1) + m1(0,1)*m2(1,1) +
1581 m1(0,2)*m2(2,1) + m1(0,3)*m2(3,1) ;
1582 m[0][2] = m1(0,0)*m2(0,2) + m1(0,1)*m2(1,2) +
1583 m1(0,2)*m2(2,2) + m1(0,3)*m2(3,2) ;
1584 m[0][3] = m1(0,0)*m2(0,3) + m1(0,1)*m2(1,3) +
1585 m1(0,2)*m2(2,3) + m1(0,3)*m2(3,3) ;
1587 m[1][0] = m1(1,0)*m2(0,0) + m1(1,1)*m2(1,0) +
1588 m1(1,2)*m2(2,0) + m1(1,3)*m2(3,0) ;
1589 m[1][1] = m1(1,0)*m2(0,1) + m1(1,1)*m2(1,1) +
1590 m1(1,2)*m2(2,1) + m1(1,3)*m2(3,1) ;
1591 m[1][2] = m1(1,0)*m2(0,2) + m1(1,1)*m2(1,2) +
1592 m1(1,2)*m2(2,2) + m1(1,3)*m2(3,2) ;
1593 m[1][3] = m1(1,0)*m2(0,3) + m1(1,1)*m2(1,3) +
1594 m1(1,2)*m2(2,3) + m1(1,3)*m2(3,3) ;
1596 m[2][0] = m1(2,0)*m2(0,0) + m1(2,1)*m2(1,0) +
1597 m1(2,2)*m2(2,0) + m1(2,3)*m2(3,0) ;
1598 m[2][1] = m1(2,0)*m2(0,1) + m1(2,1)*m2(1,1) +
1599 m1(2,2)*m2(2,1) + m1(2,3)*m2(3,1) ;
1600 m[2][2] = m1(2,0)*m2(0,2) + m1(2,1)*m2(1,2) +
1601 m1(2,2)*m2(2,2) + m1(2,3)*m2(3,2) ;
1602 m[2][3] = m1(2,0)*m2(0,3) + m1(2,1)*m2(1,3) +
1603 m1(2,2)*m2(2,3) + m1(2,3)*m2(3,3) ;
1605 m[3][0] = m1(3,0)*m2(0,0) + m1(3,1)*m2(1,0) +
1606 m1(3,2)*m2(2,0) + m1(3,3)*m2(3,0) ;
1607 m[3][1] = m1(3,0)*m2(0,1) + m1(3,1)*m2(1,1) +
1608 m1(3,2)*m2(2,1) + m1(3,3)*m2(3,1) ;
1609 m[3][2] = m1(3,0)*m2(0,2) + m1(3,1)*m2(1,2) +
1610 m1(3,2)*m2(2,2) + m1(3,3)*m2(3,2) ;
1611 m[3][3] = m1(3,0)*m2(0,3) + m1(3,1)*m2(1,3) +
1612 m1(3,2)*m2(2,3) + m1(3,3)*m2(3,3) ;
1615 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1627 for (
int i = 0; i < 4; ++i)
1640 template <
typename T,
typename S>
1646 m[0][0] = m1(0,0) +
x; m[0][1] = m1(0,1) +
x;
1647 m[0][2] = m1(0,2) +
x; m[0][3] = m1(0,3) +
x;
1649 m[1][0] = m1(1,0) +
y; m[1][1] = m1(1,1) +
y;
1650 m[1][2] = m1(1,2) +
y; m[1][3] = m1(1,3) +
y;
1652 m[2][0] = m1(2,0) +
z; m[2][1] = m1(2,1) +
z;
1653 m[2][2] = m1(2,2) +
z; m[2][3] = m1(2,3) +
z;
1655 m[3][0] = m1(3,0) +
w; m[3][1] = m1(3,1) +
w;
1656 m[3][2] = m1(3,2) +
w; m[3][3] = m1(3,3) +
w;
1660 template <
typename T,
typename S>
1667 template <
typename T,
typename S>
1673 m[0][0] = m1(0,0) -
x; m[0][1] = m1(0,1) -
x;
1674 m[0][2] = m1(0,2) -
x; m[0][3] = m1(0,3) -
x;
1676 m[1][0] = m1(1,0) -
y; m[1][1] = m1(1,1) -
y;
1677 m[1][2] = m1(1,2) -
y; m[1][3] = m1(1,3) -
y;
1679 m[2][0] = m1(2,0) -
z; m[2][1] = m1(2,1) -
z;
1680 m[2][2] = m1(2,2) -
z; m[2][3] = m1(2,3) -
z;
1682 m[3][0] = m1(3,0) -
w; m[3][1] = m1(3,1) -
w;
1683 m[3][2] = m1(3,2) -
w; m[3][3] = m1(3,3) -
w;
1687 template <
typename T,
typename S>
1693 m[0][0] = x - m1(0,0); m[0][1] = x - m1(0,1);
1694 m[0][2] = x - m1(0,2); m[0][3] = x - m1(0,3);
1696 m[1][0] = y - m1(1,0); m[1][1] = y - m1(1,1);
1697 m[1][2] = y - m1(1,2); m[1][3] = y - m1(1,3);
1699 m[2][0] = z - m1(2,0); m[2][1] = z - m1(2,1);
1700 m[2][2] = z - m1(2,2); m[2][3] = z - m1(2,3);
1702 m[3][0] = w - m1(3,0); m[3][1] = w - m1(3,1);
1703 m[3][2] = w - m1(3,2); m[3][3] = w - m1(3,3);
1707 template <
typename T,
typename S>
1712 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;
1713 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;
1714 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;
1715 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;
1719 template <
typename T,
typename S>
1724 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);
1725 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);
1726 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);
1727 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);
1731 template <
typename T,
typename S>
1738 template <
typename T,
typename S>
1743 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;
1744 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;
1745 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;
1746 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;
1750 template <
typename T,
typename S>
1755 return (m1 * (1.0
f/scalar));
1758 template <
typename T,
typename S>
1763 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);
1764 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);
1765 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);
1766 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);
1789 template <
typename T,
typename S>
1791 template <
typename T,
typename S>
1794 template <
typename T,
typename S>
1796 template <
typename T,
typename S>
1800 template <
typename T,
typename S>
1805 v.
x()*
m(0,0) + v.
y()*
m(1,0) + v.
z()*
m(2,0) +
m(3,0),
1806 v.
x()*
m(0,1) + v.
y()*
m(1,1) + v.
z()*
m(2,1) +
m(3,1),
1807 v.
x()*
m(0,2) + v.
y()*
m(1,2) + v.
z()*
m(2,2) +
m(3,2)
1810 template <
typename T,
typename S>
1817 template <
typename T,
typename S>
1822 v.
x()*
m(0,0) + v.
y()*
m(1,0) + v.
z()*
m(2,0),
1823 v.
x()*
m(0,1) + v.
y()*
m(1,1) + v.
z()*
m(2,1),
1824 v.
x()*
m(0,2) + v.
y()*
m(1,2) + v.
z()*
m(2,2)
1828 template <
typename T,
typename S>
1833 v.
x()*
m(0,0) + v.
y()*
m(0,1) + v.
z()*
m(0,2) +
m(0,3),
1834 v.
x()*
m(1,0) + v.
y()*
m(1,1) + v.
z()*
m(1,2) +
m(1,3),
1835 v.
x()*
m(2,0) + v.
y()*
m(2,1) + v.
z()*
m(2,2) +
m(2,3)
1839 template <
typename T,
typename S>
1844 v.
x()*
m(0,0) + v.
y()*
m(0,1) + v.
z()*
m(0,2),
1845 v.
x()*
m(1,0) + v.
y()*
m(1,1) + v.
z()*
m(1,2),
1846 v.
x()*
m(2,0) + v.
y()*
m(2,1) + v.
z()*
m(2,2)
1849 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1883 +
v4uf(
m(0,3),
m(1,3),
m(2,3),
m(3,3));
1903 template <
typename T>
1909 template <
typename T>
1915 template <
typename T>
1921 template <
typename T>
1927 template <
typename T>
1933 template <
typename T>
1939 template <
typename T>
1945 template <
typename T>
1951 template <
typename T>
1952 template <
typename S>
1959 template <
typename T>
1960 template <
typename S>
1966 template <
typename T>
1967 template <
typename S>
1973 template <
typename T>
1974 template <
typename S>
1980 template <
typename T>
1981 template <
typename S>
1987 template <
typename T>
1988 template <
typename S>
1995 template <
typename T>
2019 template <
typename T>
2043 template <
typename T,
typename S>
2066 #ifndef UT_DISABLE_VECTORIZE_MATRIX
2072 for (
int i = 0; i < 4; ++i)
2083 template<
typename T>
2093 template<
typename T>
2097 template <
typename T>
template<
int ORDER>
2104 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2105 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2106 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2111 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2112 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2113 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2118 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2119 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2120 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2125 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2126 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2127 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2132 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2133 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2134 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2139 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2140 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2141 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)
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)
UT_Matrix4T< T > & operator=(UT_Matrix4T< T > &&m)=default
Default move assignment operator.
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
GLuint const GLfloat * val
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.
GLenum GLenum GLenum GLenum GLenum scale
SYS_FORCE_INLINE T & operator()(unsigned row, unsigned col)
Return a matrix entry. No bounds checking on subscripts.
GLboolean GLboolean GLboolean GLboolean a
SYS_FORCE_INLINE void rotateQuarter()
vfloat4 sqrt(const vfloat4 &a)
UT_Matrix4T< T > & operator=(const UT_Matrix4T< S > &m)
SYS_FORCE_INLINE void prerotate(const UT_Vector3T< T > &rad, const UT_XformOrder &ord)
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.
static const exint TupleSize
void prescale(T sx, T sy, T sz, T sw=1.0f)
SYS_FORCE_INLINE void shear(const UT_Vector3T< T > &sh)
UT_Vector3T< S > myTranslate
GLuint GLdouble GLdouble GLint GLint order
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
GLdouble GLdouble GLdouble GLdouble q
GLfloat GLfloat GLfloat v2
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)
GLint GLint GLint GLint GLint x
UT_Matrix4T< T > & operator=(const UT_Matrix3T< S > &m)
SYS_FORCE_INLINE UT_Matrix4T< T > & operator/=(T scalar)
GLint GLint GLint GLint GLint GLint y
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)
bool operator==(const UT_Matrix4T< T > &m) const
GLint GLenum GLsizei GLint GLsizei const void * data
const GLuint GLenum const void * binary
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
static const bool isVectorType
int explode(const UT_XformOrder &order, UT_Vector3F &r, UT_Vector3F &s, UT_Vector3F &t, UT_Vector3F *shears=0) const
GLubyte GLubyte GLubyte GLubyte w
UT_Vector3T< T > rowVecMult(const UT_Vector3T< T > &v, const UT_Matrix4T< S > &m)
void scale(T sx, T sy, T sz, T sw=1.0f)
T determinant3() const
Compute determinant of the upper-left 3x3 sub-matrix.
SYS_FORCE_INLINE void pretranslate(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)
SYS_FORCE_INLINE UT_Matrix4T< T > & operator-=(const UT_Matrix4T< T > &m)
void pretranslate(T dx, T dy, T dz=0.0f)
SYS_FORCE_INLINE void rowVecMult(const UT_Matrix3F &m)
UT_Vector3T< T > colVecMult(const UT_Matrix4T< S > &m, const UT_Vector3T< T > &v)
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)
const Vec2< S > & operator*=(Vec2< S > &v, const Matrix33< T > &m)
UT_Vector3T< T > colVecMult3(const UT_Matrix4T< S > &m, const UT_Vector3T< T > &v)
GLuint GLuint GLsizei GLenum type
SYS_FORCE_INLINE void translate(const UT_Vector3T< T > &delta)
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)
SYS_FORCE_INLINE UT_Vector3T< T > & operator*=(const UT_Matrix3T< S > &m)
GA_API const UT_StringHolder orient
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
GLdouble GLdouble GLdouble b
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)
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
constexpr UT_Matrix4T(fpreal64 val) noexcept
Construct identity matrix, multipled by scalar.
void zero()
Set the matrix to zero.
GLdouble GLdouble GLdouble r
UT_Matrix4T< T > & operator=(const UT_SymMatrix4T< S > &m)
Conversion from a symmetric to a non symmetric matrix.
GA_API const UT_StringHolder pivot
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)
void leftMult(const UT_Matrix4T< T > &m)
UT_Matrix4T< T > operator/(const UT_Matrix4T< T > &mat, S sc)
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.
SYS_FORCE_INLINE void multiply(UT_Vector3T< T > &dest, const UT_Matrix4T< S > &mat) const
void translate(T dx, T dy, T dz=0.0f)
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
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.