10 #ifndef INCLUDED_IMATHMATRIX_H
11 #define INCLUDED_IMATHMATRIX_H
27 #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER
29 # pragma warning(disable : 4290)
32 IMATH_INTERNAL_NAMESPACE_HEADER_ENTER
106 ~
Matrix22() IMATH_NOEXCEPT = default;
110 #if IMATH_FOREIGN_VECTOR_INTEROP
127 :
Matrix22(
T(m[0][0]),
T(m[0][1]),
T(m[1][0]),
T(m[1][1]))
133 *
this =
Matrix22(
T(m[0][0]),
T(m[0][1]),
T(m[1][0]),
T(m[1][1]));
255 IMATH_CONSTEXPR14
Matrix22<
T> inverse (
bool singExc) const;
290 IMATH_HOSTDEVICE constexpr static
T baseTypeLowest() IMATH_NOEXCEPT {
return std::numeric_limits<T>::lowest(); }
379 ~
Matrix33() IMATH_NOEXCEPT = default;
383 #if IMATH_FOREIGN_VECTOR_INTEROP
401 T(m[1][0]),
T(m[1][1]),
T(m[1][2]),
402 T(m[2][0]),
T(m[2][1]),
T(m[2][2]))
410 *
this =
Matrix33(
T(m[0][0]),
T(m[0][1]),
T(m[0][2]),
411 T(m[1][0]),
T(m[1][1]),
T(m[1][2]),
412 T(m[2][0]),
T(m[2][1]),
T(m[2][2]));
542 IMATH_CONSTEXPR14
Matrix33<
T> inverse (
bool singExc) const;
551 const
Matrix33& gjInvert (
bool singExc);
560 Matrix33<
T> gjInverse (
bool singExc) const;
567 IMATH_HOSTDEVICE IMATH_CONSTEXPR14
T minorOf (const
int r, const
int c) const IMATH_NOEXCEPT;
571 constexpr
T fastMinor (const
int r0, const
int r1, const
int c0, const
int c1) const IMATH_NOEXCEPT;
635 IMATH_HOSTDEVICE constexpr static
T baseTypeLowest() IMATH_NOEXCEPT {
return std::numeric_limits<T>::lowest(); }
713 Matrix44 (
T a,
T b,
T c,
T d,
T e,
T f,
T g,
T h,
T i,
T j,
T k,
T l,
T m,
T n,
T o,
T p) IMATH_NOEXCEPT;
736 ~
Matrix44() IMATH_NOEXCEPT = default;
740 #if IMATH_FOREIGN_VECTOR_INTEROP
757 :
Matrix44(
T(m[0][0]),
T(m[0][1]),
T(m[0][2]),
T(m[0][3]),
758 T(m[1][0]),
T(m[1][1]),
T(m[1][2]),
T(m[1][3]),
759 T(m[2][0]),
T(m[2][1]),
T(m[2][2]),
T(m[2][3]),
760 T(m[3][0]),
T(m[3][1]),
T(m[3][2]),
T(m[3][3]))
768 *
this =
Matrix44(
T(m[0][0]),
T(m[0][1]),
T(m[0][2]),
T(m[0][3]),
769 T(m[1][0]),
T(m[1][1]),
T(m[1][2]),
T(m[1][3]),
770 T(m[2][0]),
T(m[2][1]),
T(m[2][2]),
T(m[2][3]),
771 T(m[3][0]),
T(m[3][1]),
T(m[3][2]),
T(m[3][3]));
911 IMATH_CONSTEXPR14
Matrix44<
T> inverse (
bool singExc) const;
920 IMATH_CONSTEXPR14 const
Matrix44& gjInvert (
bool singExc);
929 Matrix44<
T> gjInverse (
bool singExc) const;
936 IMATH_HOSTDEVICE IMATH_CONSTEXPR14
T minorOf (const
int r, const
int c) const IMATH_NOEXCEPT;
940 constexpr
T fastMinor (const
int r0,
945 const
int c2) const IMATH_NOEXCEPT;
1034 IMATH_HOSTDEVICE constexpr static
T baseTypeLowest() IMATH_NOEXCEPT {
return std::numeric_limits<T>::lowest(); }
1060 template <
class T> std::ostream& operator<< (std::ostream& s, const Matrix22<T>& m);
1066 template <
class T> std::ostream& operator<< (std::ostream& s, const Matrix33<T>& m);
1074 template <
class T> std::ostream& operator<< (std::ostream& s, const Matrix44<T>& m);
1081 template <
class S,
class T>
1085 template <
class S,
class T>
1089 template <
class S,
class T>
1093 template <
class S,
class T>
1097 template <
class S,
class T>
1101 template <
class S,
class T>
1105 template <
class S,
class T>
1109 template <
class S,
class T>
1113 template <
class S,
class T>
1117 template <
class S,
class T>
1202 x[0][0] =
v.x[0][0];
1203 x[0][1] =
v.x[0][1];
1204 x[1][0] =
v.x[1][0];
1205 x[1][1] =
v.x[1][1];
1212 x[0][0] =
T (
v.x[0][0]);
1213 x[0][1] =
T (
v.x[0][1]);
1214 x[1][0] =
T (
v.x[1][0]);
1215 x[1][1] =
T (
v.x[1][1]);
1226 x[0][0] =
v.
x[0][0];
1227 x[0][1] =
v.x[0][1];
1228 x[1][0] =
v.x[1][0];
1229 x[1][1] =
v.x[1][1];
1248 return (
T*) &
x[0][0];
1255 return (
const T*) &
x[0][0];
1263 v.x[0][0] =
x[0][0];
1264 v.x[0][1] =
x[0][1];
1265 v.x[1][0] =
x[1][0];
1266 v.x[1][1] =
x[1][1];
1274 x[0][0] =
v.
x[0][0];
1275 x[0][1] =
v.x[0][1];
1276 x[1][0] =
v.x[1][0];
1277 x[1][1] =
v.x[1][1];
1286 x[0][0] =
v.
x[0][0];
1287 x[0][1] =
v.x[0][1];
1288 x[1][0] =
v.x[1][0];
1289 x[1][1] =
v.x[1][1];
1307 return x[0][0] ==
v.x[0][0] &&
x[0][1] ==
v.x[0][1] &&
x[1][0] ==
v.x[1][0] &&
1308 x[1][1] ==
v.x[1][1];
1315 return x[0][0] !=
v.x[0][0] ||
x[0][1] !=
v.x[0][1] ||
x[1][0] !=
v.x[1][0] ||
1316 x[1][1] !=
v.x[1][1];
1323 for (
int i = 0; i < 2; i++)
1324 for (
int j = 0; j < 2; j++)
1335 for (
int i = 0; i < 2; i++)
1336 for (
int j = 0; j < 2; j++)
1347 x[0][0] +=
v.
x[0][0];
1348 x[0][1] +=
v.x[0][1];
1349 x[1][0] +=
v.x[1][0];
1350 x[1][1] +=
v.x[1][1];
1372 x[0][1] +
v.x[0][1],
1373 x[1][0] +
v.x[1][0],
1374 x[1][1] +
v.x[1][1]);
1381 x[0][0] -=
v.
x[0][0];
1382 x[0][1] -=
v.x[0][1];
1383 x[1][0] -=
v.x[1][0];
1384 x[1][1] -=
v.x[1][1];
1406 x[0][1] -
v.x[0][1],
1407 x[1][0] -
v.x[1][0],
1408 x[1][1] -
v.x[1][1]);
1415 return Matrix22 (-
x[0][0], -
x[0][1], -
x[1][0], -
x[1][1]);
1446 return Matrix22 (
x[0][0] * a,
x[0][1] * a,
x[1][0] * a,
x[1][1] * a);
1463 for (
int i = 0; i < 2; i++)
1464 for (
int j = 0; j < 2; j++)
1465 for (
int k = 0; k < 2; k++)
1466 tmp.
x[i][j] +=
x[i][k] *
v.x[k][j];
1478 for (
int i = 0; i < 2; i++)
1479 for (
int j = 0; j < 2; j++)
1480 for (
int k = 0; k < 2; k++)
1481 tmp.
x[i][j] +=
x[i][k] *
v.x[k][j];
1493 a =
src.x *
x[0][0] +
src.y *
x[1][0];
1494 b =
src.x *
x[0][1] +
src.y *
x[1][1];
1516 return Matrix22 (
x[0][0] / a,
x[0][1] / a,
x[1][0] / a,
x[1][1] / a);
1539 *
this = inverse (singExc);
1557 T r =
x[0][0] *
x[1][1] -
x[1][0] *
x[0][1];
1561 for (
int i = 0; i < 2; ++i)
1563 for (
int j = 0; j < 2; ++
j)
1573 for (
int i = 0; i < 2; ++i)
1575 for (
int j = 0; j < 2; ++
j)
1584 throw std::invalid_argument (
"Cannot invert "
1585 "singular matrix.");
1600 T r =
x[0][0] *
x[1][1] -
x[1][0] *
x[0][1];
1604 for (
int i = 0; i < 2; ++i)
1606 for (
int j = 0; j < 2; ++
j)
1616 for (
int i = 0; i < 2; ++i)
1618 for (
int j = 0; j < 2; ++
j)
1638 return x[0][0] *
x[1][1] -
x[1][0] *
x[0][1];
1648 cos_r =
cos ((
T) r);
1649 sin_r =
sin ((
T) r);
1680 x[0][1] =
static_cast<T> (0);
1681 x[1][0] =
static_cast<T> (0);
1699 x[0][1] =
static_cast<T> (0);
1700 x[1][0] =
static_cast<T> (0);
1804 x[0][0] =
v.x[0][0];
1805 x[0][1] =
v.x[0][1];
1806 x[0][2] =
v.x[0][2];
1807 x[1][0] =
v.x[1][0];
1808 x[1][1] =
v.x[1][1];
1809 x[1][2] =
v.x[1][2];
1810 x[2][0] =
v.x[2][0];
1811 x[2][1] =
v.x[2][1];
1812 x[2][2] =
v.x[2][2];
1819 x[0][0] =
T (
v.x[0][0]);
1820 x[0][1] =
T (
v.x[0][1]);
1821 x[0][2] =
T (
v.x[0][2]);
1822 x[1][0] =
T (
v.x[1][0]);
1823 x[1][1] =
T (
v.x[1][1]);
1824 x[1][2] =
T (
v.x[1][2]);
1825 x[2][0] =
T (
v.x[2][0]);
1826 x[2][1] =
T (
v.x[2][1]);
1827 x[2][2] =
T (
v.x[2][2]);
1838 x[0][0] =
v.
x[0][0];
1839 x[0][1] =
v.x[0][1];
1840 x[0][2] =
v.x[0][2];
1841 x[1][0] =
v.x[1][0];
1842 x[1][1] =
v.x[1][1];
1843 x[1][2] =
v.x[1][2];
1844 x[2][0] =
v.x[2][0];
1845 x[2][1] =
v.x[2][1];
1846 x[2][2] =
v.x[2][2];
1870 return (
T*) &
x[0][0];
1877 return (
const T*) &
x[0][0];
1885 v.x[0][0] =
x[0][0];
1886 v.x[0][1] =
x[0][1];
1887 v.x[0][2] =
x[0][2];
1888 v.x[1][0] =
x[1][0];
1889 v.x[1][1] =
x[1][1];
1890 v.x[1][2] =
x[1][2];
1891 v.x[2][0] =
x[2][0];
1892 v.x[2][1] =
x[2][1];
1893 v.x[2][2] =
x[2][2];
1901 x[0][0] =
v.
x[0][0];
1902 x[0][1] =
v.x[0][1];
1903 x[0][2] =
v.x[0][2];
1904 x[1][0] =
v.x[1][0];
1905 x[1][1] =
v.x[1][1];
1906 x[1][2] =
v.x[1][2];
1907 x[2][0] =
v.x[2][0];
1908 x[2][1] =
v.x[2][1];
1909 x[2][2] =
v.x[2][2];
1918 x[0][0] =
v.
x[0][0];
1919 x[0][1] =
v.x[0][1];
1920 x[0][2] =
v.x[0][2];
1921 x[1][0] =
v.x[1][0];
1922 x[1][1] =
v.x[1][1];
1923 x[1][2] =
v.x[1][2];
1924 x[2][0] =
v.x[2][0];
1925 x[2][1] =
v.x[2][1];
1926 x[2][2] =
v.x[2][2];
1949 return x[0][0] ==
v.x[0][0] &&
x[0][1] ==
v.x[0][1] &&
x[0][2] ==
v.x[0][2] &&
1950 x[1][0] ==
v.x[1][0] &&
x[1][1] ==
v.x[1][1] &&
x[1][2] ==
v.x[1][2] &&
1951 x[2][0] ==
v.x[2][0] &&
x[2][1] ==
v.x[2][1] &&
x[2][2] ==
v.x[2][2];
1958 return x[0][0] !=
v.x[0][0] ||
x[0][1] !=
v.x[0][1] ||
x[0][2] !=
v.x[0][2] ||
1959 x[1][0] !=
v.x[1][0] ||
x[1][1] !=
v.x[1][1] ||
x[1][2] !=
v.x[1][2] ||
1960 x[2][0] !=
v.x[2][0] ||
x[2][1] !=
v.x[2][1] ||
x[2][2] !=
v.x[2][2];
1967 for (
int i = 0; i < 3; i++)
1968 for (
int j = 0; j < 3; j++)
1979 for (
int i = 0; i < 3; i++)
1980 for (
int j = 0; j < 3; j++)
1991 x[0][0] +=
v.
x[0][0];
1992 x[0][1] +=
v.x[0][1];
1993 x[0][2] +=
v.x[0][2];
1994 x[1][0] +=
v.x[1][0];
1995 x[1][1] +=
v.x[1][1];
1996 x[1][2] +=
v.x[1][2];
1997 x[2][0] +=
v.x[2][0];
1998 x[2][1] +=
v.x[2][1];
1999 x[2][2] +=
v.x[2][2];
2026 x[0][1] +
v.x[0][1],
2027 x[0][2] +
v.x[0][2],
2028 x[1][0] +
v.x[1][0],
2029 x[1][1] +
v.x[1][1],
2030 x[1][2] +
v.x[1][2],
2031 x[2][0] +
v.x[2][0],
2032 x[2][1] +
v.x[2][1],
2033 x[2][2] +
v.x[2][2]);
2040 x[0][0] -=
v.
x[0][0];
2041 x[0][1] -=
v.x[0][1];
2042 x[0][2] -=
v.x[0][2];
2043 x[1][0] -=
v.x[1][0];
2044 x[1][1] -=
v.x[1][1];
2045 x[1][2] -=
v.x[1][2];
2046 x[2][0] -=
v.x[2][0];
2047 x[2][1] -=
v.x[2][1];
2048 x[2][2] -=
v.x[2][2];
2075 x[0][1] -
v.x[0][1],
2076 x[0][2] -
v.x[0][2],
2077 x[1][0] -
v.x[1][0],
2078 x[1][1] -
v.x[1][1],
2079 x[1][2] -
v.x[1][2],
2080 x[2][0] -
v.x[2][0],
2081 x[2][1] -
v.x[2][1],
2082 x[2][2] -
v.x[2][2]);
2163 Matrix33 tmp(IMATH_INTERNAL_NAMESPACE::UNINITIALIZED);
2165 tmp.
x[0][0] =
x[0][0] *
v.x[0][0] +
x[0][1] *
v.x[1][0] +
x[0][2] *
v.x[2][0];
2166 tmp.
x[0][1] =
x[0][0] *
v.x[0][1] +
x[0][1] *
v.x[1][1] +
x[0][2] *
v.x[2][1];
2167 tmp.
x[0][2] =
x[0][0] *
v.x[0][2] +
x[0][1] *
v.x[1][2] +
x[0][2] *
v.x[2][2];
2169 tmp.
x[1][0] =
x[1][0] *
v.x[0][0] +
x[1][1] *
v.x[1][0] +
x[1][2] *
v.x[2][0];
2170 tmp.
x[1][1] =
x[1][0] *
v.x[0][1] +
x[1][1] *
v.x[1][1] +
x[1][2] *
v.x[2][1];
2171 tmp.
x[1][2] =
x[1][0] *
v.x[0][2] +
x[1][1] *
v.x[1][2] +
x[1][2] *
v.x[2][2];
2173 tmp.
x[2][0] =
x[2][0] *
v.x[0][0] +
x[2][1] *
v.x[1][0] +
x[2][2] *
v.x[2][0];
2174 tmp.
x[2][1] =
x[2][0] *
v.x[0][1] +
x[2][1] *
v.x[1][1] +
x[2][2] *
v.x[2][1];
2175 tmp.
x[2][2] =
x[2][0] *
v.x[0][2] +
x[2][1] *
v.x[1][2] +
x[2][2] *
v.x[2][2];
2187 Matrix33 tmp(IMATH_INTERNAL_NAMESPACE::UNINITIALIZED);
2189 tmp.
x[0][0] =
x[0][0] *
v.x[0][0] +
x[0][1] *
v.x[1][0] +
x[0][2] *
v.x[2][0];
2190 tmp.
x[0][1] =
x[0][0] *
v.x[0][1] +
x[0][1] *
v.x[1][1] +
x[0][2] *
v.x[2][1];
2191 tmp.
x[0][2] =
x[0][0] *
v.x[0][2] +
x[0][1] *
v.x[1][2] +
x[0][2] *
v.x[2][2];
2193 tmp.
x[1][0] =
x[1][0] *
v.x[0][0] +
x[1][1] *
v.x[1][0] +
x[1][2] *
v.x[2][0];
2194 tmp.
x[1][1] =
x[1][0] *
v.x[0][1] +
x[1][1] *
v.x[1][1] +
x[1][2] *
v.x[2][1];
2195 tmp.
x[1][2] =
x[1][0] *
v.x[0][2] +
x[1][1] *
v.x[1][2] +
x[1][2] *
v.x[2][2];
2197 tmp.
x[2][0] =
x[2][0] *
v.x[0][0] +
x[2][1] *
v.x[1][0] +
x[2][2] *
v.x[2][0];
2198 tmp.
x[2][1] =
x[2][0] *
v.x[0][1] +
x[2][1] *
v.x[1][1] +
x[2][2] *
v.x[2][1];
2199 tmp.
x[2][2] =
x[2][0] *
v.x[0][2] +
x[2][1] *
v.x[1][2] +
x[2][2] *
v.x[2][2];
2211 a =
src.x *
x[0][0] +
src.y *
x[1][0] +
x[2][0];
2212 b =
src.x * x[0][1] +
src.y * x[1][1] + x[2][1];
2213 w =
src.x * x[0][2] +
src.y * x[1][2] + x[2][2];
2226 a =
src.x *
x[0][0] +
src.y *
x[1][0];
2227 b =
src.x *
x[0][1] +
src.y *
x[1][1];
2269 Matrix33 tmp (
x[0][0],
x[1][0],
x[2][0],
x[0][1],
x[1][1],
x[2][1],
x[0][2],
x[1][2],
x[2][2]);
2293 *
this = gjInverse (singExc);
2301 *
this = gjInverse();
2315 for (i = 0; i < 2; i++)
2319 T pivotsize = t.
x[i][i];
2322 pivotsize = -pivotsize;
2324 for (j = i + 1; j < 3; j++)
2331 if (tmp > pivotsize)
2341 throw std::invalid_argument (
"Cannot invert singular matrix.");
2348 for (j = 0; j < 3; j++)
2362 for (j = i + 1; j < 3; j++)
2364 T f = t.
x[
j][i] / t.
x[i][i];
2366 for (k = 0; k < 3; k++)
2368 t.
x[
j][k] -= f * t.
x[i][k];
2369 s.
x[
j][k] -= f * s.
x[i][k];
2376 for (i = 2; i >= 0; --i)
2380 if ((f = t[i][i]) == 0)
2383 throw std::invalid_argument (
"Cannot invert singular matrix.");
2388 for (j = 0; j < 3; j++)
2394 for (j = 0; j < i; j++)
2398 for (k = 0; k < 3; k++)
2400 t.
x[
j][k] -= f * t.
x[i][k];
2401 s.
x[
j][k] -= f * s.
x[i][k];
2419 for (i = 0; i < 2; i++)
2423 T pivotsize = t.
x[i][i];
2426 pivotsize = -pivotsize;
2428 for (j = i + 1; j < 3; j++)
2435 if (tmp > pivotsize)
2449 for (j = 0; j < 3; j++)
2463 for (j = i + 1; j < 3; j++)
2465 T f = t.
x[
j][i] / t.
x[i][i];
2467 for (k = 0; k < 3; k++)
2469 t.
x[
j][k] -= f * t.
x[i][k];
2470 s.
x[
j][k] -= f * s.
x[i][k];
2477 for (i = 2; i >= 0; --i)
2481 if ((f = t.
x[i][i]) == 0)
2486 for (j = 0; j < 3; j++)
2492 for (j = 0; j < i; j++)
2496 for (k = 0; k < 3; k++)
2498 t.
x[
j][k] -= f * t.
x[i][k];
2499 s.
x[
j][k] -= f * s.
x[i][k];
2511 *
this = inverse (singExc);
2527 if (
x[0][2] != 0 ||
x[1][2] != 0 ||
x[2][2] != 1)
2530 x[2][1] * x[0][2] - x[0][1] * x[2][2],
2531 x[0][1] * x[1][2] - x[1][1] * x[0][2],
2533 x[2][0] * x[1][2] - x[1][0] * x[2][2],
2534 x[0][0] * x[2][2] - x[2][0] * x[0][2],
2535 x[1][0] * x[0][2] - x[0][0] * x[1][2],
2537 x[1][0] * x[2][1] - x[2][0] * x[1][1],
2538 x[2][0] * x[0][1] - x[0][0] * x[2][1],
2539 x[0][0] * x[1][1] - x[1][0] * x[0][1]);
2541 T r = x[0][0] * s[0][0] + x[0][1] * s[1][0] + x[0][2] * s[2][0];
2545 for (
int i = 0; i < 3; ++i)
2547 for (
int j = 0; j < 3; ++
j)
2557 for (
int i = 0; i < 3; ++i)
2559 for (
int j = 0; j < 3; ++
j)
2568 throw std::invalid_argument (
"Cannot invert "
2569 "singular matrix.");
2592 T r =
x[0][0] *
x[1][1] -
x[1][0] *
x[0][1];
2596 for (
int i = 0; i < 2; ++i)
2598 for (
int j = 0; j < 2; ++
j)
2608 for (
int i = 0; i < 2; ++i)
2610 for (
int j = 0; j < 2; ++
j)
2619 throw std::invalid_argument (
"Cannot invert "
2620 "singular matrix.");
2627 s.
x[2][0] = -x[2][0] * s.
x[0][0] - x[2][1] * s.
x[1][0];
2628 s.
x[2][1] = -x[2][0] * s.
x[0][1] - x[2][1] * s.
x[1][1];
2638 if (
x[0][2] != 0 ||
x[1][2] != 0 ||
x[2][2] != 1)
2641 x[2][1] * x[0][2] - x[0][1] * x[2][2],
2642 x[0][1] * x[1][2] - x[1][1] * x[0][2],
2644 x[2][0] * x[1][2] - x[1][0] * x[2][2],
2645 x[0][0] * x[2][2] - x[2][0] * x[0][2],
2646 x[1][0] * x[0][2] - x[0][0] * x[1][2],
2648 x[1][0] * x[2][1] - x[2][0] * x[1][1],
2649 x[2][0] * x[0][1] - x[0][0] * x[2][1],
2650 x[0][0] * x[1][1] - x[1][0] * x[0][1]);
2652 T r = x[0][0] * s.
x[0][0] + x[0][1] * s.
x[1][0] + x[0][2] * s.
x[2][0];
2656 for (
int i = 0; i < 3; ++i)
2658 for (
int j = 0; j < 3; ++
j)
2668 for (
int i = 0; i < 3; ++i)
2670 for (
int j = 0; j < 3; ++
j)
2700 T r =
x[0][0] *
x[1][1] -
x[1][0] *
x[0][1];
2704 for (
int i = 0; i < 2; ++i)
2706 for (
int j = 0; j < 2; ++
j)
2716 for (
int i = 0; i < 2; ++i)
2718 for (
int j = 0; j < 2; ++
j)
2732 s.
x[2][0] = -x[2][0] * s.
x[0][0] - x[2][1] * s.
x[1][0];
2733 s.
x[2][1] = -x[2][0] * s.
x[0][1] - x[2][1] * s.
x[1][1];
2743 int r0 = 0 + (r < 1 ? 1 : 0);
2744 int r1 = 1 + (r < 2 ? 1 : 0);
2745 int c0 = 0 + (c < 1 ? 1 : 0);
2746 int c1 = 1 + (c < 2 ? 1 : 0);
2748 return x[r0][c0] *
x[r1][c1] -
x[r1][c0] *
x[r0][c1];
2755 return x[r0][c0] *
x[r1][c1] -
x[r0][c1] *
x[r1][c0];
2762 return x[0][0] * (
x[1][1] *
x[2][2] -
x[1][2] *
x[2][1]) +
2763 x[0][1] * (
x[1][2] *
x[2][0] -
x[1][0] *
x[2][2]) +
2764 x[0][2] * (x[1][0] * x[2][1] - x[1][1] * x[2][0]);
2774 cos_r =
cos ((
T) r);
2775 sin_r =
sin ((
T) r);
2896 x[2][0] +=
t.
x *
x[0][0] +
t.y *
x[1][0];
2897 x[2][1] +=
t.x *
x[0][1] +
t.y *
x[1][1];
2898 x[2][2] +=
t.x *
x[0][2] +
t.y *
x[1][2];
2954 x[1][0] += xy *
x[0][0];
2955 x[1][1] += xy * x[0][1];
2956 x[1][2] += xy * x[0][2];
2968 x[0][0] = P.
x[0][0] + h.y * P.
x[1][0];
2969 x[0][1] = P.
x[0][1] + h.y * P.
x[1][1];
2970 x[0][2] = P.
x[0][2] + h.y * P.
x[1][2];
2972 x[1][0] = P.
x[1][0] + h.x * P.
x[0][0];
2973 x[1][1] = P.
x[1][1] + h.x * P.
x[0][1];
2974 x[1][2] = P.
x[1][2] + h.x * P.
x[0][2];
3059 T>
::Matrix44 (T a, T b, T c, T d, T e, T f, T g, T h, T i, T j, T k, T l, T m, T n, T o, T p) IMATH_NOEXCEPT
3081 x[0][0] = r.x[0][0];
3082 x[0][1] = r.x[0][1];
3083 x[0][2] = r.x[0][2];
3085 x[1][0] = r.x[1][0];
3086 x[1][1] = r.x[1][1];
3087 x[1][2] = r.x[1][2];
3089 x[2][0] = r.x[2][0];
3090 x[2][1] = r.x[2][1];
3091 x[2][2] = r.x[2][2];
3101 x[0][0] =
v.x[0][0];
3102 x[0][1] =
v.x[0][1];
3103 x[0][2] =
v.x[0][2];
3104 x[0][3] =
v.x[0][3];
3105 x[1][0] =
v.x[1][0];
3106 x[1][1] =
v.x[1][1];
3107 x[1][2] =
v.x[1][2];
3108 x[1][3] =
v.x[1][3];
3109 x[2][0] =
v.x[2][0];
3110 x[2][1] =
v.x[2][1];
3111 x[2][2] =
v.x[2][2];
3112 x[2][3] =
v.x[2][3];
3113 x[3][0] =
v.x[3][0];
3114 x[3][1] =
v.x[3][1];
3115 x[3][2] =
v.x[3][2];
3116 x[3][3] =
v.x[3][3];
3123 x[0][0] =
T (
v.x[0][0]);
3124 x[0][1] =
T (
v.x[0][1]);
3125 x[0][2] =
T (
v.x[0][2]);
3126 x[0][3] =
T (
v.x[0][3]);
3127 x[1][0] =
T (
v.x[1][0]);
3128 x[1][1] =
T (
v.x[1][1]);
3129 x[1][2] =
T (
v.x[1][2]);
3130 x[1][3] =
T (
v.x[1][3]);
3131 x[2][0] =
T (
v.x[2][0]);
3132 x[2][1] =
T (
v.x[2][1]);
3133 x[2][2] =
T (
v.x[2][2]);
3134 x[2][3] =
T (
v.x[2][3]);
3135 x[3][0] =
T (
v.x[3][0]);
3136 x[3][1] =
T (
v.x[3][1]);
3137 x[3][2] =
T (
v.x[3][2]);
3138 x[3][3] =
T (
v.x[3][3]);
3145 x[0][0] =
v.
x[0][0];
3146 x[0][1] =
v.x[0][1];
3147 x[0][2] =
v.x[0][2];
3148 x[0][3] =
v.x[0][3];
3149 x[1][0] =
v.x[1][0];
3150 x[1][1] =
v.x[1][1];
3151 x[1][2] =
v.x[1][2];
3152 x[1][3] =
v.x[1][3];
3153 x[2][0] =
v.x[2][0];
3154 x[2][1] =
v.x[2][1];
3155 x[2][2] =
v.x[2][2];
3156 x[2][3] =
v.x[2][3];
3157 x[3][0] =
v.x[3][0];
3158 x[3][1] =
v.x[3][1];
3159 x[3][2] =
v.x[3][2];
3160 x[3][3] =
v.x[3][3];
3191 return (
T*) &
x[0][0];
3198 return (
const T*) &
x[0][0];
3206 v.x[0][0] =
x[0][0];
3207 v.x[0][1] =
x[0][1];
3208 v.x[0][2] =
x[0][2];
3209 v.x[0][3] =
x[0][3];
3210 v.x[1][0] =
x[1][0];
3211 v.x[1][1] =
x[1][1];
3212 v.x[1][2] =
x[1][2];
3213 v.x[1][3] =
x[1][3];
3214 v.x[2][0] =
x[2][0];
3215 v.x[2][1] =
x[2][1];
3216 v.x[2][2] =
x[2][2];
3217 v.x[2][3] =
x[2][3];
3218 v.x[3][0] =
x[3][0];
3219 v.x[3][1] =
x[3][1];
3220 v.x[3][2] =
x[3][2];
3221 v.x[3][3] =
x[3][3];
3229 x[0][0] =
v.
x[0][0];
3230 x[0][1] =
v.x[0][1];
3231 x[0][2] =
v.x[0][2];
3232 x[0][3] =
v.x[0][3];
3233 x[1][0] =
v.x[1][0];
3234 x[1][1] =
v.x[1][1];
3235 x[1][2] =
v.x[1][2];
3236 x[1][3] =
v.x[1][3];
3237 x[2][0] =
v.x[2][0];
3238 x[2][1] =
v.x[2][1];
3239 x[2][2] =
v.x[2][2];
3240 x[2][3] =
v.x[2][3];
3241 x[3][0] =
v.x[3][0];
3242 x[3][1] =
v.x[3][1];
3243 x[3][2] =
v.x[3][2];
3244 x[3][3] =
v.x[3][3];
3253 x[0][0] =
v.
x[0][0];
3254 x[0][1] =
v.x[0][1];
3255 x[0][2] =
v.x[0][2];
3256 x[0][3] =
v.x[0][3];
3257 x[1][0] =
v.x[1][0];
3258 x[1][1] =
v.x[1][1];
3259 x[1][2] =
v.x[1][2];
3260 x[1][3] =
v.x[1][3];
3261 x[2][0] =
v.x[2][0];
3262 x[2][1] =
v.x[2][1];
3263 x[2][2] =
v.x[2][2];
3264 x[2][3] =
v.x[2][3];
3265 x[3][0] =
v.x[3][0];
3266 x[3][1] =
v.x[3][1];
3267 x[3][2] =
v.x[3][2];
3268 x[3][3] =
v.x[3][3];
3298 return x[0][0] ==
v.x[0][0] &&
x[0][1] ==
v.x[0][1] &&
x[0][2] ==
v.x[0][2] &&
3299 x[0][3] ==
v.x[0][3] &&
x[1][0] ==
v.x[1][0] &&
x[1][1] ==
v.x[1][1] &&
3300 x[1][2] ==
v.x[1][2] &&
x[1][3] ==
v.x[1][3] &&
x[2][0] ==
v.x[2][0] &&
3301 x[2][1] ==
v.x[2][1] &&
x[2][2] ==
v.x[2][2] &&
x[2][3] ==
v.x[2][3] &&
3302 x[3][0] ==
v.x[3][0] &&
x[3][1] ==
v.x[3][1] &&
x[3][2] ==
v.x[3][2] &&
3303 x[3][3] ==
v.x[3][3];
3310 return x[0][0] !=
v.x[0][0] ||
x[0][1] !=
v.x[0][1] ||
x[0][2] !=
v.x[0][2] ||
3311 x[0][3] !=
v.x[0][3] ||
x[1][0] !=
v.x[1][0] ||
x[1][1] !=
v.x[1][1] ||
3312 x[1][2] !=
v.x[1][2] ||
x[1][3] !=
v.x[1][3] ||
x[2][0] !=
v.x[2][0] ||
3313 x[2][1] !=
v.x[2][1] ||
x[2][2] !=
v.x[2][2] ||
x[2][3] !=
v.x[2][3] ||
3314 x[3][0] !=
v.x[3][0] ||
x[3][1] !=
v.x[3][1] ||
x[3][2] !=
v.x[3][2] ||
3315 x[3][3] !=
v.x[3][3];
3322 for (
int i = 0; i < 4; i++)
3323 for (
int j = 0; j < 4; j++)
3334 for (
int i = 0; i < 4; i++)
3335 for (
int j = 0; j < 4; j++)
3346 x[0][0] +=
v.
x[0][0];
3347 x[0][1] +=
v.x[0][1];
3348 x[0][2] +=
v.x[0][2];
3349 x[0][3] +=
v.x[0][3];
3350 x[1][0] +=
v.x[1][0];
3351 x[1][1] +=
v.x[1][1];
3352 x[1][2] +=
v.x[1][2];
3353 x[1][3] +=
v.x[1][3];
3354 x[2][0] +=
v.x[2][0];
3355 x[2][1] +=
v.x[2][1];
3356 x[2][2] +=
v.x[2][2];
3357 x[2][3] +=
v.x[2][3];
3358 x[3][0] +=
v.x[3][0];
3359 x[3][1] +=
v.x[3][1];
3360 x[3][2] +=
v.x[3][2];
3361 x[3][3] +=
v.x[3][3];
3395 x[0][1] +
v.x[0][1],
3396 x[0][2] +
v.x[0][2],
3397 x[0][3] +
v.x[0][3],
3398 x[1][0] +
v.x[1][0],
3399 x[1][1] +
v.x[1][1],
3400 x[1][2] +
v.x[1][2],
3401 x[1][3] +
v.x[1][3],
3402 x[2][0] +
v.x[2][0],
3403 x[2][1] +
v.x[2][1],
3404 x[2][2] +
v.x[2][2],
3405 x[2][3] +
v.x[2][3],
3406 x[3][0] +
v.x[3][0],
3407 x[3][1] +
v.x[3][1],
3408 x[3][2] +
v.x[3][2],
3409 x[3][3] +
v.x[3][3]);
3416 x[0][0] -=
v.
x[0][0];
3417 x[0][1] -=
v.x[0][1];
3418 x[0][2] -=
v.x[0][2];
3419 x[0][3] -=
v.x[0][3];
3420 x[1][0] -=
v.x[1][0];
3421 x[1][1] -=
v.x[1][1];
3422 x[1][2] -=
v.x[1][2];
3423 x[1][3] -=
v.x[1][3];
3424 x[2][0] -=
v.x[2][0];
3425 x[2][1] -=
v.x[2][1];
3426 x[2][2] -=
v.x[2][2];
3427 x[2][3] -=
v.x[2][3];
3428 x[3][0] -=
v.x[3][0];
3429 x[3][1] -=
v.x[3][1];
3430 x[3][2] -=
v.x[3][2];
3431 x[3][3] -=
v.x[3][3];
3465 x[0][1] -
v.x[0][1],
3466 x[0][2] -
v.x[0][2],
3467 x[0][3] -
v.x[0][3],
3468 x[1][0] -
v.x[1][0],
3469 x[1][1] -
v.x[1][1],
3470 x[1][2] -
v.x[1][2],
3471 x[1][3] -
v.x[1][3],
3472 x[2][0] -
v.x[2][0],
3473 x[2][1] -
v.x[2][1],
3474 x[2][2] -
v.x[2][2],
3475 x[2][3] -
v.x[2][3],
3476 x[3][0] -
v.x[3][0],
3477 x[3][1] -
v.x[3][1],
3478 x[3][2] -
v.x[3][2],
3479 x[3][3] -
v.x[3][3]);
3587 const auto a00 = a.x[0][0];
3588 const auto a01 = a.x[0][1];
3589 const auto a02 = a.x[0][2];
3590 const auto a03 = a.x[0][3];
3592 const auto c00 = a00 * b.x[0][0] + a01 * b.x[1][0] + a02 * b.x[2][0] + a03 * b.x[3][0];
3593 const auto c01 = a00 * b.x[0][1] + a01 * b.x[1][1] + a02 * b.x[2][1] + a03 * b.x[3][1];
3594 const auto c02 = a00 * b.x[0][2] + a01 * b.x[1][2] + a02 * b.x[2][2] + a03 * b.x[3][2];
3595 const auto c03 = a00 * b.x[0][3] + a01 * b.x[1][3] + a02 * b.x[2][3] + a03 * b.x[3][3];
3597 const auto a10 = a.x[1][0];
3598 const auto a11 = a.x[1][1];
3599 const auto a12 = a.x[1][2];
3600 const auto a13 = a.x[1][3];
3602 const auto c10 = a10 * b.x[0][0] + a11 * b.x[1][0] + a12 * b.x[2][0] + a13 * b.x[3][0];
3603 const auto c11 = a10 * b.x[0][1] + a11 * b.x[1][1] + a12 * b.x[2][1] + a13 * b.x[3][1];
3604 const auto c12 = a10 * b.x[0][2] + a11 * b.x[1][2] + a12 * b.x[2][2] + a13 * b.x[3][2];
3605 const auto c13 = a10 * b.x[0][3] + a11 * b.x[1][3] + a12 * b.x[2][3] + a13 * b.x[3][3];
3607 const auto a20 = a.x[2][0];
3608 const auto a21 = a.x[2][1];
3609 const auto a22 = a.x[2][2];
3610 const auto a23 = a.x[2][3];
3612 const auto c20 = a20 * b.x[0][0] + a21 * b.x[1][0] + a22 * b.x[2][0] + a23 * b.x[3][0];
3613 const auto c21 = a20 * b.x[0][1] + a21 * b.x[1][1] + a22 * b.x[2][1] + a23 * b.x[3][1];
3614 const auto c22 = a20 * b.x[0][2] + a21 * b.x[1][2] + a22 * b.x[2][2] + a23 * b.x[3][2];
3615 const auto c23 = a20 * b.x[0][3] + a21 * b.x[1][3] + a22 * b.x[2][3] + a23 * b.x[3][3];
3617 const auto a30 = a.x[3][0];
3618 const auto a31 = a.x[3][1];
3619 const auto a32 = a.x[3][2];
3620 const auto a33 = a.x[3][3];
3622 const auto c30 = a30 * b.x[0][0] + a31 * b.x[1][0] + a32 * b.x[2][0] + a33 * b.x[3][0];
3623 const auto c31 = a30 * b.x[0][1] + a31 * b.x[1][1] + a32 * b.x[2][1] + a33 * b.x[3][1];
3624 const auto c32 = a30 * b.x[0][2] + a31 * b.x[1][2] + a32 * b.x[2][2] + a33 * b.x[3][2];
3625 const auto c33 = a30 * b.x[0][3] + a31 * b.x[1][3] + a32 * b.x[2][3] + a33 * b.x[3][3];
3626 return Matrix44(c00, c01, c02, c03,
3629 c30, c31, c32, c33);
3662 a =
src.x *
x[0][0] +
src.y *
x[1][0] +
src.z *
x[2][0] +
x[3][0];
3663 b =
src.x * x[0][1] +
src.y * x[1][1] +
src.z * x[2][1] + x[3][1];
3664 c =
src.x * x[0][2] +
src.y * x[1][2] +
src.z * x[2][2] + x[3][2];
3665 w =
src.x * x[0][3] +
src.y * x[1][3] +
src.z * x[2][3] + x[3][3];
3679 a =
src.x *
x[0][0] +
src.y *
x[1][0] +
src.z *
x[2][0];
3680 b =
src.x *
x[0][1] +
src.y *
x[1][1] +
src.z *
x[2][1];
3681 c =
src.x *
x[0][2] +
src.y *
x[1][2] +
src.z *
x[2][2];
3784 *
this = gjInverse (singExc);
3792 *
this = gjInverse();
3806 for (i = 0; i < 3; i++)
3810 T pivotsize = t.
x[i][i];
3813 pivotsize = -pivotsize;
3815 for (j = i + 1; j < 4; j++)
3822 if (tmp > pivotsize)
3832 throw std::invalid_argument (
"Cannot invert singular matrix.");
3839 for (j = 0; j < 4; j++)
3853 for (j = i + 1; j < 4; j++)
3855 T f = t.
x[
j][i] / t.
x[i][i];
3857 for (k = 0; k < 4; k++)
3859 t.
x[
j][k] -= f * t.
x[i][k];
3860 s.
x[
j][k] -= f * s.
x[i][k];
3867 for (i = 3; i >= 0; --i)
3871 if ((f = t.
x[i][i]) == 0)
3874 throw std::invalid_argument (
"Cannot invert singular matrix.");
3879 for (j = 0; j < 4; j++)
3885 for (j = 0; j < i; j++)
3889 for (k = 0; k < 4; k++)
3891 t.
x[
j][k] -= f * t.
x[i][k];
3892 s.
x[
j][k] -= f * s.
x[i][k];
3910 for (i = 0; i < 3; i++)
3914 T pivotsize = t.
x[i][i];
3917 pivotsize = -pivotsize;
3919 for (j = i + 1; j < 4; j++)
3926 if (tmp > pivotsize)
3940 for (j = 0; j < 4; j++)
3954 for (j = i + 1; j < 4; j++)
3956 T f = t.
x[
j][i] / t.
x[i][i];
3958 for (k = 0; k < 4; k++)
3960 t.
x[
j][k] -= f * t.
x[i][k];
3961 s.
x[
j][k] -= f * s.
x[i][k];
3968 for (i = 3; i >= 0; --i)
3972 if ((f = t.
x[i][i]) == 0)
3977 for (j = 0; j < 4; j++)
3983 for (j = 0; j < i; j++)
3987 for (k = 0; k < 4; k++)
3989 t.
x[
j][k] -= f * t.
x[i][k];
3990 s.
x[
j][k] -= f * s.
x[i][k];
4002 *
this = inverse (singExc);
4018 if (
x[0][3] != 0 ||
x[1][3] != 0 ||
x[2][3] != 0 ||
x[3][3] != 1)
4019 return gjInverse (singExc);
4022 x[2][1] * x[0][2] - x[0][1] * x[2][2],
4023 x[0][1] * x[1][2] - x[1][1] * x[0][2],
4026 x[2][0] * x[1][2] - x[1][0] * x[2][2],
4027 x[0][0] * x[2][2] - x[2][0] * x[0][2],
4028 x[1][0] * x[0][2] - x[0][0] * x[1][2],
4031 x[1][0] * x[2][1] - x[2][0] * x[1][1],
4032 x[2][0] * x[0][1] - x[0][0] * x[2][1],
4033 x[0][0] * x[1][1] - x[1][0] * x[0][1],
4041 T r = x[0][0] * s.
x[0][0] + x[0][1] * s.
x[1][0] + x[0][2] * s.
x[2][0];
4045 for (
int i = 0; i < 3; ++i)
4047 for (
int j = 0; j < 3; ++
j)
4057 for (
int i = 0; i < 3; ++i)
4059 for (
int j = 0; j < 3; ++
j)
4068 throw std::invalid_argument (
"Cannot invert singular matrix.");
4076 s.
x[3][0] = -x[3][0] * s.
x[0][0] - x[3][1] * s.
x[1][0] - x[3][2] * s.
x[2][0];
4077 s.
x[3][1] = -x[3][0] * s.
x[0][1] - x[3][1] * s.
x[1][1] - x[3][2] * s.
x[2][1];
4078 s.
x[3][2] = -x[3][0] * s.
x[0][2] - x[3][1] * s.
x[1][2] - x[3][2] * s.
x[2][2];
4087 if (
x[0][3] != 0 ||
x[1][3] != 0 ||
x[2][3] != 0 ||
x[3][3] != 1)
4091 x[2][1] * x[0][2] - x[0][1] * x[2][2],
4092 x[0][1] * x[1][2] - x[1][1] * x[0][2],
4095 x[2][0] * x[1][2] - x[1][0] * x[2][2],
4096 x[0][0] * x[2][2] - x[2][0] * x[0][2],
4097 x[1][0] * x[0][2] - x[0][0] * x[1][2],
4100 x[1][0] * x[2][1] - x[2][0] * x[1][1],
4101 x[2][0] * x[0][1] - x[0][0] * x[2][1],
4102 x[0][0] * x[1][1] - x[1][0] * x[0][1],
4110 T r = x[0][0] * s.
x[0][0] + x[0][1] * s.
x[1][0] + x[0][2] * s.
x[2][0];
4114 for (
int i = 0; i < 3; ++i)
4116 for (
int j = 0; j < 3; ++
j)
4126 for (
int i = 0; i < 3; ++i)
4128 for (
int j = 0; j < 3; ++
j)
4142 s.
x[3][0] = -x[3][0] * s.
x[0][0] - x[3][1] * s.
x[1][0] - x[3][2] * s.
x[2][0];
4143 s.
x[3][1] = -x[3][0] * s.
x[0][1] - x[3][1] * s.
x[1][1] - x[3][2] * s.
x[2][1];
4144 s.
x[3][2] = -x[3][0] * s.
x[0][2] - x[3][1] * s.
x[1][2] - x[3][2] * s.
x[2][2];
4156 const int c2)
const IMATH_NOEXCEPT
4158 return x[r0][c0] * (
x[r1][c1] *
x[r2][c2] -
x[r1][c2] *
x[r2][c1]) +
4159 x[r0][c1] * (
x[r1][c2] *
x[r2][c0] -
x[r1][c0] *
x[r2][c2]) +
4160 x[r0][c2] * (
x[r1][c0] *
x[r2][c1] -
x[r1][c1] *
x[r2][c0]);
4167 int r0 = 0 + (r < 1 ? 1 : 0);
4168 int r1 = 1 + (r < 2 ? 1 : 0);
4169 int r2 = 2 + (r < 3 ? 1 : 0);
4170 int c0 = 0 + (c < 1 ? 1 : 0);
4171 int c1 = 1 + (c < 2 ? 1 : 0);
4172 int c2 = 2 + (c < 3 ? 1 : 0);
4194 sum -=
x[0][3] * fastMinor (1, 2, 3, 0, 1, 2);
4196 sum +=
x[1][3] * fastMinor (0, 2, 3, 0, 1, 2);
4198 sum -=
x[2][3] * fastMinor (0, 1, 3, 0, 1, 2);
4200 sum +=
x[3][3] * fastMinor (0, 1, 2, 0, 1, 2);
4210 S cos_rz, sin_rz, cos_ry, sin_ry, cos_rx, sin_rx;
4212 cos_rz =
cos ((
T) r.z);
4213 cos_ry =
cos ((
T) r.y);
4214 cos_rx =
cos ((
T) r.x);
4216 sin_rz =
sin ((
T) r.z);
4217 sin_ry =
sin ((
T) r.y);
4218 sin_rx =
sin ((
T) r.x);
4220 x[0][0] = cos_rz * cos_ry;
4221 x[0][1] = sin_rz * cos_ry;
4225 x[1][0] = -sin_rz * cos_rx + cos_rz * sin_ry * sin_rx;
4226 x[1][1] = cos_rz * cos_rx + sin_rz * sin_ry * sin_rx;
4227 x[1][2] = cos_ry * sin_rx;
4230 x[2][0] = sin_rz * sin_rx + cos_rz * sin_ry * cos_rx;
4231 x[2][1] = -cos_rz * sin_rx + sin_rz * sin_ry * cos_rx;
4232 x[2][2] = cos_ry * cos_rx;
4252 x[0][0] =
unit.x *
unit.x * (1 - cosine) + cosine;
4258 x[1][1] =
unit.y *
unit.y * (1 - cosine) + cosine;
4264 x[2][2] =
unit.z *
unit.z * (1 - cosine) + cosine;
4280 S cos_rz, sin_rz, cos_ry, sin_ry, cos_rx, sin_rx;
4285 cos_rz =
cos ((
S) r.z);
4286 cos_ry =
cos ((
S) r.y);
4287 cos_rx =
cos ((
S) r.x);
4289 sin_rz =
sin ((
S) r.z);
4290 sin_ry =
sin ((
S) r.y);
4291 sin_rx =
sin ((
S) r.x);
4293 m00 = cos_rz * cos_ry;
4294 m01 = sin_rz * cos_ry;
4296 m10 = -sin_rz * cos_rx + cos_rz * sin_ry * sin_rx;
4297 m11 = cos_rz * cos_rx + sin_rz * sin_ry * sin_rx;
4298 m12 = cos_ry * sin_rx;
4299 m20 = -sin_rz * -sin_rx + cos_rz * sin_ry * cos_rx;
4300 m21 = cos_rz * -sin_rx + sin_rz * sin_ry * cos_rx;
4301 m22 = cos_ry * cos_rx;
4305 x[0][0] = P.
x[0][0] * m00 + P.
x[1][0] * m01 + P.
x[2][0] * m02;
4306 x[0][1] = P.
x[0][1] * m00 + P.
x[1][1] * m01 + P.
x[2][1] * m02;
4307 x[0][2] = P.
x[0][2] * m00 + P.
x[1][2] * m01 + P.
x[2][2] * m02;
4308 x[0][3] = P.
x[0][3] * m00 + P.
x[1][3] * m01 + P.
x[2][3] * m02;
4310 x[1][0] = P.
x[0][0] * m10 + P.
x[1][0] * m11 + P.
x[2][0] * m12;
4311 x[1][1] = P.
x[0][1] * m10 + P.
x[1][1] * m11 + P.
x[2][1] * m12;
4312 x[1][2] = P.
x[0][2] * m10 + P.
x[1][2] * m11 + P.
x[2][2] * m12;
4313 x[1][3] = P.
x[0][3] * m10 + P.
x[1][3] * m11 + P.
x[2][3] * m12;
4315 x[2][0] = P.
x[0][0] * m20 + P.
x[1][0] * m21 + P.
x[2][0] * m22;
4316 x[2][1] = P.
x[0][1] * m20 + P.
x[1][1] * m21 + P.
x[2][1] * m22;
4317 x[2][2] = P.
x[0][2] * m20 + P.
x[1][2] * m21 + P.
x[2][2] * m22;
4318 x[2][3] = P.
x[0][3] * m20 + P.
x[1][3] * m21 + P.
x[2][3] * m22;
4441 return Vec3<T> (
x[3][0], x[3][1], x[3][2]);
4449 x[3][0] +=
t.
x *
x[0][0] +
t.y *
x[1][0] +
t.z *
x[2][0];
4450 x[3][1] +=
t.x *
x[0][1] +
t.y *
x[1][1] +
t.z *
x[2][1];
4451 x[3][2] +=
t.x *
x[0][2] +
t.y *
x[1][2] +
t.z *
x[2][2];
4452 x[3][3] +=
t.x *
x[0][3] +
t.y *
x[1][3] +
t.z *
x[2][3];
4524 for (
int i = 0; i < 4; i++)
4526 x[2][i] += h.y *
x[0][i] + h.z *
x[1][i];
4527 x[1][i] += h.
x *
x[0][i];
4540 for (
int i = 0; i < 4; i++)
4542 x[0][i] = P.
x[0][i] + h.yx * P.
x[1][i] + h.zx * P.
x[2][i];
4543 x[1][i] = h.xy * P.
x[0][i] + P.
x[1][i] + h.zy * P.
x[2][i];
4544 x[2][i] = h.xz * P.
x[0][i] + h.yz * P.
x[1][i] + P.
x[2][i];
4556 operator<< (std::ostream& s, const Matrix22<T>& m)
4558 std::ios_base::fmtflags oldFlags =
s.flags();
4561 if (
s.flags() & std::ios_base::fixed)
4563 s.setf (std::ios_base::showpoint);
4564 width =
static_cast<int> (
s.precision()) + 5;
4568 s.setf (std::ios_base::scientific);
4569 s.setf (std::ios_base::showpoint);
4570 width =
static_cast<int> (
s.precision()) + 8;
4573 s <<
"(" << std::setw (width) << m[0][0] <<
" " << std::setw (width) << m[0][1] <<
"\n"
4576 " " << std::setw (width) << m[1][0] <<
" " << std::setw (width) << m[1][1] <<
")\n";
4584 operator<< (std::ostream& s, const Matrix33<T>& m)
4586 std::ios_base::fmtflags oldFlags =
s.flags();
4589 if (
s.flags() & std::ios_base::fixed)
4591 s.setf (std::ios_base::showpoint);
4592 width =
static_cast<int> (
s.precision()) + 5;
4596 s.setf (std::ios_base::scientific);
4597 s.setf (std::ios_base::showpoint);
4598 width =
static_cast<int> (
s.precision()) + 8;
4601 s <<
"(" << std::setw (width) << m[0][0] <<
" " << std::setw (width) << m[0][1] <<
" "
4602 << std::setw (width) << m[0][2] <<
"\n"
4605 " " << std::setw (width) << m[1][0] <<
" " << std::setw (width) << m[1][1] <<
" "
4606 << std::setw (width) << m[1][2] <<
"\n"
4609 " " << std::setw (width) << m[2][0] <<
" " << std::setw (width) << m[2][1] <<
" "
4610 << std::setw (width) << m[2][2] <<
")\n";
4618 operator<< (std::ostream& s, const Matrix44<T>& m)
4620 std::ios_base::fmtflags oldFlags =
s.flags();
4623 if (
s.flags() & std::ios_base::fixed)
4625 s.setf (std::ios_base::showpoint);
4626 width =
static_cast<int> (
s.precision()) + 5;
4630 s.setf (std::ios_base::scientific);
4631 s.setf (std::ios_base::showpoint);
4632 width =
static_cast<int> (
s.precision()) + 8;
4635 s <<
"(" << std::setw (width) << m[0][0] <<
" " << std::setw (width) << m[0][1] <<
" "
4636 << std::setw (width) << m[0][2] <<
" " << std::setw (width) << m[0][3] <<
"\n"
4639 " " << std::setw (width) << m[1][0] <<
" " << std::setw (width) << m[1][1] <<
" "
4640 << std::setw (width) << m[1][2] <<
" " << std::setw (width) << m[1][3] <<
"\n"
4643 " " << std::setw (width) << m[2][0] <<
" " << std::setw (width) << m[2][1] <<
" "
4644 << std::setw (width) << m[2][2] <<
" " << std::setw (width) << m[2][3] <<
"\n"
4647 " " << std::setw (width) << m[3][0] <<
" " << std::setw (width) << m[3][1] <<
" "
4648 << std::setw (width) << m[3][2] <<
" " << std::setw (width) << m[3][3] <<
")\n";
4658 template <
class S,
class T>
4662 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0]);
4663 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1]);
4671 template <
class S,
class T>
4675 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0]);
4676 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1]);
4681 template <
class S,
class T>
4685 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0] + m.x[2][0]);
4686 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1] + m.x[2][1]);
4687 S w =
S (
v.x * m.x[0][2] +
v.y * m.x[1][2] + m.x[2][2]);
4695 template <
class S,
class T>
4699 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0] + m.x[2][0]);
4700 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1] + m.x[2][1]);
4701 S w =
S (
v.x * m.x[0][2] +
v.y * m.x[1][2] + m.x[2][2]);
4706 template <
class S,
class T>
4710 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0] +
v.z * m.x[2][0]);
4711 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1] +
v.z * m.x[2][1]);
4712 S z =
S (
v.x * m.x[0][2] +
v.y * m.x[1][2] +
v.z * m.x[2][2]);
4721 template <
class S,
class T>
4725 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0] +
v.z * m.x[2][0]);
4726 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1] +
v.z * m.x[2][1]);
4727 S z =
S (
v.x * m.x[0][2] +
v.y * m.x[1][2] +
v.z * m.x[2][2]);
4732 template <
class S,
class T>
4736 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0] +
v.z * m.x[2][0] + m.x[3][0]);
4737 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1] +
v.z * m.x[2][1] + m.x[3][1]);
4738 S z =
S (
v.x * m.x[0][2] +
v.y * m.x[1][2] +
v.z * m.x[2][2] + m.x[3][2]);
4739 S w =
S (
v.x * m.x[0][3] +
v.y * m.x[1][3] +
v.z * m.x[2][3] + m.x[3][3]);
4748 template <
class S,
class T>
4752 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0] +
v.z * m.x[2][0] + m.x[3][0]);
4753 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1] +
v.z * m.x[2][1] + m.x[3][1]);
4754 S z =
S (
v.x * m.x[0][2] +
v.y * m.x[1][2] +
v.z * m.x[2][2] + m.x[3][2]);
4755 S w =
S (
v.x * m.x[0][3] +
v.y * m.x[1][3] +
v.z * m.x[2][3] + m.x[3][3]);
4760 template <
class S,
class T>
4764 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0] +
v.z * m.x[2][0] +
v.w * m.x[3][0]);
4765 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1] +
v.z * m.x[2][1] +
v.w * m.x[3][1]);
4766 S z =
S (
v.x * m.x[0][2] +
v.y * m.x[1][2] +
v.z * m.x[2][2] +
v.w * m.x[3][2]);
4767 S w =
S (
v.x * m.x[0][3] +
v.y * m.x[1][3] +
v.z * m.x[2][3] +
v.w * m.x[3][3]);
4777 template <
class S,
class T>
4781 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0] +
v.z * m.x[2][0] +
v.w * m.x[3][0]);
4782 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1] +
v.z * m.x[2][1] +
v.w * m.x[3][1]);
4783 S z =
S (
v.x * m.x[0][2] +
v.y * m.x[1][2] +
v.z * m.x[2][2] +
v.w * m.x[3][2]);
4784 S w =
S (
v.x * m.x[0][3] +
v.y * m.x[1][3] +
v.z * m.x[2][3] +
v.w * m.x[3][3]);
4789 IMATH_INTERNAL_NAMESPACE_HEADER_EXIT
4791 #endif // INCLUDED_IMATHMATRIX_H
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33 & setTheMatrix(const Matrix33< S > &v) IMATH_NOEXCEPT
Set the value.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError(T x1, T x2, T e) IMATH_NOEXCEPT
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_API double cos(double x)
IMATH_HOSTDEVICE constexpr Vec2< T > translation() const IMATH_NOEXCEPT
Return the translation component.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & gjInvert() IMATH_NOEXCEPT
IMATH_HOSTDEVICE static constexpr unsigned int dimensions() IMATH_NOEXCEPT
Return the number of the row and column dimensions, i.e. 4.
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER enum IMATH_EXPORT_ENUM Uninitialized
IMATH_HOSTDEVICE constexpr Matrix22 operator*(T a) const IMATH_NOEXCEPT
Component-wise multiplication.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError(const Matrix44< T > &v, T e) const IMATH_NOEXCEPT
Matrix44< float > M44f
4x4 matrix of float
IMATH_HOSTDEVICE constexpr bool operator==(const Matrix33 &v) const IMATH_NOEXCEPT
Equality.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & transpose() IMATH_NOEXCEPT
Transpose.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & operator-=(const Matrix44 &v) IMATH_NOEXCEPT
Component-wise subtraction.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError(const Matrix22< T > &v, T e) const IMATH_NOEXCEPT
IMATH_HOSTDEVICE constexpr bool operator!=(const Matrix33 &v) const IMATH_NOEXCEPT
Inequality.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22 & invert() IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & operator+=(const Matrix44 &v) IMATH_NOEXCEPT
Component-wise addition.
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
IMATH_HOSTDEVICE constexpr Matrix44 operator/(T a) const IMATH_NOEXCEPT
Component-wise division.
static IMATH_HOSTDEVICE void multiply(const Matrix44 &a, const Matrix44 &b, Matrix44 &c) IMATH_NOEXCEPT
Matrix-matrix multiplication: compute c = a * b.
SIM_API const UT_StringHolder angle
MatType shear(Axis axis0, Axis axis1, typename MatType::value_type shear)
Set the matrix to a shear along axis0 by a fraction of axis1.
IMATH_HOSTDEVICE constexpr Matrix33 operator-() const IMATH_NOEXCEPT
Component-wise multiplication by -1.
IMATH_HOSTDEVICE constexpr Matrix33 operator*(T a) const IMATH_NOEXCEPT
Component-wise multiplication.
IMATH_HOSTDEVICE constexpr Matrix44(Uninitialized) IMATH_NOEXCEPT
Uninitialized.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & setShear(const Vec3< S > &h) IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError(T x1, T x2, T e) IMATH_NOEXCEPT
Vec2< T > BaseVecType
The base vector type.
IMATH_HOSTDEVICE constexpr T fastMinor(const int r0, const int r1, const int r2, const int c0, const int c1, const int c2) const IMATH_NOEXCEPT
Build a minor using the specified rows and columns.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & operator*=(T a) IMATH_NOEXCEPT
Component-wise multiplication.
IMATH_HOSTDEVICE T * operator[](int i) IMATH_NOEXCEPT
Row access.
GLsizei const GLfloat * value
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22 & setValue(const Matrix22< S > &v) IMATH_NOEXCEPT
Set the value.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T minorOf(const int r, const int c) const IMATH_NOEXCEPT
Calculate the matrix minor of the (r,c) element.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 & setTheMatrix(const Matrix44< S > &v) IMATH_NOEXCEPT
Set the value.
GLdouble GLdouble GLdouble z
IMATH_HOSTDEVICE constexpr bool operator==(const Matrix22 &v) const IMATH_NOEXCEPT
Equality.
IMATH_HOSTDEVICE const Matrix33 & gjInvert() IMATH_NOEXCEPT
T x[2][2]
Matrix elements.
IMATH_HOSTDEVICE constexpr Matrix44 operator+(const Matrix44 &v) const IMATH_NOEXCEPT
Component-wise addition.
GLboolean GLboolean GLboolean GLboolean a
Matrix22< double > M22d
2x2 matrix of double
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22< T > inverse() const IMATH_NOEXCEPT
Return the inverse, leaving this unmodified.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22 & operator*=(T a) IMATH_NOEXCEPT
Component-wise multiplication.
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
IMATH_HOSTDEVICE void multVecMatrix(const Vec2< S > &src, Vec2< S > &dst) const IMATH_NOEXCEPT
IMATH_HOSTDEVICE static constexpr unsigned int dimensions() IMATH_NOEXCEPT
Return the number of the row and column dimensions, i.e. 2.
T x[4][4]
Matrix elements.
__hostdev__ void setValue(uint32_t offset, bool v)
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33() IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22 & rotate(S r) IMATH_NOEXCEPT
IMATH_HOSTDEVICE static constexpr unsigned int dimensions() IMATH_NOEXCEPT
Return the number of the row and column dimensions, i.e. 3.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & shear(const S &xy) IMATH_NOEXCEPT
IMATH_HOSTDEVICE constexpr const Vec3< T > translation() const IMATH_NOEXCEPT
Return translation component.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError(const Matrix44< T > &v, T e) const IMATH_NOEXCEPT
Matrix33< float > M33f
3x3 matrix of float
T BaseType
The base type: In templates that accept a parameter V (could be a Color4), you can refer to T as V::B...
Matrix44< double > M44d
4x4 matrix of double
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33< T > inverse() const IMATH_NOEXCEPT
Return the inverse using the determinant, leaving this unmodified.
IMATH_HOSTDEVICE static constexpr T baseTypeMax() IMATH_NOEXCEPT
Largest possible positive value.
__hostdev__ float getValue(uint32_t i) const
Matrix33< double > M33d
3x3 matrix of double
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError(const Matrix33< T > &v, T e) const IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & operator*=(T a) IMATH_NOEXCEPT
Component-wise multiplication.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & invert() IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22 & setTheMatrix(const Matrix22< S > &v) IMATH_NOEXCEPT
Set the value.
IMATH_HOSTDEVICE Matrix44< T > gjInverse() const IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22 & operator+=(const Matrix22 &v) IMATH_NOEXCEPT
Component-wise addition.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44< T > inverse() const IMATH_NOEXCEPT
Return the inverse using the determinant, leaving this unmodified.
IMATH_HOSTDEVICE const Matrix22 & setRotation(S r) IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & setScale(T s) IMATH_NOEXCEPT
GLsizei GLboolean transpose
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22 & setScale(T s) IMATH_NOEXCEPT
IMATH_HOSTDEVICE void multVecMatrix(const Vec3< S > &src, Vec3< S > &dst) const IMATH_NOEXCEPT
GA_API const UT_StringHolder scale
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError(const Matrix33< T > &v, T e) const IMATH_NOEXCEPT
IMATH_HOSTDEVICE constexpr Matrix22 transposed() const IMATH_NOEXCEPT
Return the transpose.
IMATH_HOSTDEVICE constexpr T determinant() const IMATH_NOEXCEPT
Determinant.
IMATH_HOSTDEVICE constexpr T fastMinor(const int r0, const int r1, const int c0, const int c1) const IMATH_NOEXCEPT
Build a minor using the specified rows and columns.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & operator-=(const Matrix33 &v) IMATH_NOEXCEPT
Component-wise subtraction.
Vec3< T > & operator*=(Vec3< T > &_v, const Mat3< MT > &_m)
Multiply _v by _m and replace _v with the resulting vector.
IMATH_HOSTDEVICE constexpr bool operator==(const Matrix44 &v) const IMATH_NOEXCEPT
Equality.
IMATH_HOSTDEVICE T * getValue() IMATH_NOEXCEPT
Return a raw pointer to the array of values.
IMATH_HOSTDEVICE constexpr Matrix33 operator/(T a) const IMATH_NOEXCEPT
Component-wise division.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & shear(const Vec3< S > &h) IMATH_NOEXCEPT
IMATH_HOSTDEVICE constexpr bool operator!=(const Matrix22 &v) const IMATH_NOEXCEPT
Inequality.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & invert() IMATH_NOEXCEPT
IMATH_HOSTDEVICE void makeIdentity() IMATH_NOEXCEPT
Set to the identity.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44() IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & transpose() IMATH_NOEXCEPT
Transpose.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22 & transpose() IMATH_NOEXCEPT
Transpose.
IMATH_HOSTDEVICE T * getValue() IMATH_NOEXCEPT
Return a raw pointer to the array of values.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & setTranslation(const Vec2< S > &t) IMATH_NOEXCEPT
IMATH_HOSTDEVICE static constexpr T baseTypeSmallest() IMATH_NOEXCEPT
Smallest possible positive value.
IMATH_HOSTDEVICE constexpr Matrix22 operator/(T a) const IMATH_NOEXCEPT
Component-wise division.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33 & setValue(const Matrix33< S > &v) IMATH_NOEXCEPT
Set the value.
IMATH_HOSTDEVICE constexpr T determinant() const IMATH_NOEXCEPT
Determinant.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & translate(const Vec2< S > &t) IMATH_NOEXCEPT
IMATH_HOSTDEVICE static constexpr T baseTypeEpsilon() IMATH_NOEXCEPT
Smallest possible e for which 1+e != 1.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 & setValue(const Matrix44< S > &v) IMATH_NOEXCEPT
Set the value.
#define IMATH_EXPORT_ENUM
IMATH_HOSTDEVICE Matrix33< T > gjInverse() const IMATH_NOEXCEPT
png_const_structrp png_const_inforp int * unit
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22 & negate() IMATH_NOEXCEPT
Component-wise multiplication by -1.
T BaseType
The base type: In templates that accept a parameter V (could be a Color4), you can refer to T as V::B...
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & setShear(const S &h) IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & translate(const Vec3< S > &t) IMATH_NOEXCEPT
GLboolean GLboolean GLboolean b
IMATH_HOSTDEVICE static constexpr T baseTypeEpsilon() IMATH_NOEXCEPT
Smallest possible e for which 1+e != 1.
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)
IMATH_HOSTDEVICE constexpr bool operator!=(const Matrix44 &v) const IMATH_NOEXCEPT
Inequality.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError(const Matrix22< T > &v, T e) const IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & negate() IMATH_NOEXCEPT
Component-wise multiplication by -1.
IMATH_HOSTDEVICE constexpr Matrix22 operator+(const Matrix22 &v) const IMATH_NOEXCEPT
Component-wise addition.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22 & scale(const Vec2< S > &s) IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & scale(const Vec3< S > &s) IMATH_NOEXCEPT
IMATH_HOSTDEVICE T * operator[](int i) IMATH_NOEXCEPT
Row access.
IMATH_HOSTDEVICE constexpr Matrix33 transposed() const IMATH_NOEXCEPT
Return the transpose.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & setTranslation(const Vec3< S > &t) IMATH_NOEXCEPT
IMATH_HOSTDEVICE void makeIdentity() IMATH_NOEXCEPT
Set to the identity matrix.
Vec3< T > BaseVecType
The base vector type.
IMATH_HOSTDEVICE T * operator[](int i) IMATH_NOEXCEPT
Row access.
GLfloat GLfloat GLfloat GLfloat h
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T determinant() const IMATH_NOEXCEPT
Determinant.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & operator=(const Matrix33 &v) IMATH_NOEXCEPT
Assignment operator.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & operator+=(const Matrix33 &v) IMATH_NOEXCEPT
Component-wise addition.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22 & operator=(const Matrix22 &v) IMATH_NOEXCEPT
Assignment.
IMATH_HOSTDEVICE static constexpr T baseTypeEpsilon() IMATH_NOEXCEPT
Smallest possible e for which 1+e != 1.
Matrix22< float > M22f
2x2 matrix of float
IMATH_HOSTDEVICE constexpr Matrix44 operator-() const IMATH_NOEXCEPT
Component-wise multiplication by -1.
IMATH_HOSTDEVICE constexpr Matrix44 transposed() const IMATH_NOEXCEPT
Return the transpose.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & scale(const Vec2< S > &s) IMATH_NOEXCEPT
IMATH_HOSTDEVICE Matrix33(Uninitialized) IMATH_NOEXCEPT
Uninitialized.
IMATH_HOSTDEVICE Matrix22(Uninitialized) IMATH_NOEXCEPT
Uninitialized.
IMATH_HOSTDEVICE static constexpr T baseTypeMax() IMATH_NOEXCEPT
Largest possible positive value.
IMATH_HOSTDEVICE constexpr Matrix33 operator+(const Matrix33 &v) const IMATH_NOEXCEPT
Component-wise addition.
#define IMATH_EXPORT_TEMPLATE_TYPE
IMATH_HOSTDEVICE void multDirMatrix(const Vec2< S > &src, Vec2< S > &dst) const IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & operator/=(T a) IMATH_NOEXCEPT
Component-wise division.
IMATH_HOSTDEVICE const Matrix44 & rotate(const Vec3< S > &r) IMATH_NOEXCEPT
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GA_API const UT_StringHolder pivot
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & setAxisAngle(const Vec3< S > &ax, S ang) IMATH_NOEXCEPT
Vec4< T > BaseVecType
The base vector type.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & rotate(S r) IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & setScale(T s) IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T minorOf(const int r, const int c) const IMATH_NOEXCEPT
Calculate the matrix minor of the (r,c) element.
GLubyte GLubyte GLubyte GLubyte w
IMATH_HOSTDEVICE T * getValue() IMATH_NOEXCEPT
Return a raw pointer to the array of values.
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER IMATH_HOSTDEVICE constexpr T abs(T a) IMATH_NOEXCEPT
IMATH_HOSTDEVICE const Matrix44 & setEulerAngles(const Vec3< S > &r) IMATH_NOEXCEPT
IMATH_HOSTDEVICE static constexpr T baseTypeSmallest() IMATH_NOEXCEPT
Smallest possible positive value.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & operator/=(T a) IMATH_NOEXCEPT
Component-wise division.
IMATH_HOSTDEVICE void multDirMatrix(const Vec2< S > &src, Vec2< S > &dst) const IMATH_NOEXCEPT
T x[3][3]
Matrix elements.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & negate() IMATH_NOEXCEPT
Component-wise multiplication by -1.
PUGI__FN char_t * translate(char_t *buffer, const char_t *from, const char_t *to, size_t to_length)
IMATH_HOSTDEVICE static constexpr T baseTypeSmallest() IMATH_NOEXCEPT
Smallest possible positive value.
IMATH_HOSTDEVICE constexpr Matrix22 operator-() const IMATH_NOEXCEPT
Component-wise multiplication by -1.
IMATH_HOSTDEVICE constexpr Matrix44 operator*(T a) const IMATH_NOEXCEPT
Component-wise multiplication.
IMATH_HOSTDEVICE const Matrix33 & setRotation(S r) IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22 & operator/=(T a) IMATH_NOEXCEPT
Component-wise division.
uint64_t multiply(uint64_t lhs, uint64_t rhs)
SYS_API double sin(double x)
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22 & operator-=(const Matrix22 &v) IMATH_NOEXCEPT
Component-wise subtraction.
IMATH_HOSTDEVICE void makeIdentity() IMATH_NOEXCEPT
Set to the identity matrix.
IMATH_HOSTDEVICE void multDirMatrix(const Vec3< S > &src, Vec3< S > &dst) const IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22() IMATH_NOEXCEPT
IMATH_HOSTDEVICE static constexpr T baseTypeMax() IMATH_NOEXCEPT
Largest possible positive value.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & operator=(const Matrix44 &v) IMATH_NOEXCEPT
Assignment operator.