10 #ifndef __UT_Matrix4_h__
11 #define __UT_Matrix4_h__
26 #ifndef UT_DISABLE_VECTORIZE_MATRIX
44 template <
typename T,
typename S>
46 template <
typename T,
typename S>
48 template <
typename T,
typename S>
50 template <
typename T,
typename S>
52 template <
typename T,
typename S>
54 template <
typename T,
typename S>
56 template <
typename T,
typename S>
58 template <
typename T,
typename S>
60 template <
typename T,
typename S>
62 template <
typename T,
typename S>
64 template <
typename T,
typename S>
66 template <
typename T,
typename S>
73 template <
typename T,
typename S>
77 template <
typename T,
typename S>
84 template <
typename T,
typename S>
87 {
return v0 * (1 - u -
v) + v1 * u + v2 *v; }
101 static constexpr
const int tuple_size = 16;
124 template <
typename S>
125 explicit constexpr
UT_Matrix4T(
const S m[4][4]) noexcept
127 {
T(m[0][0]),
T(m[0][1]),
T(m[0][2]),
T(m[0][3])},
128 {
T(m[1][0]),
T(m[1][1]),
T(m[1][2]),
T(m[1][3])},
129 {
T(m[2][0]),
T(m[2][1]),
T(m[2][2]),
T(m[2][3])},
130 {
T(m[3][0]),
T(m[3][1]),
T(m[3][2]),
T(m[3][3])}}
136 T val10,
T val11,
T val12,
T val13,
137 T val20,
T val21,
T val22,
T val23,
138 T val30,
T val31,
T val32,
T val33) noexcept
139 : matx{{
T(val00),
T(val01),
T(val02),
T(val03)},
140 {
T(val10),
T(val11),
T(val12),
T(val13)},
141 {
T(val20),
T(val21),
T(val22),
T(val23)},
142 {
T(val30),
T(val31),
T(val32),
T(val33)}}
147 template <
typename S>
150 matx[0][0]=m(0,0); matx[0][1]=m(0,1); matx[0][2]=m(0,2); matx[0][3]=m(0,3);
151 matx[1][0]=m(1,0); matx[1][1]=m(1,1); matx[1][2]=m(1,2); matx[1][3]=m(1,3);
152 matx[2][0]=m(2,0); matx[2][1]=m(2,1); matx[2][2]=m(2,2); matx[2][3]=m(2,3);
153 matx[3][0]=m(3,0); matx[3][1]=m(3,1); matx[3][2]=m(3,2); matx[3][3]=m(3,3);
155 template <
typename S>
158 matx[0][0]=m(0,0); matx[0][1]=m(0,1); matx[0][2]=m(0,2); matx[0][3]=(
T)0.;
159 matx[1][0]=m(1,0); matx[1][1]=m(1,1); matx[1][2]=m(1,2); matx[1][3]=(
T)0.;
160 matx[2][0]=m(2,0); matx[2][1]=m(2,1); matx[2][2]=m(2,2); matx[2][3]=(
T)0.;
161 matx[3][0]=(
T)0.; matx[3][1]=(
T)0.; matx[3][2]=(
T)0.; matx[3][3]=(
T)1.;
164 template <
typename S,
typename U>
167 matx[0][0]=m(0,0); matx[0][1]=m(0,1); matx[0][2]=m(0,2); matx[0][3]=(
T)0.;
168 matx[1][0]=m(1,0); matx[1][1]=m(1,1); matx[1][2]=m(1,2); matx[1][3]=(
T)0.;
169 matx[2][0]=m(2,0); matx[2][1]=m(2,1); matx[2][2]=m(2,2); matx[2][3]=(
T)0.;
170 matx[3][0]=(
T)t[0]; matx[3][1]=(
T)t[1]; matx[3][2]=(
T)t[2]; matx[3][3]=(
T)1.;
188 template <
typename S>
191 matx[0][0]=m(0,0); matx[0][1]=m(0,1);
192 matx[0][2]=m(0,2); matx[0][3]=(
T)0.;
193 matx[1][0]=m(1,0); matx[1][1]=m(1,1);
194 matx[1][2]=m(1,2); matx[1][3]=(
T)0.;
195 matx[2][0]=m(2,0); matx[2][1]=m(2,1);
196 matx[2][2]=m(2,2); matx[2][3]=(
T)0.;
197 matx[3][0]=(
T)0.; matx[3][1]=(
T)0.;
198 matx[3][2]=(
T)0.; matx[3][3]=(
T)1.;
202 template <
typename S>
205 matx[0][0]=m(0,0); matx[0][1]=m(0,1);
206 matx[0][2]=m(0,2); matx[0][3]=m(0,3);
207 matx[1][0]=m(1,0); matx[1][1]=m(1,1);
208 matx[1][2]=m(1,2); matx[1][3]=m(1,3);
209 matx[2][0]=m(2,0); matx[2][1]=m(2,1);
210 matx[2][2]=m(2,2); matx[2][3]=m(2,3);
211 matx[3][0]=m(3,0); matx[3][1]=m(3,1);
212 matx[3][2]=m(3,2); matx[3][3]=m(3,3);
217 template <
typename S>
220 matx[0][0] = m.q00; matx[0][1] = m.q01; matx[0][2] = m.q02;
221 matx[0][3] = m.q03; matx[1][0] = m.q01; matx[1][1] = m.q11;
222 matx[1][2] = m.q12; matx[1][3] = m.q13; matx[2][0] = m.q02;
223 matx[2][1] = m.q12; matx[2][2] = m.q22; matx[2][3] = m.q23;
224 matx[3][0] = m.q03; matx[3][1] = m.q13; matx[3][2] = m.q23;
232 -matx[0][0], -matx[0][1], -matx[0][2], -matx[0][3],
233 -matx[1][0], -matx[1][1], -matx[1][2], -matx[1][3],
234 -matx[2][0], -matx[2][1], -matx[2][2], -matx[2][3],
235 -matx[3][0], -matx[3][1], -matx[3][2], -matx[3][3]);
241 matx[0][0]+=m.
matx[0][0]; matx[0][1]+=m.
matx[0][1];
242 matx[0][2]+=m.
matx[0][2]; matx[0][3]+=m.
matx[0][3];
244 matx[1][0]+=m.
matx[1][0]; matx[1][1]+=m.
matx[1][1];
245 matx[1][2]+=m.
matx[1][2]; matx[1][3]+=m.
matx[1][3];
247 matx[2][0]+=m.
matx[2][0]; matx[2][1]+=m.
matx[2][1];
248 matx[2][2]+=m.
matx[2][2]; matx[2][3]+=m.
matx[2][3];
250 matx[3][0]+=m.
matx[3][0]; matx[3][1]+=m.
matx[3][1];
251 matx[3][2]+=m.
matx[3][2]; matx[3][3]+=m.
matx[3][3];
257 matx[0][0]-=m.
matx[0][0]; matx[0][1]-=m.
matx[0][1];
258 matx[0][2]-=m.
matx[0][2]; matx[0][3]-=m.
matx[0][3];
260 matx[1][0]-=m.
matx[1][0]; matx[1][1]-=m.
matx[1][1];
261 matx[1][2]-=m.
matx[1][2]; matx[1][3]-=m.
matx[1][3];
263 matx[2][0]-=m.
matx[2][0]; matx[2][1]-=m.
matx[2][1];
264 matx[2][2]-=m.
matx[2][2]; matx[2][3]-=m.
matx[2][3];
266 matx[3][0]-=m.
matx[3][0]; matx[3][1]-=m.
matx[3][1];
267 matx[3][2]-=m.
matx[3][2]; matx[3][3]-=m.
matx[3][3];
279 return (&m ==
this) || (
280 matx[0][0]==m.
matx[0][0] && matx[0][1]==m.
matx[0][1] &&
281 matx[0][2]==m.
matx[0][2] && matx[0][3]==m.
matx[0][3] &&
283 matx[1][0]==m.
matx[1][0] && matx[1][1]==m.
matx[1][1] &&
284 matx[1][2]==m.
matx[1][2] && matx[1][3]==m.
matx[1][3] &&
286 matx[2][0]==m.
matx[2][0] && matx[2][1]==m.
matx[2][1] &&
287 matx[2][2]==m.
matx[2][2] && matx[2][3]==m.
matx[2][3] &&
289 matx[3][0]==m.
matx[3][0] && matx[3][1]==m.
matx[3][1] &&
290 matx[3][2]==m.
matx[3][2] && matx[3][3]==m.
matx[3][3] );
295 return !(*
this == m);
301 matx[0][0]=
v; matx[0][1]= 0; matx[0][2]= 0; matx[0][3]= 0;
302 matx[1][0]= 0; matx[1][1]=
v; matx[1][2]= 0; matx[1][3]= 0;
303 matx[2][0]= 0; matx[2][1]= 0; matx[2][2]=
v; matx[2][3]= 0;
304 matx[3][0]= 0; matx[3][1]= 0; matx[3][2]= 0; matx[3][3]=
v;
314 matx[0][0]*=scalar; matx[0][1]*=scalar;
315 matx[0][2]*=scalar; matx[0][3]*=scalar;
317 matx[1][0]*=scalar; matx[1][1]*=scalar;
318 matx[1][2]*=scalar; matx[1][3]*=scalar;
320 matx[2][0]*=scalar; matx[2][1]*=scalar;
321 matx[2][2]*=scalar; matx[2][3]*=scalar;
323 matx[3][0]*=scalar; matx[3][1]*=scalar;
324 matx[3][2]*=scalar; matx[3][3]*=scalar;
334 template <
typename S>
336 template <
typename S>
338 template <
typename S>
363 det = matx[r[0]][c[0]]*
364 (matx[r[1]][c[1]]*matx[r[2]][c[2]]-
365 matx[r[1]][c[2]]*matx[r[2]][c[1]]) +
367 (matx[r[1]][c[2]]*matx[r[2]][c[0]]-
368 matx[r[1]][c[0]]*matx[r[2]][c[2]]) +
370 (matx[r[1]][c[0]]*matx[r[2]][c[1]]-
371 matx[r[1]][c[1]]*matx[r[2]][c[0]]);
381 return(matx[0][0]*coFactor(0,0) +
382 matx[0][1]*coFactor(0,1) +
383 matx[0][2]*coFactor(0,2) +
384 matx[0][3]*coFactor(0,3) );
390 (matx[1][1]*matx[2][2]-matx[1][2]*matx[2][1]) +
392 (matx[1][2]*matx[2][0]-matx[1][0]*matx[2][2]) +
394 (matx[1][0]*matx[2][1]-matx[1][1]*matx[2][0]) );
398 {
return matx[0][0]+matx[1][1]+matx[2][2]+matx[3][3]; }
440 template <
typename S>
447 template <
typename S>
466 template <
typename S>
477 { instanceT(p, v, s, s3, up, q, tr, orient,
pivot); }
483 { instanceT(p, v, s, s3, up, q, tr, orient,
pivot); }
485 template <
typename S>
496 { instanceInverseT(p, v, s, s3, up, q, tr, orient,
pivot); }
502 { instanceInverseT(p, v, s, s3, up, q, tr, orient,
pivot); }
508 tmp=matx[0][1]; matx[0][1]=matx[1][0]; matx[1][0]=tmp;
509 tmp=matx[0][2]; matx[0][2]=matx[2][0]; matx[2][0]=tmp;
510 tmp=matx[0][3]; matx[0][3]=matx[3][0]; matx[3][0]=tmp;
511 tmp=matx[1][2]; matx[1][2]=matx[2][1]; matx[2][1]=tmp;
512 tmp=matx[1][3]; matx[1][3]=matx[3][1]; matx[3][1]=tmp;
513 tmp=matx[2][3]; matx[2][3]=matx[3][2]; matx[3][2]=tmp;
517 return UT_Matrix4T<T>(matx[0][0], matx[1][0], matx[2][0], matx[3][0],
518 matx[0][1], matx[1][1], matx[2][1], matx[3][1],
519 matx[0][2], matx[1][2], matx[2][2], matx[3][2],
520 matx[0][3], matx[1][3], matx[2][3], matx[3][3]);
527 return (&m ==
this) || (
555 template <
typename S>
558 template<UT_Axis3::axis A>
564 template<UT_Axis3::axis A,
bool reverse=false>
574 matx[
row][col0] = -matx[
row][col1];
575 matx[
row][col1] =
v1;
579 matx[
row][col0] = matx[
row][col1];
580 matx[
row][col1] = -
v1;
587 template<UT_Axis3::axis A>
595 matx[
row][col0] = -matx[
row][col0];
596 matx[
row][col1] = -matx[
row][col1];
602 template<UT_Axis3::axis A>
618 template <
typename S>
629 template <
typename S>
632 template<UT_Axis3::axis A>
633 void prerotate(
T theta);
638 template<UT_Axis3::axis A,
bool reverse=false>
644 for (
uint col = 0; col < 4; ++col)
645 v1[col] = matx[row0][col];
648 for (
uint col = 0; col < 4; ++col)
649 matx[row0][col] = matx[row1][col];
650 for (
uint col = 0; col < 4; ++col)
651 matx[row1][col] = -v1[col];
655 for (
uint col = 0; col < 4; ++col)
656 matx[row0][col] = -matx[row1][col];
657 for (
uint col = 0; col < 4; ++col)
658 matx[row1][col] = v1[col];
664 template<UT_Axis3::axis A>
670 for (
uint col = 0; col < 4; ++col)
671 matx[row0][col] = -matx[row0][col];
672 for (
uint col = 0; col < 4; ++col)
673 matx[row1][col] = -matx[row1][col];
682 {
rotate(rad(0), rad(1), rad(2), ord); }
688 void prerotate(
T rx,
T ry,
T rz,
692 { prerotate(rad(0), rad(1), rad(2), ord); }
699 matx[0][0] *= sx; matx[0][1] *= sy;
700 matx[0][2] *= sz; matx[0][3] *= sw;
702 matx[1][0] *= sx; matx[1][1] *= sy;
703 matx[1][2] *= sz; matx[1][3] *= sw;
705 matx[2][0] *= sx; matx[2][1] *= sy;
706 matx[2][2] *= sz; matx[2][3] *= sw;
708 matx[3][0] *= sx; matx[3][1] *= sy;
709 matx[3][2] *= sz; matx[3][3] *= sw;
721 matx[0][0] *= sx; matx[1][0] *= sy;
722 matx[2][0] *= sz; matx[3][0] *= sw;
724 matx[0][1] *= sx; matx[1][1] *= sy;
725 matx[2][1] *= sz; matx[3][1] *= sw;
727 matx[0][2] *= sx; matx[1][2] *= sy;
728 matx[2][2] *= sz; matx[3][2] *= sw;
730 matx[0][3] *= sx; matx[1][3] *= sy;
731 matx[2][3] *= sz; matx[3][3] *= sw;
734 { prescale(
s(0),
s(1),
s(2)); }
736 { prescale(s, s, s); }
750 matx[0][0] += matx[0][1]*s_xy + matx[0][2]*s_xz;
751 matx[0][1] += matx[0][2]*s_yz;
753 matx[1][0] += matx[1][1]*s_xy + matx[1][2]*s_xz;
754 matx[1][1] += matx[1][2]*s_yz;
756 matx[2][0] += matx[2][1]*s_xy + matx[2][2]*s_xz;
757 matx[2][1] += matx[2][2]*s_yz;
759 matx[3][0] += matx[3][1]*s_xy + matx[3][2]*s_xz;
760 matx[3][1] += matx[3][2]*s_yz;
764 {
shear(sh(0), sh(1), sh(2)); }
773 matx[0][0] += a*dx; matx[0][1] += a*dy; matx[0][2] += a*dz;
775 matx[1][0] += a*dx; matx[1][1] += a*dy; matx[1][2] += a*dz;
777 matx[2][0] += a*dx; matx[2][1] += a*dy; matx[2][2] += a*dz;
779 matx[3][0] += a*dx; matx[3][1] += a*dy; matx[3][2] += a*dz;
783 {
translate(delta(0), delta(1), delta(2)); }
790 matx[3][0] += matx[0][0]*dx + matx[1][0]*dy + matx[2][0]*dz;
791 matx[3][1] += matx[0][1]*dx + matx[1][1]*dy + matx[2][1]*dz;
792 matx[3][2] += matx[0][2]*dx + matx[1][2]*dy + matx[2][2]*dz;
793 matx[3][3] += matx[0][3]*dx + matx[1][3]*dy + matx[2][3]*dz;
797 { pretranslate(delta(0), delta(1), delta(2)); }
806 template <
typename S>
820 T tx=0,
T ty=0,
T tz=0,
821 T rx=0,
T ry=0,
T rz=0,
822 T sx=1,
T sy=1,
T sz=1,
823 T px=0,
T py=0,
T pz=0,
831 T s_xy,
T s_xz,
T s_yz,
836 template <
typename S>
841 : myTranslate(0, 0, 0)
849 : myTranslate(translate)
873 T s_xy,
T s_xz,
T s_yz,
883 , myTranslate(0, 0, 0)
884 , myRotateOffset(0, 0, 0)
885 , myParentRotate(0, 0, 0)
887 , myChildRotate(0, 0, 0)
888 , myRotatePivot(0, 0, 0)
889 , myScaleOffset(0, 0, 0)
892 , myScalePivot(0, 0, 0)
894 , myPivotRotate(0, 0, 0)
928 enum applyType { BEFORE=1, EQUAL=2, AFTER=4, BEFORE_EQUAL=3, AFTER_EQUAL=6};
930 applyType
type,
char limit,
937 applyType
type,
char limit,
941 template <
typename S>
943 template <
typename S>
952 template <
typename S>
959 {
return explodeT(order, r, s, t, shears); }
963 {
return explodeT(order, r, s, t, shears); }
966 template <
typename S>
975 {
return explodeT(order, r, s, t, p, shears); }
980 {
return explodeT(order, r, s, t, p, shears); }
983 template <
typename S>
992 {
return explodeT(order, r, s, t, p, shears); }
997 {
return explodeT(order, r, s, t, p, shears); }
1002 template <
typename S>
1005 S *shears = 0)
const;
1007 template <
typename S>
1011 S *shears = 0)
const;
1015 template <
typename S>
1025 template <
typename S>
1030 const int max_iter = 64,
1031 const T rel_tol = FLT_EPSILON)
const;
1036 template <
typename S>
1055 bool polarDecompose(
1058 const int max_iter = 64,
1059 const T rel_tol = FLT_EPSILON);
1072 bool makeRigidMatrix(
1075 const int max_iter = 64,
1076 const T rel_tol = FLT_EPSILON);
1082 template <
typename S>
1087 return (i <= 3 && j <= 3) ?
1088 matx[i][0]*matx[
j][0] + matx[i][1]*matx[
j][1] +
1089 matx[i][2]*matx[
j][2] + matx[i][3]*matx[
j][3] : (
T)0;
1093 template <
typename S>
1094 void outerproductUpdate(
T b,
1099 template <
typename S>
1120 for (
size_t i = 0; i < tuple_size; i++)
1134 matx[0][0]==1 && matx[0][1]==0 &&
1135 matx[0][2]==0 && matx[0][3]==0 &&
1136 matx[1][0]==0 && matx[1][1]==1 &&
1137 matx[1][2]==0 && matx[1][3]==0 &&
1138 matx[2][0]==0 && matx[2][1]==0 &&
1139 matx[2][2]==1 && matx[2][3]==0 &&
1140 matx[3][0]==0 && matx[3][1]==0 &&
1141 matx[3][2]==0 && matx[3][3]==1);
1148 matx[0][0]==0 && matx[0][1]==0 &&
1149 matx[0][2]==0 && matx[0][3]==0 &&
1150 matx[1][0]==0 && matx[1][1]==0 &&
1151 matx[1][2]==0 && matx[1][3]==0 &&
1152 matx[2][0]==0 && matx[2][1]==0 &&
1153 matx[2][2]==0 && matx[2][3]==0 &&
1154 matx[3][0]==0 && matx[3][1]==0 &&
1155 matx[3][2]==0 && matx[3][3]==0);
1161 const T *
data()
const {
return myFloats; }
1166 unsigned hash()
const {
return SYSvector_hash(
data(), tuple_size); }
1174 return matx[
row][col];
1180 return matx[
row][col];
1211 {
return SYSsqrt(getEuclideanNorm2()); }
1213 T getEuclideanNorm2()
const;
1221 T getNormInf()
const;
1225 T getNormMax()
const;
1229 T getNormSpectral()
const;
1233 T getInfinityNorm()
const {
return getNormInf(); }
1245 int save(std::ostream &os,
int binary)
const;
1247 void dump(
const char *msg=
"")
const;
1249 void outAsciiNoName(std::ostream &os)
const;
1262 friend std::ostream &operator<<(std::ostream &os, const UT_Matrix4T<T> &
v)
1264 v.writeClassName(os);
1265 v.outAsciiNoName(os);
1276 T myFloats[tuple_size];
1312 void perspective(
fpreal zoom,
1352 void orthographic(
fpreal zoom,
1362 template <
int ORDER>
1368 void coVals(
int k,
int r[3])
const
1372 case 0: r[0] = 1; r[1] = 2; r[2] = 3;
break;
1373 case 1: r[0] = 0; r[1] = 2; r[2] = 3;
break;
1374 case 2: r[0] = 0; r[1] = 1; r[2] = 3;
break;
1375 case 3: r[0] = 0; r[1] = 1; r[2] = 2;
break;
1381 void writeClassName(std::ostream &os)
const;
1382 static const char *className();
1387 template <
typename T>
1388 template <
typename S>
1392 matx[0][0] = matx[0][1] = matx[0][2] = matx[0][3] = vec.
x();
1393 matx[1][0] = matx[1][1] = matx[1][2] = matx[1][3] = vec.
y();
1394 matx[2][0] = matx[2][1] = matx[2][2] = matx[2][3] = vec.
z();
1395 matx[3][0] = matx[3][1] = matx[3][2] = matx[3][3] = vec.
w();
1399 template <
typename T>
1400 template <
typename S>
1404 T x = vec.
x();
T y = vec.
y();
1405 T z = vec.
z();
T w = vec.
w();
1406 matx[0][0]+=
x; matx[0][1]+=
x; matx[0][2]+=
x; matx[0][3]+=
x;
1407 matx[1][0]+=
y; matx[1][1]+=
y; matx[1][2]+=
y; matx[1][3]+=
y;
1408 matx[2][0]+=
z; matx[2][1]+=
z; matx[2][2]+=
z; matx[2][3]+=
z;
1409 matx[3][0]+=
w; matx[3][1]+=
w; matx[3][2]+=
w; matx[3][3]+=
w;
1413 template <
typename T>
1414 template <
typename S>
1418 T x = vec.
x();
T y = vec.
y();
1419 T z = vec.
z();
T w = vec.
w();
1420 matx[0][0]-=
x; matx[0][1]-=
x; matx[0][2]-=
x; matx[0][3]-=
x;
1421 matx[1][0]-=
y; matx[1][1]-=
y; matx[1][2]-=
y; matx[1][3]-=
y;
1422 matx[2][0]-=
z; matx[2][1]-=
z; matx[2][2]-=
z; matx[2][3]-=
z;
1423 matx[3][0]-=
w; matx[3][1]-=
w; matx[3][2]-=
w; matx[3][3]-=
w;
1427 template <
typename T>
1428 template <
typename S>
1432 translates.
x() = matx[3][0];
1433 translates.
y() = matx[3][1];
1434 translates.
z() = matx[3][2];
1437 template <
typename T>
1438 template <
typename S>
1442 matx[3][0] = translates.
x();
1443 matx[3][1] = translates.
y();
1444 matx[3][2] = translates.
z();
1447 template <
typename T>
1455 template <
typename T>
1463 template <
typename T>
1464 template <
typename S>
1469 a = matx[0][0]; b = matx[0][1]; c = matx[0][2]; d = matx[0][3];
1470 matx[0][0] = a*m(0,0) + b*m(1,0) + c*m(2,0) + d*m(3,0);
1471 matx[0][1] = a*m(0,1) + b*m(1,1) + c*m(2,1) + d*m(3,1);
1472 matx[0][2] = a*m(0,2) + b*m(1,2) + c*m(2,2) + d*m(3,2);
1473 matx[0][3] = a*m(0,3) + b*m(1,3) + c*m(2,3) + d*m(3,3);
1475 a = matx[1][0]; b = matx[1][1]; c = matx[1][2]; d = matx[1][3];
1476 matx[1][0] = a*m(0,0) + b*m(1,0) + c*m(2,0) + d*m(3,0);
1477 matx[1][1] = a*m(0,1) + b*m(1,1) + c*m(2,1) + d*m(3,1);
1478 matx[1][2] = a*m(0,2) + b*m(1,2) + c*m(2,2) + d*m(3,2);
1479 matx[1][3] = a*m(0,3) + b*m(1,3) + c*m(2,3) + d*m(3,3);
1481 a = matx[2][0]; b = matx[2][1]; c = matx[2][2]; d = matx[2][3];
1482 matx[2][0] = a*m(0,0) + b*m(1,0) + c*m(2,0) + d*m(3,0);
1483 matx[2][1] = a*m(0,1) + b*m(1,1) + c*m(2,1) + d*m(3,1);
1484 matx[2][2] = a*m(0,2) + b*m(1,2) + c*m(2,2) + d*m(3,2);
1485 matx[2][3] = a*m(0,3) + b*m(1,3) + c*m(2,3) + d*m(3,3);
1487 a = matx[3][0]; b = matx[3][1]; c = matx[3][2]; d = matx[3][3];
1488 matx[3][0] = a*m(0,0) + b*m(1,0) + c*m(2,0) + d*m(3,0);
1489 matx[3][1] = a*m(0,1) + b*m(1,1) + c*m(2,1) + d*m(3,1);
1490 matx[3][2] = a*m(0,2) + b*m(1,2) + c*m(2,2) + d*m(3,2);
1491 matx[3][3] = a*m(0,3) + b*m(1,3) + c*m(2,3) + d*m(3,3);
1495 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1509 for (
int i = 0; i < 4; i++)
1522 template <
typename T>
1523 template <
typename S>
1528 a = matx[0][0]; b = matx[0][1]; c = matx[0][2];
1529 matx[0][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
1530 matx[0][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
1531 matx[0][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
1533 a = matx[1][0]; b = matx[1][1]; c = matx[1][2];
1534 matx[1][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
1535 matx[1][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
1536 matx[1][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
1538 a = matx[2][0]; b = matx[2][1]; c = matx[2][2];
1539 matx[2][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
1540 matx[2][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
1541 matx[2][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
1543 a = matx[3][0]; b = matx[3][1]; c = matx[3][2];
1544 matx[3][0] = a*m(0,0) + b*m(1,0) + c*m(2,0);
1545 matx[3][1] = a*m(0,1) + b*m(1,1) + c*m(2,1);
1546 matx[3][2] = a*m(0,2) + b*m(1,2) + c*m(2,2);
1550 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1557 const v4uf m0(m(0));
1558 const v4uf m1(m(1));
1559 const v4uf m2(m(2,0), m(2,1), m(2,2), 0);
1561 for (
int i = 0; i < 4; ++i)
1574 template <>
inline void
1578 for (
int i = 0; i < 4; ++i)
1589 template <
typename T>
1594 a = matx[0][0]; b = matx[1][0]; c = matx[2][0]; d = matx[3][0];
1595 matx[0][0] = a*m(0,0) + b*m(0,1) + c*m(0,2) + d*m(0,3);
1596 matx[1][0] = a*m(1,0) + b*m(1,1) + c*m(1,2) + d*m(1,3);
1597 matx[2][0] = a*m(2,0) + b*m(2,1) + c*m(2,2) + d*m(2,3);
1598 matx[3][0] = a*m(3,0) + b*m(3,1) + c*m(3,2) + d*m(3,3);
1600 a = matx[0][1]; b = matx[1][1]; c = matx[2][1]; d = matx[3][1];
1601 matx[0][1] = a*m(0,0) + b*m(0,1) + c*m(0,2) + d*m(0,3);
1602 matx[1][1] = a*m(1,0) + b*m(1,1) + c*m(1,2) + d*m(1,3);
1603 matx[2][1] = a*m(2,0) + b*m(2,1) + c*m(2,2) + d*m(2,3);
1604 matx[3][1] = a*m(3,0) + b*m(3,1) + c*m(3,2) + d*m(3,3);
1606 a = matx[0][2]; b = matx[1][2]; c = matx[2][2]; d = matx[3][2];
1607 matx[0][2] = a*m(0,0) + b*m(0,1) + c*m(0,2) + d*m(0,3);
1608 matx[1][2] = a*m(1,0) + b*m(1,1) + c*m(1,2) + d*m(1,3);
1609 matx[2][2] = a*m(2,0) + b*m(2,1) + c*m(2,2) + d*m(2,3);
1610 matx[3][2] = a*m(3,0) + b*m(3,1) + c*m(3,2) + d*m(3,3);
1612 a = matx[0][3]; b = matx[1][3]; c = matx[2][3]; d = matx[3][3];
1613 matx[0][3] = a*m(0,0) + b*m(0,1) + c*m(0,2) + d*m(0,3);
1614 matx[1][3] = a*m(1,0) + b*m(1,1) + c*m(1,2) + d*m(1,3);
1615 matx[2][3] = a*m(2,0) + b*m(2,1) + c*m(2,2) + d*m(2,3);
1616 matx[3][3] = a*m(3,0) + b*m(3,1) + c*m(3,2) + d*m(3,3);
1619 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1629 for (
int i = 0; i < 4; ++i)
1642 template <
typename T>
1647 m[0][0] = m1(0,0)+m2(0,0); m[0][1] = m1(0,1)+m2(0,1);
1648 m[0][2] = m1(0,2)+m2(0,2); m[0][3] = m1(0,3)+m2(0,3);
1650 m[1][0] = m1(1,0)+m2(1,0); m[1][1] = m1(1,1)+m2(1,1);
1651 m[1][2] = m1(1,2)+m2(1,2); m[1][3] = m1(1,3)+m2(1,3);
1653 m[2][0] = m1(2,0)+m2(2,0); m[2][1] = m1(2,1)+m2(2,1);
1654 m[2][2] = m1(2,2)+m2(2,2); m[2][3] = m1(2,3)+m2(2,3);
1656 m[3][0] = m1(3,0)+m2(3,0); m[3][1] = m1(3,1)+m2(3,1);
1657 m[3][2] = m1(3,2)+m2(3,2); m[3][3] = m1(3,3)+m2(3,3);
1660 template <
typename T>
1665 m[0][0] = m1(0,0)-m2(0,0); m[0][1] = m1(0,1)-m2(0,1);
1666 m[0][2] = m1(0,2)-m2(0,2); m[0][3] = m1(0,3)-m2(0,3);
1668 m[1][0] = m1(1,0)-m2(1,0); m[1][1] = m1(1,1)-m2(1,1);
1669 m[1][2] = m1(1,2)-m2(1,2); m[1][3] = m1(1,3)-m2(1,3);
1671 m[2][0] = m1(2,0)-m2(2,0); m[2][1] = m1(2,1)-m2(2,1);
1672 m[2][2] = m1(2,2)-m2(2,2); m[2][3] = m1(2,3)-m2(2,3);
1674 m[3][0] = m1(3,0)-m2(3,0); m[3][1] = m1(3,1)-m2(3,1);
1675 m[3][2] = m1(3,2)-m2(3,2); m[3][3] = m1(3,3)-m2(3,3);
1678 template <
typename T>
1683 m[0][0] = m1(0,0)*m2(0,0) + m1(0,1)*m2(1,0) +
1684 m1(0,2)*m2(2,0) + m1(0,3)*m2(3,0) ;
1685 m[0][1] = m1(0,0)*m2(0,1) + m1(0,1)*m2(1,1) +
1686 m1(0,2)*m2(2,1) + m1(0,3)*m2(3,1) ;
1687 m[0][2] = m1(0,0)*m2(0,2) + m1(0,1)*m2(1,2) +
1688 m1(0,2)*m2(2,2) + m1(0,3)*m2(3,2) ;
1689 m[0][3] = m1(0,0)*m2(0,3) + m1(0,1)*m2(1,3) +
1690 m1(0,2)*m2(2,3) + m1(0,3)*m2(3,3) ;
1692 m[1][0] = m1(1,0)*m2(0,0) + m1(1,1)*m2(1,0) +
1693 m1(1,2)*m2(2,0) + m1(1,3)*m2(3,0) ;
1694 m[1][1] = m1(1,0)*m2(0,1) + m1(1,1)*m2(1,1) +
1695 m1(1,2)*m2(2,1) + m1(1,3)*m2(3,1) ;
1696 m[1][2] = m1(1,0)*m2(0,2) + m1(1,1)*m2(1,2) +
1697 m1(1,2)*m2(2,2) + m1(1,3)*m2(3,2) ;
1698 m[1][3] = m1(1,0)*m2(0,3) + m1(1,1)*m2(1,3) +
1699 m1(1,2)*m2(2,3) + m1(1,3)*m2(3,3) ;
1701 m[2][0] = m1(2,0)*m2(0,0) + m1(2,1)*m2(1,0) +
1702 m1(2,2)*m2(2,0) + m1(2,3)*m2(3,0) ;
1703 m[2][1] = m1(2,0)*m2(0,1) + m1(2,1)*m2(1,1) +
1704 m1(2,2)*m2(2,1) + m1(2,3)*m2(3,1) ;
1705 m[2][2] = m1(2,0)*m2(0,2) + m1(2,1)*m2(1,2) +
1706 m1(2,2)*m2(2,2) + m1(2,3)*m2(3,2) ;
1707 m[2][3] = m1(2,0)*m2(0,3) + m1(2,1)*m2(1,3) +
1708 m1(2,2)*m2(2,3) + m1(2,3)*m2(3,3) ;
1710 m[3][0] = m1(3,0)*m2(0,0) + m1(3,1)*m2(1,0) +
1711 m1(3,2)*m2(2,0) + m1(3,3)*m2(3,0) ;
1712 m[3][1] = m1(3,0)*m2(0,1) + m1(3,1)*m2(1,1) +
1713 m1(3,2)*m2(2,1) + m1(3,3)*m2(3,1) ;
1714 m[3][2] = m1(3,0)*m2(0,2) + m1(3,1)*m2(1,2) +
1715 m1(3,2)*m2(2,2) + m1(3,3)*m2(3,2) ;
1716 m[3][3] = m1(3,0)*m2(0,3) + m1(3,1)*m2(1,3) +
1717 m1(3,2)*m2(2,3) + m1(3,3)*m2(3,3) ;
1720 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1732 for (
int i = 0; i < 4; ++i)
1745 template <
typename T,
typename S>
1751 m[0][0] = m1(0,0) +
x; m[0][1] = m1(0,1) +
x;
1752 m[0][2] = m1(0,2) +
x; m[0][3] = m1(0,3) +
x;
1754 m[1][0] = m1(1,0) +
y; m[1][1] = m1(1,1) +
y;
1755 m[1][2] = m1(1,2) +
y; m[1][3] = m1(1,3) +
y;
1757 m[2][0] = m1(2,0) +
z; m[2][1] = m1(2,1) +
z;
1758 m[2][2] = m1(2,2) +
z; m[2][3] = m1(2,3) +
z;
1760 m[3][0] = m1(3,0) +
w; m[3][1] = m1(3,1) +
w;
1761 m[3][2] = m1(3,2) +
w; m[3][3] = m1(3,3) +
w;
1765 template <
typename T,
typename S>
1772 template <
typename T,
typename S>
1778 m[0][0] = m1(0,0) -
x; m[0][1] = m1(0,1) -
x;
1779 m[0][2] = m1(0,2) -
x; m[0][3] = m1(0,3) -
x;
1781 m[1][0] = m1(1,0) -
y; m[1][1] = m1(1,1) -
y;
1782 m[1][2] = m1(1,2) -
y; m[1][3] = m1(1,3) -
y;
1784 m[2][0] = m1(2,0) -
z; m[2][1] = m1(2,1) -
z;
1785 m[2][2] = m1(2,2) -
z; m[2][3] = m1(2,3) -
z;
1787 m[3][0] = m1(3,0) -
w; m[3][1] = m1(3,1) -
w;
1788 m[3][2] = m1(3,2) -
w; m[3][3] = m1(3,3) -
w;
1792 template <
typename T,
typename S>
1798 m[0][0] = x - m1(0,0); m[0][1] = x - m1(0,1);
1799 m[0][2] = x - m1(0,2); m[0][3] = x - m1(0,3);
1801 m[1][0] = y - m1(1,0); m[1][1] = y - m1(1,1);
1802 m[1][2] = y - m1(1,2); m[1][3] = y - m1(1,3);
1804 m[2][0] = z - m1(2,0); m[2][1] = z - m1(2,1);
1805 m[2][2] = z - m1(2,2); m[2][3] = z - m1(2,3);
1807 m[3][0] = w - m1(3,0); m[3][1] = w - m1(3,1);
1808 m[3][2] = w - m1(3,2); m[3][3] = w - m1(3,3);
1812 template <
typename T,
typename S>
1817 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;
1818 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;
1819 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;
1820 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;
1824 template <
typename T,
typename S>
1829 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);
1830 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);
1831 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);
1832 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);
1836 template <
typename T,
typename S>
1843 template <
typename T,
typename S>
1848 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;
1849 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;
1850 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;
1851 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;
1855 template <
typename T,
typename S>
1860 return (m1 * (
T(1.0)/scalar));
1863 template <
typename T,
typename S>
1868 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);
1869 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);
1870 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);
1871 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);
1894 template <
typename T,
typename S>
1896 template <
typename T,
typename S>
1899 template <
typename T,
typename S>
1901 template <
typename T,
typename S>
1905 template <
typename T,
typename S>
1910 v.
x()*m(0,0) + v.
y()*m(1,0) + v.
z()*m(2,0) + m(3,0),
1911 v.
x()*m(0,1) + v.
y()*m(1,1) + v.
z()*m(2,1) + m(3,1),
1912 v.
x()*m(0,2) + v.
y()*m(1,2) + v.
z()*m(2,2) + m(3,2)
1915 template <
typename T,
typename S>
1922 template <
typename T,
typename S>
1927 v.
x()*m(0,0) + v.
y()*m(1,0) + v.
z()*m(2,0),
1928 v.
x()*m(0,1) + v.
y()*m(1,1) + v.
z()*m(2,1),
1929 v.
x()*m(0,2) + v.
y()*m(1,2) + v.
z()*m(2,2)
1933 template <
typename T,
typename S>
1938 v.
x()*m(0,0) + v.
y()*m(0,1) + v.
z()*m(0,2) + m(0,3),
1939 v.
x()*m(1,0) + v.
y()*m(1,1) + v.
z()*m(1,2) + m(1,3),
1940 v.
x()*m(2,0) + v.
y()*m(2,1) + v.
z()*m(2,2) + m(2,3)
1944 template <
typename T,
typename S>
1949 v.
x()*m(0,0) + v.
y()*m(0,1) + v.
z()*m(0,2),
1950 v.
x()*m(1,0) + v.
y()*m(1,1) + v.
z()*m(1,2),
1951 v.
x()*m(2,0) + v.
y()*m(2,1) + v.
z()*m(2,2)
1954 #ifndef UT_DISABLE_VECTORIZE_MATRIX
1985 v4uf(m(0,0), m(1,0), m(2,0), m(3,0)) *
v4uf(v[0])
1986 +
v4uf(m(0,1), m(1,1), m(2,1), m(3,1)) *
v4uf(v[1])
1987 +
v4uf(m(0,2), m(1,2), m(2,2), m(3,2)) *
v4uf(v[2])
1988 +
v4uf(m(0,3), m(1,3), m(2,3), m(3,3));
1998 v4uf(m(0,0), m(1,0), m(2,0), m(3,0)) *
v4uf(v[0])
1999 +
v4uf(m(0,1), m(1,1), m(2,1), m(3,1)) *
v4uf(v[1])
2000 +
v4uf(m(0,2), m(1,2), m(2,2), m(3,2)) *
v4uf(v[2]);
2008 template <
typename T>
2014 template <
typename T>
2020 template <
typename T>
2026 template <
typename T>
2032 template <
typename T>
2038 template <
typename T>
2044 template <
typename T>
2050 template <
typename T>
2056 template <
typename T>
2057 template <
typename S>
2064 template <
typename T>
2065 template <
typename S>
2071 template <
typename T>
2072 template <
typename S>
2078 template <
typename T>
2079 template <
typename S>
2085 template <
typename T>
2086 template <
typename S>
2092 template <
typename T>
2093 template <
typename S>
2100 template <
typename T>
2106 template <
typename T>
2130 template <
typename T>
2154 template <
typename T,
typename S>
2177 #ifndef UT_DISABLE_VECTORIZE_MATRIX
2183 for (
int i = 0; i < 4; ++i)
2194 template<
typename T, ex
int D >
2197 template<
typename T>
2207 template <
typename T>
2214 template <
typename T>
2217 template<
typename TS >
2221 as[ 0], as[ 1], as[ 2], as[ 3],
2222 as[ 4], as[ 5], as[ 6], as[ 7],
2223 as[ 8], as[ 9], as[10], as[11],
2224 as[12], as[13], as[14], as[15]
2232 template <
typename V >
2236 template <
typename T>
2243 template <
typename T>
2246 template<
typename TS >
2258 template<
typename TS >
2270 template <
typename V >
2274 template <
typename T>
2277 template <
typename T>
template<
int ORDER>
2284 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2285 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2286 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2291 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2292 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2293 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2298 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2299 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2300 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2305 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2306 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2307 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2312 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2313 if(rx) rotate<UT_Axis3::XAXIS>(rx);
2314 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2319 if(rz) rotate<UT_Axis3::ZAXIS>(rz);
2320 if(ry) rotate<UT_Axis3::YAXIS>(ry);
2321 if(rx) rotate<UT_Axis3::XAXIS>(rx);
void shear(T s_xy, T s_xz, T s_yz)
bool SYSisEqual(const UT_Vector2T< T > &a, const UT_Vector2T< T > &b, S tol)
Componentwise equality.
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)
SYS_FORCE_INLINE UT_Matrix4T< T > & operator*=(T scalar)
UT_FromUnbounded creates a V from an unbounded array-like type.
MatType shear(Axis axis0, Axis axis1, typename MatType::value_type shear)
Set the matrix to a shear along axis0 by a fraction of axis1.
SYS_FORCE_INLINE void prerotateQuarter()
SYS_FORCE_INLINE void multiply3T(const UT_Matrix4T< S > &mat)
constexpr SYS_FORCE_INLINE T & y() noexcept
SYS_FORCE_INLINE void colVecMult(const UT_Matrix3F &m)
T * data()
Return the raw matrix data.
SYS_FORCE_INLINE T operator()(unsigned row, unsigned col) const
Return a matrix entry. No bounds checking on subscripts.
SYS_FORCE_INLINE T coFactor(int k, int l) const
Mat3< typename promote< T0, T1 >::type > operator+(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Add corresponding elements of m0 and m1 and return the result.
UT_FixedVector< T, 16 > FixedVectorType
PivotSpaceT()
Constructor with default values for data members.
const GLuint GLenum const void * binary
SYS_FORCE_INLINE T & operator()(unsigned row, unsigned col)
Return a matrix entry. No bounds checking on subscripts.
SYS_FORCE_INLINE void rotateQuarter()
UT_API size_t UTformatBuffer(char *buffer, size_t buffer_size, const UT_Matrix4T< T > &v)
GA_API const UT_StringHolder rot
vfloat4 sqrt(const vfloat4 &a)
GLdouble GLdouble GLdouble z
typename SYS_FixedArrayElement< T >::type SYS_FixedArrayElement_t
UT_Matrix4T< T > & operator=(const UT_Matrix4T< S > &m)
constexpr SYS_FORCE_INLINE T & z() noexcept
SYS_FORCE_INLINE void prerotate(const UT_Vector3T< T > &rad, const UT_XformOrder &ord)
GLboolean GLboolean GLboolean GLboolean a
PUGI__FN void reverse(I begin, I end)
bool isEqual(const UT_Matrix4T< T > &m, T tolerance=T(SYS_FTOLERANCE)) const
JSON reader class which handles parsing of JSON or bJSON files.
SYS_FORCE_INLINE void prescale(const UT_Vector3T< T > &s)
Class which writes ASCII or binary JSON streams.
**But if you need a result
static const exint TupleSize
GLfloat GLfloat GLfloat v2
GLdouble GLdouble GLdouble q
constexpr SYS_FORCE_INLINE UT_Vector3T & operator*=(const T &a) noexcept
SYS_FORCE_INLINE void shear(const UT_Vector3T< T > &sh)
UT_Vector3T< S > myTranslate
constexpr SYS_FORCE_INLINE T & x() noexcept
Define parameters for Houdini's pivot space.
UT_Matrix4T< T > SYSmin(const UT_Matrix4T< T > &v1, const UT_Matrix4T< T > &v2)
UT_Matrix4T< T > SYSbilerp(const UT_Matrix4T< T > &u0v0, const UT_Matrix4T< T > &u1v0, const UT_Matrix4T< T > &u0v1, const UT_Matrix4T< T > &u1v1, S u, S v)
Bilinear interpolation.
SYS_FORCE_INLINE void rotateHalf()
PivotSpaceT< T > PivotSpace
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
GA_API const UT_StringHolder scale
static int entries()
Returns the vector size.
GLint GLint GLsizei GLint GLenum GLenum type
void instanceInverse(const UT_Vector3F &p, const UT_Vector3F &v, T s, const UT_Vector3F *s3, const UT_Vector3F *up, const UT_QuaternionF *q, const UT_Vector3F *tr, const UT_QuaternionF *orient, const UT_Vector3F *pivot=NULL)
SYS_FORCE_INLINE UT_Matrix4T< T > & operator+=(const UT_Matrix4T< T > &m)
UT_Matrix4T< T > & operator=(const UT_Matrix3T< S > &m)
SYS_FORCE_INLINE UT_Matrix4T< T > & operator/=(T scalar)
Mat3< typename promote< T0, T1 >::type > operator-(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Subtract corresponding elements of m0 and m1 and return the result.
constexpr SYS_FORCE_INLINE T & z() noexcept
bool operator==(const UT_Matrix4T< T > &m) const
UT_Matrix4T< T > SYSbarycentric(const UT_Matrix4T< T > &v0, const UT_Matrix4T< T > &v1, const UT_Matrix4T< T > &v2, S u, S v)
Barycentric interpolation.
void rotate(UT_Vector3T< S > &axis, T theta, int norm=1)
int explode(const UT_XformOrder &order, UT_Vector3F &r, UT_Vector3F &s, UT_Vector3F &t, const UT_Vector3F &p, UT_Vector3F *shears=0) const
UT_Matrix4T< T > transpose() const
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
static const bool isVectorType
int explode(const UT_XformOrder &order, UT_Vector3F &r, UT_Vector3F &s, UT_Vector3F &t, UT_Vector3F *shears=0) const
UT_Vector3T< T > rowVecMult(const UT_Vector3T< T > &v, const UT_Matrix4T< S > &m)
T determinant3() const
Compute determinant of the upper-left 3x3 sub-matrix.
SYS_FORCE_INLINE void pretranslate(const UT_Vector3T< T > &delta)
void prescale(T sx, T sy, T sz, T sw=1)
SYS_FORCE_INLINE UT_Matrix4T< T > & operator-=(const UT_Matrix4T< T > &m)
constexpr UT_Matrix4T< SYS_FixedArrayElement_t< TS > > UTmakeMatrix4T(const TS &as) noexcept
SYS_FORCE_INLINE void rowVecMult(const UT_Matrix3F &m)
UT_Vector3T< T > colVecMult(const UT_Matrix4T< S > &m, const UT_Vector3T< T > &v)
GLdouble GLdouble GLint GLint order
void instance(const UT_Vector3F &p, const UT_Vector3F &v, T s, const UT_Vector3F *s3, const UT_Vector3F *up, const UT_QuaternionF *q, const UT_Vector3F *tr, const UT_QuaternionF *orient, const UT_Vector3F *pivot=NULL)
SYS_FORCE_INLINE void rowVecMult3(const UT_Matrix4F &m)
void identity()
Set the matrix to identity.
constexpr SYS_FORCE_INLINE UT_Matrix4T< T > operator()(const TS &as) const noexcept
UT_Matrix4T< T > SYSmax(const UT_Matrix4T< T > &v1, const UT_Matrix4T< T > &v2)
GLboolean GLboolean GLboolean b
UT_Vector3T< T > colVecMult3(const UT_Matrix4T< S > &m, const UT_Vector3T< T > &v)
SYS_FORCE_INLINE void translate(const UT_Vector3T< T > &delta)
ImageBuf OIIO_API rotate(const ImageBuf &src, float angle, string_view filtername=string_view(), float filterwidth=0.0f, bool recompute_roi=false, ROI roi={}, int nthreads=0)
void lerp(const UT_Matrix4T< T > &a, const UT_Matrix4T< T > &b, T t)
void instanceInverse(const UT_Vector3D &p, const UT_Vector3D &v, T s, const UT_Vector3D *s3, const UT_Vector3D *up, const UT_QuaternionD *q, const UT_Vector3D *tr, const UT_QuaternionD *orient, const UT_Vector3D *pivot=NULL)
GA_API const UT_StringHolder orient
IMATH_HOSTDEVICE const Vec2< S > & operator*=(Vec2< S > &v, const Matrix22< T > &m) IMATH_NOEXCEPT
Vector-matrix multiplication: v *= m.
SYS_FORCE_INLINE const T * operator()(unsigned row) const
Return a matrix row. No bounds checking on subscript.
void setTranslates(const UT_Vector3T< S > &translates)
SYS_FORCE_INLINE void scale(const UT_Vector3T< T > &s)
UT_Vector3T< S > myRotate
void scale(T sx, T sy, T sz, T sw=1)
__hostdev__ uint64_t last(uint32_t i) const
T dot(unsigned i, unsigned j) const
int explode(const UT_XformOrder &order, UT_Vector3D &r, UT_Vector3D &s, UT_Vector3D &t, const PivotSpaceT< fpreal64 > &p, UT_Vector3D *shears=0) const
GA_API const UT_StringHolder parms
SYS_FORCE_INLINE T * operator()(unsigned row)
Return a matrix row. No bounds checking on subscript.
UT_Matrix4T< T > operator-() const
const T * data() const
Return the raw matrix data.
UT_Matrix4T< T > SYSlerp(const UT_Matrix4T< T > &v1, const UT_Matrix4T< T > &v2, S t)
void translate(T dx, T dy, T dz=0)
UT_Vector3T< T > rowVecMult3(const UT_Vector3T< T > &v, const UT_Matrix4T< S > &m)
SYS_FORCE_INLINE void scale(T s)
T getEuclideanNorm() const
bool isSymmetric(const MatType &m)
Determine if a matrix is symmetric.
LeafData & operator=(const LeafData &)=delete
constexpr UT_Matrix4T(fpreal64 val) noexcept
Construct identity matrix, multipled by scalar.
void zero()
Set the matrix to zero.
constexpr SYS_FORCE_INLINE T & w() noexcept
UT_Matrix4T< T > & operator=(const UT_SymMatrix4T< S > &m)
Conversion from a symmetric to a non symmetric matrix.
GA_API const UT_StringHolder pivot
U UT_Matrix4T(const UT_Matrix3T< S > &m, const UT_Vector3T< U > &t)
int explode(const UT_XformOrder &order, UT_Vector3F &r, UT_Vector3F &s, UT_Vector3F &t, const PivotSpaceT< fpreal32 > &p, UT_Vector3F *shears=0) const
SYS_FORCE_INLINE void rotateWithQTurns(T theta, uint qturns)
Class to store JSON objects as C++ objects.
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
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