10 #ifndef __UT_Matrix4_h__
11 #define __UT_Matrix4_h__
27 #ifndef UT_DISABLE_VECTORIZE_MATRIX
45 template <
typename T,
typename S>
47 template <
typename T,
typename S>
49 template <
typename T,
typename S>
51 template <
typename T,
typename S>
53 template <
typename T,
typename S>
55 template <
typename T,
typename S>
57 template <
typename T,
typename S>
59 template <
typename T,
typename S>
61 template <
typename T,
typename S>
63 template <
typename T,
typename S>
65 template <
typename T,
typename S>
67 template <
typename T,
typename S>
74 template <
typename T,
typename S>
78 template <
typename T,
typename S>
85 template <
typename T,
typename S>
88 {
return v0 * (1 - u -
v) + v1 * u + v2 *v; }
102 static constexpr
const int tuple_size = 16;
125 template <
typename S>
128 {
T(
m[0][0]),
T(
m[0][1]),
T(
m[0][2]),
T(
m[0][3])},
129 {
T(
m[1][0]),
T(
m[1][1]),
T(
m[1][2]),
T(
m[1][3])},
130 {
T(
m[2][0]),
T(
m[2][1]),
T(
m[2][2]),
T(
m[2][3])},
131 {
T(
m[3][0]),
T(
m[3][1]),
T(
m[3][2]),
T(
m[3][3])}}
136 template <
typename S>
139 matx[0][0]=v[0]; matx[0][1]=v[1]; matx[0][2]=v[2]; matx[0][3]=v[3];
140 matx[1][0]=v[4]; matx[1][1]=v[5]; matx[1][2]=v[6]; matx[1][3]=v[7];
141 matx[2][0]=v[8]; matx[2][1]=v[9]; matx[2][2]=v[10];matx[2][3]=v[11];
142 matx[3][0]=v[12];matx[3][1]=v[13];matx[3][2]=v[14];matx[3][3]=v[15];
147 T val10,
T val11,
T val12,
T val13,
148 T val20,
T val21,
T val22,
T val23,
149 T val30,
T val31,
T val32,
T val33)
151 matx[0][0] = val00; matx[0][1] = val01; matx[0][2] = val02;
153 matx[1][0] = val10; matx[1][1] = val11; matx[1][2] = val12;
155 matx[2][0] = val20; matx[2][1] = val21; matx[2][2] = val22;
157 matx[3][0] = val30; matx[3][1] = val31; matx[3][2] = val32;
162 template <
typename S>
165 matx[0][0]=
m(0,0); matx[0][1]=
m(0,1); matx[0][2]=
m(0,2); matx[0][3]=
m(0,3);
166 matx[1][0]=
m(1,0); matx[1][1]=
m(1,1); matx[1][2]=
m(1,2); matx[1][3]=
m(1,3);
167 matx[2][0]=
m(2,0); matx[2][1]=
m(2,1); matx[2][2]=
m(2,2); matx[2][3]=
m(2,3);
168 matx[3][0]=
m(3,0); matx[3][1]=
m(3,1); matx[3][2]=
m(3,2); matx[3][3]=
m(3,3);
170 template <
typename S>
173 matx[0][0]=
m(0,0); matx[0][1]=
m(0,1); matx[0][2]=
m(0,2); matx[0][3]=(
T)0.;
174 matx[1][0]=
m(1,0); matx[1][1]=
m(1,1); matx[1][2]=
m(1,2); matx[1][3]=(
T)0.;
175 matx[2][0]=
m(2,0); matx[2][1]=
m(2,1); matx[2][2]=
m(2,2); matx[2][3]=(
T)0.;
176 matx[3][0]=(
T)0.; matx[3][1]=(
T)0.; matx[3][2]=(
T)0.; matx[3][3]=(
T)1.;
179 template <
typename S,
typename U>
182 matx[0][0]=
m(0,0); matx[0][1]=
m(0,1); matx[0][2]=
m(0,2); matx[0][3]=(
T)0.;
183 matx[1][0]=
m(1,0); matx[1][1]=
m(1,1); matx[1][2]=
m(1,2); matx[1][3]=(
T)0.;
184 matx[2][0]=
m(2,0); matx[2][1]=
m(2,1); matx[2][2]=
m(2,2); matx[2][3]=(
T)0.;
185 matx[3][0]=(
T)t[0]; matx[3][1]=(
T)t[1]; matx[3][2]=(
T)t[2]; matx[3][3]=(
T)1.;
203 template <
typename S>
206 matx[0][0]=
m(0,0); matx[0][1]=
m(0,1);
207 matx[0][2]=
m(0,2); matx[0][3]=(
T)0.;
208 matx[1][0]=
m(1,0); matx[1][1]=
m(1,1);
209 matx[1][2]=
m(1,2); matx[1][3]=(
T)0.;
210 matx[2][0]=
m(2,0); matx[2][1]=
m(2,1);
211 matx[2][2]=
m(2,2); matx[2][3]=(
T)0.;
212 matx[3][0]=(
T)0.; matx[3][1]=(
T)0.;
213 matx[3][2]=(
T)0.; matx[3][3]=(
T)1.;
217 template <
typename S>
220 matx[0][0]=
m(0,0); matx[0][1]=
m(0,1);
221 matx[0][2]=
m(0,2); matx[0][3]=
m(0,3);
222 matx[1][0]=
m(1,0); matx[1][1]=
m(1,1);
223 matx[1][2]=
m(1,2); matx[1][3]=
m(1,3);
224 matx[2][0]=
m(2,0); matx[2][1]=
m(2,1);
225 matx[2][2]=
m(2,2); matx[2][3]=
m(2,3);
226 matx[3][0]=
m(3,0); matx[3][1]=
m(3,1);
227 matx[3][2]=
m(3,2); matx[3][3]=
m(3,3);
232 template <
typename S>
235 matx[0][0] = m.q00; matx[0][1] = m.q01; matx[0][2] = m.q02;
236 matx[0][3] = m.q03; matx[1][0] = m.q01; matx[1][1] = m.q11;
237 matx[1][2] = m.q12; matx[1][3] = m.q13; matx[2][0] = m.q02;
238 matx[2][1] = m.q12; matx[2][2] = m.q22; matx[2][3] = m.q23;
239 matx[3][0] = m.q03; matx[3][1] = m.q13; matx[3][2] = m.q23;
247 -matx[0][0], -matx[0][1], -matx[0][2], -matx[0][3],
248 -matx[1][0], -matx[1][1], -matx[1][2], -matx[1][3],
249 -matx[2][0], -matx[2][1], -matx[2][2], -matx[2][3],
250 -matx[3][0], -matx[3][1], -matx[3][2], -matx[3][3]);
256 matx[0][0]+=m.
matx[0][0]; matx[0][1]+=m.
matx[0][1];
257 matx[0][2]+=m.
matx[0][2]; matx[0][3]+=m.
matx[0][3];
259 matx[1][0]+=m.
matx[1][0]; matx[1][1]+=m.
matx[1][1];
260 matx[1][2]+=m.
matx[1][2]; matx[1][3]+=m.
matx[1][3];
262 matx[2][0]+=m.
matx[2][0]; matx[2][1]+=m.
matx[2][1];
263 matx[2][2]+=m.
matx[2][2]; matx[2][3]+=m.
matx[2][3];
265 matx[3][0]+=m.
matx[3][0]; matx[3][1]+=m.
matx[3][1];
266 matx[3][2]+=m.
matx[3][2]; matx[3][3]+=m.
matx[3][3];
272 matx[0][0]-=m.
matx[0][0]; matx[0][1]-=m.
matx[0][1];
273 matx[0][2]-=m.
matx[0][2]; matx[0][3]-=m.
matx[0][3];
275 matx[1][0]-=m.
matx[1][0]; matx[1][1]-=m.
matx[1][1];
276 matx[1][2]-=m.
matx[1][2]; matx[1][3]-=m.
matx[1][3];
278 matx[2][0]-=m.
matx[2][0]; matx[2][1]-=m.
matx[2][1];
279 matx[2][2]-=m.
matx[2][2]; matx[2][3]-=m.
matx[2][3];
281 matx[3][0]-=m.
matx[3][0]; matx[3][1]-=m.
matx[3][1];
282 matx[3][2]-=m.
matx[3][2]; matx[3][3]-=m.
matx[3][3];
294 return (&m ==
this) || (
295 matx[0][0]==m.
matx[0][0] && matx[0][1]==m.
matx[0][1] &&
296 matx[0][2]==m.
matx[0][2] && matx[0][3]==m.
matx[0][3] &&
298 matx[1][0]==m.
matx[1][0] && matx[1][1]==m.
matx[1][1] &&
299 matx[1][2]==m.
matx[1][2] && matx[1][3]==m.
matx[1][3] &&
301 matx[2][0]==m.
matx[2][0] && matx[2][1]==m.
matx[2][1] &&
302 matx[2][2]==m.
matx[2][2] && matx[2][3]==m.
matx[2][3] &&
304 matx[3][0]==m.
matx[3][0] && matx[3][1]==m.
matx[3][1] &&
305 matx[3][2]==m.
matx[3][2] && matx[3][3]==m.
matx[3][3] );
310 return !(*
this ==
m);
316 matx[0][0]=
v; matx[0][1]= 0; matx[0][2]= 0; matx[0][3]= 0;
317 matx[1][0]= 0; matx[1][1]=
v; matx[1][2]= 0; matx[1][3]= 0;
318 matx[2][0]= 0; matx[2][1]= 0; matx[2][2]=
v; matx[2][3]= 0;
319 matx[3][0]= 0; matx[3][1]= 0; matx[3][2]= 0; matx[3][3]=
v;
329 matx[0][0]*=scalar; matx[0][1]*=scalar;
330 matx[0][2]*=scalar; matx[0][3]*=scalar;
332 matx[1][0]*=scalar; matx[1][1]*=scalar;
333 matx[1][2]*=scalar; matx[1][3]*=scalar;
335 matx[2][0]*=scalar; matx[2][1]*=scalar;
336 matx[2][2]*=scalar; matx[2][3]*=scalar;
338 matx[3][0]*=scalar; matx[3][1]*=scalar;
339 matx[3][2]*=scalar; matx[3][3]*=scalar;
349 template <
typename S>
351 template <
typename S>
353 template <
typename S>
378 det = matx[r[0]][c[0]]*
379 (matx[r[1]][c[1]]*matx[r[2]][c[2]]-
380 matx[r[1]][c[2]]*matx[r[2]][c[1]]) +
382 (matx[r[1]][c[2]]*matx[r[2]][c[0]]-
383 matx[r[1]][c[0]]*matx[r[2]][c[2]]) +
385 (matx[r[1]][c[0]]*matx[r[2]][c[1]]-
386 matx[r[1]][c[1]]*matx[r[2]][c[0]]);
396 return(matx[0][0]*coFactor(0,0) +
397 matx[0][1]*coFactor(0,1) +
398 matx[0][2]*coFactor(0,2) +
399 matx[0][3]*coFactor(0,3) );
405 (matx[1][1]*matx[2][2]-matx[1][2]*matx[2][1]) +
407 (matx[1][2]*matx[2][0]-matx[1][0]*matx[2][2]) +
409 (matx[1][0]*matx[2][1]-matx[1][1]*matx[2][0]) );
413 {
return matx[0][0]+matx[1][1]+matx[2][2]+matx[3][3]; }
433 template <
typename S>
440 template <
typename S>
459 template <
typename S>
470 { instanceT(p, v, s, s3, up, q, tr, orient,
pivot); }
476 { instanceT(p, v, s, s3, up, q, tr, orient,
pivot); }
478 template <
typename S>
489 { instanceInverseT(p, v, s, s3, up, q, tr, orient,
pivot); }
495 { instanceInverseT(p, v, s, s3, up, q, tr, orient,
pivot); }
501 tmp=matx[0][1]; matx[0][1]=matx[1][0]; matx[1][0]=tmp;
502 tmp=matx[0][2]; matx[0][2]=matx[2][0]; matx[2][0]=tmp;
503 tmp=matx[0][3]; matx[0][3]=matx[3][0]; matx[3][0]=tmp;
504 tmp=matx[1][2]; matx[1][2]=matx[2][1]; matx[2][1]=tmp;
505 tmp=matx[1][3]; matx[1][3]=matx[3][1]; matx[3][1]=tmp;
506 tmp=matx[2][3]; matx[2][3]=matx[3][2]; matx[3][2]=tmp;
513 return (&m ==
this) || (
514 SYSisEqual( matx[0][0], m.
matx[0][0], tolerance ) &&
515 SYSisEqual( matx[0][1], m.
matx[0][1], tolerance ) &&
516 SYSisEqual( matx[0][2], m.
matx[0][2], tolerance ) &&
517 SYSisEqual( matx[0][3], m.
matx[0][3], tolerance ) &&
519 SYSisEqual( matx[1][0], m.
matx[1][0], tolerance ) &&
520 SYSisEqual( matx[1][1], m.
matx[1][1], tolerance ) &&
521 SYSisEqual( matx[1][2], m.
matx[1][2], tolerance ) &&
522 SYSisEqual( matx[1][3], m.
matx[1][3], tolerance ) &&
524 SYSisEqual( matx[2][0], m.
matx[2][0], tolerance ) &&
525 SYSisEqual( matx[2][1], m.
matx[2][1], tolerance ) &&
526 SYSisEqual( matx[2][2], m.
matx[2][2], tolerance ) &&
527 SYSisEqual( matx[2][3], m.
matx[2][3], tolerance ) &&
529 SYSisEqual( matx[3][0], m.
matx[3][0], tolerance ) &&
530 SYSisEqual( matx[3][1], m.
matx[3][1], tolerance ) &&
531 SYSisEqual( matx[3][2], m.
matx[3][2], tolerance ) &&
532 SYSisEqual( matx[3][3], m.
matx[3][3], tolerance ) );
541 template <
typename S>
544 template<UT_Axis3::axis A>
550 template<UT_Axis3::axis A,
bool reverse=false>
560 matx[
row][col0] = -matx[
row][col1];
561 matx[
row][col1] =
v1;
565 matx[
row][col0] = matx[
row][col1];
566 matx[
row][col1] = -
v1;
573 template<UT_Axis3::axis A>
581 matx[
row][col0] = -matx[
row][col0];
582 matx[
row][col1] = -matx[
row][col1];
588 template<UT_Axis3::axis A>
604 template <
typename S>
615 template <
typename S>
618 template<UT_Axis3::axis A>
619 void prerotate(
T theta);
624 template<UT_Axis3::axis A,
bool reverse=false>
630 for (
uint col = 0; col < 4; ++col)
631 v1[col] = matx[row0][col];
634 for (
uint col = 0; col < 4; ++col)
635 matx[row0][col] = matx[row1][col];
636 for (
uint col = 0; col < 4; ++col)
637 matx[row1][col] = -v1[col];
641 for (
uint col = 0; col < 4; ++col)
642 matx[row0][col] = -matx[row1][col];
643 for (
uint col = 0; col < 4; ++col)
644 matx[row1][col] = v1[col];
650 template<UT_Axis3::axis A>
656 for (
uint col = 0; col < 4; ++col)
657 matx[row0][col] = -matx[row0][col];
658 for (
uint col = 0; col < 4; ++col)
659 matx[row1][col] = -matx[row1][col];
668 {
rotate(rad(0), rad(1), rad(2), ord); }
674 void prerotate(
T rx,
T ry,
T rz,
678 { prerotate(rad(0), rad(1), rad(2), ord); }
685 matx[0][0] *= sx; matx[0][1] *= sy;
686 matx[0][2] *= sz; matx[0][3] *= sw;
688 matx[1][0] *= sx; matx[1][1] *= sy;
689 matx[1][2] *= sz; matx[1][3] *= sw;
691 matx[2][0] *= sx; matx[2][1] *= sy;
692 matx[2][2] *= sz; matx[2][3] *= sw;
694 matx[3][0] *= sx; matx[3][1] *= sy;
695 matx[3][2] *= sz; matx[3][3] *= sw;
707 matx[0][0] *= sx; matx[1][0] *= sy;
708 matx[2][0] *= sz; matx[3][0] *= sw;
710 matx[0][1] *= sx; matx[1][1] *= sy;
711 matx[2][1] *= sz; matx[3][1] *= sw;
713 matx[0][2] *= sx; matx[1][2] *= sy;
714 matx[2][2] *= sz; matx[3][2] *= sw;
716 matx[0][3] *= sx; matx[1][3] *= sy;
717 matx[2][3] *= sz; matx[3][3] *= sw;
720 { prescale(
s(0),
s(1),
s(2)); }
722 { prescale(s, s, s); }
729 matx[0][0] += matx[0][1]*s_xy + matx[0][2]*s_xz;
730 matx[0][1] += matx[0][2]*s_yz;
732 matx[1][0] += matx[1][1]*s_xy + matx[1][2]*s_xz;
733 matx[1][1] += matx[1][2]*s_yz;
735 matx[2][0] += matx[2][1]*s_xy + matx[2][2]*s_xz;
736 matx[2][1] += matx[2][2]*s_yz;
738 matx[3][0] += matx[3][1]*s_xy + matx[3][2]*s_xz;
739 matx[3][1] += matx[3][2]*s_yz;
743 {
shear(sh(0), sh(1), sh(2)); }
752 matx[0][0] += a*dx; matx[0][1] += a*dy; matx[0][2] += a*dz;
754 matx[1][0] += a*dx; matx[1][1] += a*dy; matx[1][2] += a*dz;
756 matx[2][0] += a*dx; matx[2][1] += a*dy; matx[2][2] += a*dz;
758 matx[3][0] += a*dx; matx[3][1] += a*dy; matx[3][2] += a*dz;
762 {
translate(delta(0), delta(1), delta(2)); }
769 matx[3][0] += matx[0][0]*dx + matx[1][0]*dy + matx[2][0]*dz;
770 matx[3][1] += matx[0][1]*dx + matx[1][1]*dy + matx[2][1]*dz;
771 matx[3][2] += matx[0][2]*dx + matx[1][2]*dy + matx[2][2]*dz;
772 matx[3][3] += matx[0][3]*dx + matx[1][3]*dy + matx[2][3]*dz;
776 { pretranslate(delta(0), delta(1), delta(2)); }
785 template <
typename S>
799 T tx=0,
T ty=0,
T tz=0,
800 T rx=0,
T ry=0,
T rz=0,
801 T sx=1,
T sy=1,
T sz=1,
802 T px=0,
T py=0,
T pz=0,
810 T s_xy,
T s_xz,
T s_yz,
815 template <
typename S>
820 : myTranslate(0, 0, 0)
828 : myTranslate(translate)
852 T s_xy,
T s_xz,
T s_yz,
862 , myTranslate(0, 0, 0)
863 , myRotateOffset(0, 0, 0)
864 , myParentRotate(0, 0, 0)
866 , myChildRotate(0, 0, 0)
867 , myRotatePivot(0, 0, 0)
868 , myScaleOffset(0, 0, 0)
871 , myScalePivot(0, 0, 0)
873 , myPivotRotate(0, 0, 0)
905 enum applyType { BEFORE=1, EQUAL=2, AFTER=4, BEFORE_EQUAL=4, AFTER_EQUAL=6};
918 template <
typename S>
920 template <
typename S>
929 template <
typename S>
936 {
return explodeT(order, r, s, t, shears); }
940 {
return explodeT(order, r, s, t, shears); }
943 template <
typename S>
952 {
return explodeT(order, r, s, t, p, shears); }
957 {
return explodeT(order, r, s, t, p, shears); }
960 template <
typename S>
969 {
return explodeT(order, r, s, t, p, shears); }
974 {
return explodeT(order, r, s, t, p, shears); }
979 template <
typename S>
982 S *shears = 0)
const;
984 template <
typename S>
988 S *shears = 0)
const;
992 template <
typename S>
1002 template <
typename S>
1007 const int max_iter = 64,
1008 const T rel_tol = FLT_EPSILON)
const;
1013 template <
typename S>
1032 bool polarDecompose(
1035 const int max_iter = 64,
1036 const T rel_tol = FLT_EPSILON);
1049 bool makeRigidMatrix(
1052 const int max_iter = 64,
1053 const T rel_tol = FLT_EPSILON);
1059 template <
typename S>
1062 T dot(
unsigned i,
unsigned j)
const
1064 return (i <= 3 && j <= 3) ?
1065 matx[i][0]*matx[j][0] + matx[i][1]*matx[j][1] +
1066 matx[i][2]*matx[j][2] + matx[i][3]*matx[j][3] : (
T)0;
1070 template <
typename S>
1071 void outerproductUpdate(
T b,
1084 for (
size_t i = 0; i < tuple_size; i++)
1098 matx[0][0]==1 && matx[0][1]==0 &&
1099 matx[0][2]==0 && matx[0][3]==0 &&
1100 matx[1][0]==0 && matx[1][1]==1 &&
1101 matx[1][2]==0 && matx[1][3]==0 &&
1102 matx[2][0]==0 && matx[2][1]==0 &&
1103 matx[2][2]==1 && matx[2][3]==0 &&
1104 matx[3][0]==0 && matx[3][1]==0 &&
1105 matx[3][2]==0 && matx[3][3]==1);
1112 matx[0][0]==0 && matx[0][1]==0 &&
1113 matx[0][2]==0 && matx[0][3]==0 &&
1114 matx[1][0]==0 && matx[1][1]==0 &&
1115 matx[1][2]==0 && matx[1][3]==0 &&
1116 matx[2][0]==0 && matx[2][1]==0 &&
1117 matx[2][2]==0 && matx[2][3]==0 &&
1118 matx[3][0]==0 && matx[3][1]==0 &&
1119 matx[3][2]==0 && matx[3][3]==0);
1125 const T *
data()
const {
return myFloats; }
1130 unsigned hash()
const {
return SYSvector_hash(
data(), tuple_size); }
1138 return matx[
row][col];
1144 return matx[
row][col];
1175 {
return SYSsqrt(getEuclideanNorm2()); }
1177 T getEuclideanNorm2()
const;
1185 T getNormInf()
const;
1189 T getNormMax()
const;
1193 T getInfinityNorm()
const {
return getNormInf(); }
1205 int save(std::ostream &os,
int binary)
const;
1207 void dump(
const char *msg=
"")
const;
1209 void outAsciiNoName(std::ostream &os)
const;
1222 friend std::ostream &operator<<(std::ostream &os, const UT_Matrix4T<T> &
v)
1224 v.writeClassName(os);
1225 v.outAsciiNoName(os);
1236 T myFloats[tuple_size];
1272 void perspective(
fpreal zoom,
1312 void orthographic(
fpreal zoom,
1322 template <
int ORDER>
1328 void coVals(
int k,
int r[3])
const
1332 case 0: r[0] = 1; r[1] = 2; r[2] = 3;
break;
1333 case 1: r[0] = 0; r[1] = 2; r[2] = 3;
break;
1334 case 2: r[0] = 0; r[1] = 1; r[2] = 3;
break;
1335 case 3: r[0] = 0; r[1] = 1; r[2] = 2;
break;
1341 void writeClassName(std::ostream &os)
const;
1342 static const char *className();
1347 template <
typename T>
1348 template <
typename S>
1352 matx[0][0] = matx[0][1] = matx[0][2] = matx[0][3] = vec.
x();
1353 matx[1][0] = matx[1][1] = matx[1][2] = matx[1][3] = vec.
y();
1354 matx[2][0] = matx[2][1] = matx[2][2] = matx[2][3] = vec.
z();
1355 matx[3][0] = matx[3][1] = matx[3][2] = matx[3][3] = vec.
w();
1359 template <
typename T>
1360 template <
typename S>
1364 T x = vec.
x();
T y = vec.
y();
1365 T z = vec.
z();
T w = vec.
w();
1366 matx[0][0]+=
x; matx[0][1]+=
x; matx[0][2]+=
x; matx[0][3]+=
x;
1367 matx[1][0]+=
y; matx[1][1]+=
y; matx[1][2]+=
y; matx[1][3]+=
y;
1368 matx[2][0]+=
z; matx[2][1]+=
z; matx[2][2]+=
z; matx[2][3]+=
z;
1369 matx[3][0]+=
w; matx[3][1]+=
w; matx[3][2]+=
w; matx[3][3]+=
w;
1373 template <
typename T>
1374 template <
typename S>
1378 T x = vec.
x();
T y = vec.
y();
1379 T z = vec.
z();
T w = vec.
w();
1380 matx[0][0]-=
x; matx[0][1]-=
x; matx[0][2]-=
x; matx[0][3]-=
x;
1381 matx[1][0]-=
y; matx[1][1]-=
y; matx[1][2]-=
y; matx[1][3]-=
y;
1382 matx[2][0]-=
z; matx[2][1]-=
z; matx[2][2]-=
z; matx[2][3]-=
z;
1383 matx[3][0]-=
w; matx[3][1]-=
w; matx[3][2]-=
w; matx[3][3]-=
w;
1387 template <
typename T>
1388 template <
typename S>
1392 translates.
x() = matx[3][0];
1393 translates.
y() = matx[3][1];
1394 translates.
z() = matx[3][2];
1397 template <
typename T>
1398 template <
typename S>
1402 matx[3][0] = translates.
x();
1403 matx[3][1] = translates.
y();
1404 matx[3][2] = translates.
z();
1407 template <
typename T>
1415 template <
typename T>
1423 template <
typename T>
1424 template <
typename S>
1429 a = matx[0][0]; b = matx[0][1]; c = matx[0][2]; d = matx[0][3];
1430 matx[0][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0) + d*
m(3,0);
1431 matx[0][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1) + d*
m(3,1);
1432 matx[0][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2) + d*
m(3,2);
1433 matx[0][3] = a*
m(0,3) + b*
m(1,3) + c*
m(2,3) + d*
m(3,3);
1435 a = matx[1][0]; b = matx[1][1]; c = matx[1][2]; d = matx[1][3];
1436 matx[1][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0) + d*
m(3,0);
1437 matx[1][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1) + d*
m(3,1);
1438 matx[1][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2) + d*
m(3,2);
1439 matx[1][3] = a*
m(0,3) + b*
m(1,3) + c*
m(2,3) + d*
m(3,3);
1441 a = matx[2][0]; b = matx[2][1]; c = matx[2][2]; d = matx[2][3];
1442 matx[2][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0) + d*
m(3,0);
1443 matx[2][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1) + d*
m(3,1);
1444 matx[2][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2) + d*
m(3,2);
1445 matx[2][3] = a*
m(0,3) + b*
m(1,3) + c*
m(2,3) + d*
m(3,3);
1447 a = matx[3][0]; b = matx[3][1]; c = matx[3][2]; d = matx[3][3];
1448 matx[3][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0) + d*
m(3,0);
1449 matx[3][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1) + d*
m(3,1);
1450 matx[3][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2) + d*
m(3,2);
1451 matx[3][3] = a*
m(0,3) + b*
m(1,3) + c*
m(2,3) + d*
m(3,3);
1455 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1469 for (
int i = 0; i < 4; i++)
1482 template <
typename T>
1483 template <
typename S>
1488 a = matx[0][0]; b = matx[0][1]; c = matx[0][2];
1489 matx[0][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0);
1490 matx[0][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1);
1491 matx[0][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2);
1493 a = matx[1][0]; b = matx[1][1]; c = matx[1][2];
1494 matx[1][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0);
1495 matx[1][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1);
1496 matx[1][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2);
1498 a = matx[2][0]; b = matx[2][1]; c = matx[2][2];
1499 matx[2][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0);
1500 matx[2][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1);
1501 matx[2][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2);
1503 a = matx[3][0]; b = matx[3][1]; c = matx[3][2];
1504 matx[3][0] = a*
m(0,0) + b*
m(1,0) + c*
m(2,0);
1505 matx[3][1] = a*
m(0,1) + b*
m(1,1) + c*
m(2,1);
1506 matx[3][2] = a*
m(0,2) + b*
m(1,2) + c*
m(2,2);
1510 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1517 const v4uf m0(
m(0));
1518 const v4uf m1(
m(1));
1519 const v4uf m2(
m(2,0),
m(2,1),
m(2,2), 0);
1521 for (
int i = 0; i < 4; ++i)
1528 const float last =
matx[i][3];
1534 template <>
inline void
1538 for (
int i = 0; i < 4; ++i)
1549 template <
typename T>
1554 a = matx[0][0]; b = matx[1][0]; c = matx[2][0]; d = matx[3][0];
1555 matx[0][0] = a*
m(0,0) + b*
m(0,1) + c*
m(0,2) + d*
m(0,3);
1556 matx[1][0] = a*
m(1,0) + b*
m(1,1) + c*
m(1,2) + d*
m(1,3);
1557 matx[2][0] = a*
m(2,0) + b*
m(2,1) + c*
m(2,2) + d*
m(2,3);
1558 matx[3][0] = a*
m(3,0) + b*
m(3,1) + c*
m(3,2) + d*
m(3,3);
1560 a = matx[0][1]; b = matx[1][1]; c = matx[2][1]; d = matx[3][1];
1561 matx[0][1] = a*
m(0,0) + b*
m(0,1) + c*
m(0,2) + d*
m(0,3);
1562 matx[1][1] = a*
m(1,0) + b*
m(1,1) + c*
m(1,2) + d*
m(1,3);
1563 matx[2][1] = a*
m(2,0) + b*
m(2,1) + c*
m(2,2) + d*
m(2,3);
1564 matx[3][1] = a*
m(3,0) + b*
m(3,1) + c*
m(3,2) + d*
m(3,3);
1566 a = matx[0][2]; b = matx[1][2]; c = matx[2][2]; d = matx[3][2];
1567 matx[0][2] = a*
m(0,0) + b*
m(0,1) + c*
m(0,2) + d*
m(0,3);
1568 matx[1][2] = a*
m(1,0) + b*
m(1,1) + c*
m(1,2) + d*
m(1,3);
1569 matx[2][2] = a*
m(2,0) + b*
m(2,1) + c*
m(2,2) + d*
m(2,3);
1570 matx[3][2] = a*
m(3,0) + b*
m(3,1) + c*
m(3,2) + d*
m(3,3);
1572 a = matx[0][3]; b = matx[1][3]; c = matx[2][3]; d = matx[3][3];
1573 matx[0][3] = a*
m(0,0) + b*
m(0,1) + c*
m(0,2) + d*
m(0,3);
1574 matx[1][3] = a*
m(1,0) + b*
m(1,1) + c*
m(1,2) + d*
m(1,3);
1575 matx[2][3] = a*
m(2,0) + b*
m(2,1) + c*
m(2,2) + d*
m(2,3);
1576 matx[3][3] = a*
m(3,0) + b*
m(3,1) + c*
m(3,2) + d*
m(3,3);
1579 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1589 for (
int i = 0; i < 4; ++i)
1602 template <
typename T>
1607 m[0][0] = m1(0,0)+m2(0,0); m[0][1] = m1(0,1)+m2(0,1);
1608 m[0][2] = m1(0,2)+m2(0,2); m[0][3] = m1(0,3)+m2(0,3);
1610 m[1][0] = m1(1,0)+m2(1,0); m[1][1] = m1(1,1)+m2(1,1);
1611 m[1][2] = m1(1,2)+m2(1,2); m[1][3] = m1(1,3)+m2(1,3);
1613 m[2][0] = m1(2,0)+m2(2,0); m[2][1] = m1(2,1)+m2(2,1);
1614 m[2][2] = m1(2,2)+m2(2,2); m[2][3] = m1(2,3)+m2(2,3);
1616 m[3][0] = m1(3,0)+m2(3,0); m[3][1] = m1(3,1)+m2(3,1);
1617 m[3][2] = m1(3,2)+m2(3,2); m[3][3] = m1(3,3)+m2(3,3);
1620 template <
typename T>
1625 m[0][0] = m1(0,0)-m2(0,0); m[0][1] = m1(0,1)-m2(0,1);
1626 m[0][2] = m1(0,2)-m2(0,2); m[0][3] = m1(0,3)-m2(0,3);
1628 m[1][0] = m1(1,0)-m2(1,0); m[1][1] = m1(1,1)-m2(1,1);
1629 m[1][2] = m1(1,2)-m2(1,2); m[1][3] = m1(1,3)-m2(1,3);
1631 m[2][0] = m1(2,0)-m2(2,0); m[2][1] = m1(2,1)-m2(2,1);
1632 m[2][2] = m1(2,2)-m2(2,2); m[2][3] = m1(2,3)-m2(2,3);
1634 m[3][0] = m1(3,0)-m2(3,0); m[3][1] = m1(3,1)-m2(3,1);
1635 m[3][2] = m1(3,2)-m2(3,2); m[3][3] = m1(3,3)-m2(3,3);
1638 template <
typename T>
1643 m[0][0] = m1(0,0)*m2(0,0) + m1(0,1)*m2(1,0) +
1644 m1(0,2)*m2(2,0) + m1(0,3)*m2(3,0) ;
1645 m[0][1] = m1(0,0)*m2(0,1) + m1(0,1)*m2(1,1) +
1646 m1(0,2)*m2(2,1) + m1(0,3)*m2(3,1) ;
1647 m[0][2] = m1(0,0)*m2(0,2) + m1(0,1)*m2(1,2) +
1648 m1(0,2)*m2(2,2) + m1(0,3)*m2(3,2) ;
1649 m[0][3] = m1(0,0)*m2(0,3) + m1(0,1)*m2(1,3) +
1650 m1(0,2)*m2(2,3) + m1(0,3)*m2(3,3) ;
1652 m[1][0] = m1(1,0)*m2(0,0) + m1(1,1)*m2(1,0) +
1653 m1(1,2)*m2(2,0) + m1(1,3)*m2(3,0) ;
1654 m[1][1] = m1(1,0)*m2(0,1) + m1(1,1)*m2(1,1) +
1655 m1(1,2)*m2(2,1) + m1(1,3)*m2(3,1) ;
1656 m[1][2] = m1(1,0)*m2(0,2) + m1(1,1)*m2(1,2) +
1657 m1(1,2)*m2(2,2) + m1(1,3)*m2(3,2) ;
1658 m[1][3] = m1(1,0)*m2(0,3) + m1(1,1)*m2(1,3) +
1659 m1(1,2)*m2(2,3) + m1(1,3)*m2(3,3) ;
1661 m[2][0] = m1(2,0)*m2(0,0) + m1(2,1)*m2(1,0) +
1662 m1(2,2)*m2(2,0) + m1(2,3)*m2(3,0) ;
1663 m[2][1] = m1(2,0)*m2(0,1) + m1(2,1)*m2(1,1) +
1664 m1(2,2)*m2(2,1) + m1(2,3)*m2(3,1) ;
1665 m[2][2] = m1(2,0)*m2(0,2) + m1(2,1)*m2(1,2) +
1666 m1(2,2)*m2(2,2) + m1(2,3)*m2(3,2) ;
1667 m[2][3] = m1(2,0)*m2(0,3) + m1(2,1)*m2(1,3) +
1668 m1(2,2)*m2(2,3) + m1(2,3)*m2(3,3) ;
1670 m[3][0] = m1(3,0)*m2(0,0) + m1(3,1)*m2(1,0) +
1671 m1(3,2)*m2(2,0) + m1(3,3)*m2(3,0) ;
1672 m[3][1] = m1(3,0)*m2(0,1) + m1(3,1)*m2(1,1) +
1673 m1(3,2)*m2(2,1) + m1(3,3)*m2(3,1) ;
1674 m[3][2] = m1(3,0)*m2(0,2) + m1(3,1)*m2(1,2) +
1675 m1(3,2)*m2(2,2) + m1(3,3)*m2(3,2) ;
1676 m[3][3] = m1(3,0)*m2(0,3) + m1(3,1)*m2(1,3) +
1677 m1(3,2)*m2(2,3) + m1(3,3)*m2(3,3) ;
1680 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1692 for (
int i = 0; i < 4; ++i)
1705 template <
typename T,
typename S>
1711 m[0][0] = m1(0,0) +
x; m[0][1] = m1(0,1) +
x;
1712 m[0][2] = m1(0,2) +
x; m[0][3] = m1(0,3) +
x;
1714 m[1][0] = m1(1,0) +
y; m[1][1] = m1(1,1) +
y;
1715 m[1][2] = m1(1,2) +
y; m[1][3] = m1(1,3) +
y;
1717 m[2][0] = m1(2,0) +
z; m[2][1] = m1(2,1) +
z;
1718 m[2][2] = m1(2,2) +
z; m[2][3] = m1(2,3) +
z;
1720 m[3][0] = m1(3,0) +
w; m[3][1] = m1(3,1) +
w;
1721 m[3][2] = m1(3,2) +
w; m[3][3] = m1(3,3) +
w;
1725 template <
typename T,
typename S>
1732 template <
typename T,
typename S>
1738 m[0][0] = m1(0,0) -
x; m[0][1] = m1(0,1) -
x;
1739 m[0][2] = m1(0,2) -
x; m[0][3] = m1(0,3) -
x;
1741 m[1][0] = m1(1,0) -
y; m[1][1] = m1(1,1) -
y;
1742 m[1][2] = m1(1,2) -
y; m[1][3] = m1(1,3) -
y;
1744 m[2][0] = m1(2,0) -
z; m[2][1] = m1(2,1) -
z;
1745 m[2][2] = m1(2,2) -
z; m[2][3] = m1(2,3) -
z;
1747 m[3][0] = m1(3,0) -
w; m[3][1] = m1(3,1) -
w;
1748 m[3][2] = m1(3,2) -
w; m[3][3] = m1(3,3) -
w;
1752 template <
typename T,
typename S>
1758 m[0][0] = x - m1(0,0); m[0][1] = x - m1(0,1);
1759 m[0][2] = x - m1(0,2); m[0][3] = x - m1(0,3);
1761 m[1][0] = y - m1(1,0); m[1][1] = y - m1(1,1);
1762 m[1][2] = y - m1(1,2); m[1][3] = y - m1(1,3);
1764 m[2][0] = z - m1(2,0); m[2][1] = z - m1(2,1);
1765 m[2][2] = z - m1(2,2); m[2][3] = z - m1(2,3);
1767 m[3][0] = w - m1(3,0); m[3][1] = w - m1(3,1);
1768 m[3][2] = w - m1(3,2); m[3][3] = w - m1(3,3);
1772 template <
typename T,
typename S>
1777 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;
1778 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;
1779 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;
1780 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;
1784 template <
typename T,
typename S>
1789 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);
1790 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);
1791 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);
1792 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);
1796 template <
typename T,
typename S>
1803 template <
typename T,
typename S>
1808 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;
1809 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;
1810 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;
1811 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;
1815 template <
typename T,
typename S>
1820 return (m1 * (
T(1.0)/scalar));
1823 template <
typename T,
typename S>
1828 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);
1829 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);
1830 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);
1831 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);
1854 template <
typename T,
typename S>
1856 template <
typename T,
typename S>
1859 template <
typename T,
typename S>
1861 template <
typename T,
typename S>
1865 template <
typename T,
typename S>
1870 v.
x()*
m(0,0) + v.
y()*
m(1,0) + v.
z()*
m(2,0) +
m(3,0),
1871 v.
x()*
m(0,1) + v.
y()*
m(1,1) + v.
z()*
m(2,1) +
m(3,1),
1872 v.
x()*
m(0,2) + v.
y()*
m(1,2) + v.
z()*
m(2,2) +
m(3,2)
1875 template <
typename T,
typename S>
1882 template <
typename T,
typename S>
1887 v.
x()*
m(0,0) + v.
y()*
m(1,0) + v.
z()*
m(2,0),
1888 v.
x()*
m(0,1) + v.
y()*
m(1,1) + v.
z()*
m(2,1),
1889 v.
x()*
m(0,2) + v.
y()*
m(1,2) + v.
z()*
m(2,2)
1893 template <
typename T,
typename S>
1898 v.
x()*
m(0,0) + v.
y()*
m(0,1) + v.
z()*
m(0,2) +
m(0,3),
1899 v.
x()*
m(1,0) + v.
y()*
m(1,1) + v.
z()*
m(1,2) +
m(1,3),
1900 v.
x()*
m(2,0) + v.
y()*
m(2,1) + v.
z()*
m(2,2) +
m(2,3)
1904 template <
typename T,
typename S>
1909 v.
x()*
m(0,0) + v.
y()*
m(0,1) + v.
z()*
m(0,2),
1910 v.
x()*
m(1,0) + v.
y()*
m(1,1) + v.
z()*
m(1,2),
1911 v.
x()*
m(2,0) + v.
y()*
m(2,1) + v.
z()*
m(2,2)
1914 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1948 +
v4uf(
m(0,3),
m(1,3),
m(2,3),
m(3,3));
1968 template <
typename T>
1974 template <
typename T>
1980 template <
typename T>
1986 template <
typename T>
1992 template <
typename T>
1998 template <
typename T>
2004 template <
typename T>
2010 template <
typename T>
2016 template <
typename T>
2017 template <
typename S>
2024 template <
typename T>
2025 template <
typename S>
2031 template <
typename T>
2032 template <
typename S>
2038 template <
typename T>
2039 template <
typename S>
2045 template <
typename T>
2046 template <
typename S>
2052 template <
typename T>
2053 template <
typename S>
2060 template <
typename T>
2066 template <
typename T>
2090 template <
typename T>
2114 template <
typename T,
typename S>
2137 #ifndef UT_DISABLE_VECTORIZE_MATRIX
2143 for (
int i = 0; i < 4; ++i)
2154 template<
typename T, ex
int D >
2157 template<
typename T>
2167 template<
typename T>
2171 template <
typename T>
template<
int ORDER>
2178 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2179 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2180 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2185 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2186 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2187 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2192 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2193 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2194 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2199 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2200 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2201 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2206 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2207 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2208 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2213 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2214 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2215 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)
GLboolean GLboolean GLboolean b
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)
GLuint GLdouble GLdouble GLint GLint order
UT_API size_t format(char *buffer, size_t buffer_size, const UT_Matrix4T< T > &v)
GLenum GLenum GLenum GLenum GLenum scale
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)
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)
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)
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
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
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
GLubyte GLubyte GLubyte GLubyte w
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
GLdouble GLdouble GLdouble GLdouble q
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)
GLfloat GLfloat GLfloat v2
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
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
static const bool isVectorType
GLboolean GLboolean GLboolean GLboolean a
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)
GLdouble GLdouble GLdouble z
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)
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)
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
constexpr UT_Matrix4T(fpreal64 val) noexcept
Construct identity matrix, multipled by scalar.
void zero()
Set the matrix to zero.
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.
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.
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
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