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
103 operator= (const
Matrix22&
v) IMATH_NOEXCEPT;
107 operator= (
T a) IMATH_NOEXCEPT;
110 ~
Matrix22 () IMATH_NOEXCEPT = default;
114 #if IMATH_FOREIGN_VECTOR_INTEROP
133 : Matrix22 (
T (m[0][0]),
T (m[0][1]),
T (m[1][0]),
T (m[1][1]))
141 *
this =
Matrix22 (
T (m[0][0]),
T (m[0][1]),
T (m[1][0]),
T (m[1][1]));
163 setValue (const
Matrix22<
S>&
v) IMATH_NOEXCEPT;
168 setTheMatrix (const
Matrix22<
S>&
v) IMATH_NOEXCEPT;
177 operator== (const
Matrix22&
v) const IMATH_NOEXCEPT;
181 operator!= (const
Matrix22&
v) const IMATH_NOEXCEPT;
201 operator+= (const
Matrix22& v) IMATH_NOEXCEPT;
205 operator+= (
T a) IMATH_NOEXCEPT;
209 operator+ (const
Matrix22& v) const IMATH_NOEXCEPT;
213 operator-= (const
Matrix22& v) IMATH_NOEXCEPT;
217 operator-= (
T a) IMATH_NOEXCEPT;
221 operator- (const
Matrix22& v) const IMATH_NOEXCEPT;
231 operator*= (
T a) IMATH_NOEXCEPT;
238 operator/= (
T a) IMATH_NOEXCEPT;
245 operator*= (const
Matrix22& v) IMATH_NOEXCEPT;
249 operator* (const
Matrix22& v) const IMATH_NOEXCEPT;
284 IMATH_CONSTEXPR14
Matrix22<
T> inverse (
bool singExc) const;
288 inverse () const IMATH_NOEXCEPT;
310 setScale (
T s) IMATH_NOEXCEPT;
316 setScale (const
Vec2<
S>&
s) IMATH_NOEXCEPT;
332 return std::numeric_limits<T>::lowest ();
350 return std::numeric_limits<T>::epsilon ();
431 operator= (const
Matrix33&
v) IMATH_NOEXCEPT;
435 operator= (
T a) IMATH_NOEXCEPT;
438 ~
Matrix33 () IMATH_NOEXCEPT = default;
442 #if IMATH_FOREIGN_VECTOR_INTEROP
511 setValue (const
Matrix33<
S>&
v) IMATH_NOEXCEPT;
516 setTheMatrix (const
Matrix33<
S>&
v) IMATH_NOEXCEPT;
525 operator== (const
Matrix33&
v) const IMATH_NOEXCEPT;
529 operator!= (const
Matrix33&
v) const IMATH_NOEXCEPT;
549 operator+= (const
Matrix33& v) IMATH_NOEXCEPT;
553 operator+= (
T a) IMATH_NOEXCEPT;
557 operator+ (const
Matrix33& v) const IMATH_NOEXCEPT;
561 operator-= (const
Matrix33& v) IMATH_NOEXCEPT;
565 operator-= (
T a) IMATH_NOEXCEPT;
569 operator- (const
Matrix33& v) const IMATH_NOEXCEPT;
579 operator*= (
T a) IMATH_NOEXCEPT;
586 operator/= (
T a) IMATH_NOEXCEPT;
593 operator*= (const
Matrix33& v) IMATH_NOEXCEPT;
597 operator* (const
Matrix33& v) const IMATH_NOEXCEPT;
614 multDirMatrix (const
Vec2<
S>& src,
Vec2<
S>&
dst) const IMATH_NOEXCEPT;
642 IMATH_CONSTEXPR14
Matrix33<
T> inverse (
bool singExc) const;
646 inverse () const IMATH_NOEXCEPT;
652 const
Matrix33& gjInvert (
bool singExc);
661 Matrix33<
T> gjInverse (
bool singExc) const;
669 minorOf (const
int r, const
int c) const IMATH_NOEXCEPT;
674 fastMinor (const
int r0, const
int r1, const
int c0, const
int c1) const
697 setScale (
T s) IMATH_NOEXCEPT;
703 setScale (const
Vec2<
S>&
s) IMATH_NOEXCEPT;
715 setTranslation (const
Vec2<
S>&
t) IMATH_NOEXCEPT;
730 setShear (const
S& h) IMATH_NOEXCEPT;
737 setShear (const
Vec2<
S>& h) IMATH_NOEXCEPT;
743 shear (const
S& xy) IMATH_NOEXCEPT;
760 return std::numeric_limits<T>::lowest ();
778 return std::numeric_limits<T>::epsilon ();
887 operator= (const
Matrix44&
v) IMATH_NOEXCEPT;
891 operator= (
T a) IMATH_NOEXCEPT;
894 ~
Matrix44 () IMATH_NOEXCEPT = default;
898 #if IMATH_FOREIGN_VECTOR_INTEROP
981 setValue (const
Matrix44<
S>&
v) IMATH_NOEXCEPT;
986 setTheMatrix (const
Matrix44<
S>&
v) IMATH_NOEXCEPT;
995 operator== (const
Matrix44&
v) const IMATH_NOEXCEPT;
999 operator!= (const
Matrix44&
v) const IMATH_NOEXCEPT;
1019 operator+= (const
Matrix44& v) IMATH_NOEXCEPT;
1023 operator+= (
T a) IMATH_NOEXCEPT;
1027 operator+ (const
Matrix44& v) const IMATH_NOEXCEPT;
1031 operator-= (const
Matrix44& v) IMATH_NOEXCEPT;
1035 operator-= (
T a) IMATH_NOEXCEPT;
1039 operator- (const
Matrix44& v) const IMATH_NOEXCEPT;
1049 operator*= (
T a) IMATH_NOEXCEPT;
1056 operator/= (
T a) IMATH_NOEXCEPT;
1063 operator*= (const
Matrix44& v) IMATH_NOEXCEPT;
1067 operator* (const
Matrix44& v) const IMATH_NOEXCEPT;
1096 multDirMatrix (const
Vec3<
S>& src,
Vec3<
S>&
dst) const IMATH_NOEXCEPT;
1124 IMATH_CONSTEXPR14
Matrix44<
T> inverse (
bool singExc) const;
1128 inverse () const IMATH_NOEXCEPT;
1134 IMATH_CONSTEXPR14 const
Matrix44& gjInvert (
bool singExc);
1140 gjInvert () IMATH_NOEXCEPT;
1144 Matrix44<
T> gjInverse (
bool singExc) const;
1152 minorOf (const
int r, const
int c) const IMATH_NOEXCEPT;
1156 constexpr
T fastMinor (
1162 const
int c2) const IMATH_NOEXCEPT;
1174 setEulerAngles (const
Vec3<
S>& r) IMATH_NOEXCEPT;
1180 setAxisAngle (const
Vec3<
S>& ax,
S ang) IMATH_NOEXCEPT;
1190 setScale (
T s) IMATH_NOEXCEPT;
1196 setScale (const
Vec3<
S>&
s) IMATH_NOEXCEPT;
1208 setTranslation (const
Vec3<
S>&
t) IMATH_NOEXCEPT;
1212 translation () const IMATH_NOEXCEPT;
1227 setShear (const
Vec3<
S>& h) IMATH_NOEXCEPT;
1239 setShear (const
Shear6<
S>& h) IMATH_NOEXCEPT;
1272 return std::numeric_limits<T>::lowest ();
1290 return std::numeric_limits<T>::epsilon ();
1312 std::ostream& operator<< (std::ostream& s, const Matrix22<T>& m);
1319 std::ostream& operator<< (std::ostream& s, const Matrix33<T>& m);
1328 std::ostream& operator<< (std::ostream& s, const Matrix44<T>& m);
1335 template <
class S,
class T>
1340 template <
class S,
class T>
1345 template <
class S,
class T>
1350 template <
class S,
class T>
1355 template <
class S,
class T>
1360 template <
class S,
class T>
1365 template <
class S,
class T>
1370 template <
class S,
class T>
1375 template <
class S,
class T>
1380 template <
class S,
class T>
1446 const T
a[2][2]) IMATH_NOEXCEPT
1460 T
a, T
b, T
c, T d) IMATH_NOEXCEPT
1476 x[0][0] =
v.x[0][0];
1477 x[0][1] =
v.x[0][1];
1478 x[1][0] =
v.x[1][0];
1479 x[1][1] =
v.x[1][1];
1487 x[0][0] =
T (
v.x[0][0]);
1488 x[0][1] =
T (
v.x[0][1]);
1489 x[1][0] =
T (
v.x[1][0]);
1490 x[1][1] =
T (
v.x[1][1]);
1501 x[0][0] =
v.
x[0][0];
1502 x[0][1] =
v.x[0][1];
1503 x[1][0] =
v.x[1][0];
1504 x[1][1] =
v.x[1][1];
1523 return reinterpret_cast<T*
> (
this);
1530 return reinterpret_cast<const T*
> (
this);
1538 v.x[0][0] =
x[0][0];
1539 v.x[0][1] =
x[0][1];
1540 v.x[1][0] =
x[1][0];
1541 v.x[1][1] =
x[1][1];
1549 x[0][0] =
v.
x[0][0];
1550 x[0][1] =
v.x[0][1];
1551 x[1][0] =
v.x[1][0];
1552 x[1][1] =
v.x[1][1];
1561 x[0][0] =
v.
x[0][0];
1562 x[0][1] =
v.x[0][1];
1563 x[1][0] =
v.x[1][0];
1564 x[1][1] =
v.x[1][1];
1582 return x[0][0] ==
v.x[0][0] &&
x[0][1] ==
v.x[0][1] &&
1583 x[1][0] ==
v.x[1][0] &&
x[1][1] ==
v.x[1][1];
1590 return x[0][0] !=
v.x[0][0] ||
x[0][1] !=
v.x[0][1] ||
1591 x[1][0] !=
v.x[1][0] ||
x[1][1] !=
v.x[1][1];
1598 for (
int i = 0; i < 2; i++)
1599 for (
int j = 0;
j < 2;
j++)
1601 (*this).x[i][
j], m.x[i][j], e))
1611 for (
int i = 0; i < 2; i++)
1612 for (
int j = 0;
j < 2;
j++)
1614 (*this).x[i][
j], m.x[i][j], e))
1624 x[0][0] +=
v.
x[0][0];
1625 x[0][1] +=
v.x[0][1];
1626 x[1][0] +=
v.x[1][0];
1627 x[1][1] +=
v.x[1][1];
1649 x[0][0] +
v.x[0][0],
1650 x[0][1] +
v.x[0][1],
1651 x[1][0] +
v.x[1][0],
1652 x[1][1] +
v.x[1][1]);
1659 x[0][0] -=
v.
x[0][0];
1660 x[0][1] -=
v.x[0][1];
1661 x[1][0] -=
v.x[1][0];
1662 x[1][1] -=
v.x[1][1];
1684 x[0][0] -
v.x[0][0],
1685 x[0][1] -
v.x[0][1],
1686 x[1][0] -
v.x[1][0],
1687 x[1][1] -
v.x[1][1]);
1694 return Matrix22 (-
x[0][0], -
x[0][1], -
x[1][0], -
x[1][1]);
1725 return Matrix22 (
x[0][0] *
a,
x[0][1] * a,
x[1][0] * a,
x[1][1] * a);
1742 for (
int i = 0; i < 2; i++)
1743 for (
int j = 0;
j < 2;
j++)
1744 for (
int k = 0; k < 2; k++)
1745 tmp.
x[i][
j] +=
x[i][k] *
v.x[k][
j];
1757 for (
int i = 0; i < 2; i++)
1758 for (
int j = 0;
j < 2;
j++)
1759 for (
int k = 0; k < 2; k++)
1760 tmp.
x[i][
j] +=
x[i][k] *
v.x[k][
j];
1773 a =
src.x *
x[0][0] +
src.y *
x[1][0];
1774 b =
src.x *
x[0][1] +
src.y *
x[1][1];
1819 *
this = inverse (singExc);
1837 T r =
x[0][0] *
x[1][1] -
x[1][0] *
x[0][1];
1841 for (
int i = 0; i < 2; ++i)
1843 for (
int j = 0;
j < 2; ++
j)
1854 for (
int i = 0; i < 2; ++i)
1856 for (
int j = 0;
j < 2; ++
j)
1865 throw std::invalid_argument (
"Cannot invert "
1866 "singular matrix.");
1881 T r =
x[0][0] *
x[1][1] -
x[1][0] *
x[0][1];
1885 for (
int i = 0; i < 2; ++i)
1887 for (
int j = 0;
j < 2; ++
j)
1898 for (
int i = 0; i < 2; ++i)
1900 for (
int j = 0;
j < 2; ++
j)
1920 return x[0][0] *
x[1][1] -
x[1][0] *
x[0][1];
1927 return x[0][0] +
x[1][1];
1937 cos_r = cos ((
T)
r);
1938 sin_r = sin ((
T) r);
1969 x[0][1] =
static_cast<T> (0);
1970 x[1][0] =
static_cast<T> (0);
1988 x[0][1] =
static_cast<T> (0);
1989 x[1][0] =
static_cast<T> (0);
2059 const T
a[3][3]) IMATH_NOEXCEPT
2078 T
a, T
b, T
c, T d, T e, T
f, T
g, T
h, T i) IMATH_NOEXCEPT
2099 x[0][0] =
v.x[0][0];
2100 x[0][1] =
v.x[0][1];
2101 x[0][2] =
v.x[0][2];
2102 x[1][0] =
v.x[1][0];
2103 x[1][1] =
v.x[1][1];
2104 x[1][2] =
v.x[1][2];
2105 x[2][0] =
v.x[2][0];
2106 x[2][1] =
v.x[2][1];
2107 x[2][2] =
v.x[2][2];
2115 x[0][0] =
T (
v.x[0][0]);
2116 x[0][1] =
T (
v.x[0][1]);
2117 x[0][2] =
T (
v.x[0][2]);
2118 x[1][0] =
T (
v.x[1][0]);
2119 x[1][1] =
T (
v.x[1][1]);
2120 x[1][2] =
T (
v.x[1][2]);
2121 x[2][0] =
T (
v.x[2][0]);
2122 x[2][1] =
T (
v.x[2][1]);
2123 x[2][2] =
T (
v.x[2][2]);
2134 x[0][0] =
v.
x[0][0];
2135 x[0][1] =
v.x[0][1];
2136 x[0][2] =
v.x[0][2];
2137 x[1][0] =
v.x[1][0];
2138 x[1][1] =
v.x[1][1];
2139 x[1][2] =
v.x[1][2];
2140 x[2][0] =
v.x[2][0];
2141 x[2][1] =
v.x[2][1];
2142 x[2][2] =
v.x[2][2];
2166 return reinterpret_cast<T*
> (
this);
2173 return reinterpret_cast<const T*
> (
this);
2181 v.x[0][0] =
x[0][0];
2182 v.x[0][1] =
x[0][1];
2183 v.x[0][2] =
x[0][2];
2184 v.x[1][0] =
x[1][0];
2185 v.x[1][1] =
x[1][1];
2186 v.x[1][2] =
x[1][2];
2187 v.x[2][0] =
x[2][0];
2188 v.x[2][1] =
x[2][1];
2189 v.x[2][2] =
x[2][2];
2197 x[0][0] =
v.
x[0][0];
2198 x[0][1] =
v.x[0][1];
2199 x[0][2] =
v.x[0][2];
2200 x[1][0] =
v.x[1][0];
2201 x[1][1] =
v.x[1][1];
2202 x[1][2] =
v.x[1][2];
2203 x[2][0] =
v.x[2][0];
2204 x[2][1] =
v.x[2][1];
2205 x[2][2] =
v.x[2][2];
2214 x[0][0] =
v.
x[0][0];
2215 x[0][1] =
v.x[0][1];
2216 x[0][2] =
v.x[0][2];
2217 x[1][0] =
v.x[1][0];
2218 x[1][1] =
v.x[1][1];
2219 x[1][2] =
v.x[1][2];
2220 x[2][0] =
v.x[2][0];
2221 x[2][1] =
v.x[2][1];
2222 x[2][2] =
v.x[2][2];
2245 return x[0][0] ==
v.x[0][0] &&
x[0][1] ==
v.x[0][1] &&
2246 x[0][2] ==
v.x[0][2] &&
x[1][0] ==
v.x[1][0] &&
2247 x[1][1] ==
v.x[1][1] &&
x[1][2] ==
v.x[1][2] &&
2248 x[2][0] ==
v.x[2][0] &&
x[2][1] ==
v.x[2][1] &&
x[2][2] ==
v.x[2][2];
2255 return x[0][0] !=
v.x[0][0] ||
x[0][1] !=
v.x[0][1] ||
2256 x[0][2] !=
v.x[0][2] ||
x[1][0] !=
v.x[1][0] ||
2257 x[1][1] !=
v.x[1][1] ||
x[1][2] !=
v.x[1][2] ||
2258 x[2][0] !=
v.x[2][0] ||
x[2][1] !=
v.x[2][1] ||
x[2][2] !=
v.x[2][2];
2265 for (
int i = 0; i < 3; i++)
2266 for (
int j = 0;
j < 3;
j++)
2268 (*
this)[i][
j], m[i][j], e))
2278 for (
int i = 0; i < 3; i++)
2279 for (
int j = 0;
j < 3;
j++)
2281 (*
this)[i][
j], m[i][j], e))
2291 x[0][0] +=
v.
x[0][0];
2292 x[0][1] +=
v.x[0][1];
2293 x[0][2] +=
v.x[0][2];
2294 x[1][0] +=
v.x[1][0];
2295 x[1][1] +=
v.x[1][1];
2296 x[1][2] +=
v.x[1][2];
2297 x[2][0] +=
v.x[2][0];
2298 x[2][1] +=
v.x[2][1];
2299 x[2][2] +=
v.x[2][2];
2326 x[0][0] +
v.x[0][0],
2327 x[0][1] +
v.x[0][1],
2328 x[0][2] +
v.x[0][2],
2329 x[1][0] +
v.x[1][0],
2330 x[1][1] +
v.x[1][1],
2331 x[1][2] +
v.x[1][2],
2332 x[2][0] +
v.x[2][0],
2333 x[2][1] +
v.x[2][1],
2334 x[2][2] +
v.x[2][2]);
2341 x[0][0] -=
v.
x[0][0];
2342 x[0][1] -=
v.x[0][1];
2343 x[0][2] -=
v.x[0][2];
2344 x[1][0] -=
v.x[1][0];
2345 x[1][1] -=
v.x[1][1];
2346 x[1][2] -=
v.x[1][2];
2347 x[2][0] -=
v.x[2][0];
2348 x[2][1] -=
v.x[2][1];
2349 x[2][2] -=
v.x[2][2];
2376 x[0][0] -
v.x[0][0],
2377 x[0][1] -
v.x[0][1],
2378 x[0][2] -
v.x[0][2],
2379 x[1][0] -
v.x[1][0],
2380 x[1][1] -
v.x[1][1],
2381 x[1][2] -
v.x[1][2],
2382 x[2][0] -
v.x[2][0],
2383 x[2][1] -
v.x[2][1],
2384 x[2][2] -
v.x[2][2]);
2470 x[0][0] *
v.x[0][0] +
x[0][1] *
v.x[1][0] +
x[0][2] *
v.x[2][0];
2472 x[0][0] *
v.x[0][1] +
x[0][1] *
v.x[1][1] +
x[0][2] *
v.x[2][1];
2474 x[0][0] *
v.x[0][2] +
x[0][1] *
v.x[1][2] +
x[0][2] *
v.x[2][2];
2477 x[1][0] *
v.x[0][0] +
x[1][1] *
v.x[1][0] +
x[1][2] *
v.x[2][0];
2479 x[1][0] *
v.x[0][1] +
x[1][1] *
v.x[1][1] +
x[1][2] *
v.x[2][1];
2481 x[1][0] *
v.x[0][2] +
x[1][1] *
v.x[1][2] +
x[1][2] *
v.x[2][2];
2484 x[2][0] *
v.x[0][0] +
x[2][1] *
v.x[1][0] +
x[2][2] *
v.x[2][0];
2486 x[2][0] *
v.x[0][1] +
x[2][1] *
v.x[1][1] +
x[2][2] *
v.x[2][1];
2488 x[2][0] *
v.x[0][2] +
x[2][1] *
v.x[1][2] +
x[2][2] *
v.x[2][2];
2503 x[0][0] *
v.x[0][0] +
x[0][1] *
v.x[1][0] +
x[0][2] *
v.x[2][0];
2505 x[0][0] *
v.x[0][1] +
x[0][1] *
v.x[1][1] +
x[0][2] *
v.x[2][1];
2507 x[0][0] *
v.x[0][2] +
x[0][1] *
v.x[1][2] +
x[0][2] *
v.x[2][2];
2510 x[1][0] *
v.x[0][0] +
x[1][1] *
v.x[1][0] +
x[1][2] *
v.x[2][0];
2512 x[1][0] *
v.x[0][1] +
x[1][1] *
v.x[1][1] +
x[1][2] *
v.x[2][1];
2514 x[1][0] *
v.x[0][2] +
x[1][1] *
v.x[1][2] +
x[1][2] *
v.x[2][2];
2517 x[2][0] *
v.x[0][0] +
x[2][1] *
v.x[1][0] +
x[2][2] *
v.x[2][0];
2519 x[2][0] *
v.x[0][1] +
x[2][1] *
v.x[1][1] +
x[2][2] *
v.x[2][1];
2521 x[2][0] *
v.x[0][2] +
x[2][1] *
v.x[1][2] +
x[2][2] *
v.x[2][2];
2534 a =
src.x *
x[0][0] +
src.y *
x[1][0] +
x[2][0];
2535 b =
src.x * x[0][1] +
src.y * x[1][1] + x[2][1];
2536 w =
src.x * x[0][2] +
src.y * x[1][2] + x[2][2];
2550 a =
src.x *
x[0][0] +
src.y *
x[1][0];
2551 b =
src.x *
x[0][1] +
src.y *
x[1][1];
2628 *
this = gjInverse (singExc);
2636 *
this = gjInverse ();
2650 for (i = 0; i < 2; i++)
2654 T pivotsize = t.
x[i][i];
2656 if (pivotsize < 0) pivotsize = -pivotsize;
2658 for (j = i + 1; j < 3; j++)
2662 if (tmp < 0) tmp = -tmp;
2664 if (tmp > pivotsize)
2674 throw std::invalid_argument (
"Cannot invert singular matrix.");
2681 for (j = 0; j < 3; j++)
2695 for (j = i + 1; j < 3; j++)
2697 T f = t.
x[
j][i] / t.
x[i][i];
2699 for (k = 0; k < 3; k++)
2701 t.
x[
j][k] -= f * t.
x[i][k];
2702 s.
x[
j][k] -= f * s.
x[i][k];
2709 for (i = 2; i >= 0; --i)
2713 if ((f = t[i][i]) == 0)
2716 throw std::invalid_argument (
"Cannot invert singular matrix.");
2721 for (j = 0; j < 3; j++)
2727 for (j = 0; j < i; j++)
2731 for (k = 0; k < 3; k++)
2733 t.
x[
j][k] -= f * t.
x[i][k];
2734 s.
x[
j][k] -= f * s.
x[i][k];
2752 for (i = 0; i < 2; i++)
2756 T pivotsize = t.
x[i][i];
2758 if (pivotsize < 0) pivotsize = -pivotsize;
2760 for (j = i + 1; j < 3; j++)
2764 if (tmp < 0) tmp = -tmp;
2766 if (tmp > pivotsize)
2773 if (pivotsize == 0) {
return Matrix33 (); }
2777 for (j = 0; j < 3; j++)
2791 for (j = i + 1; j < 3; j++)
2793 T f = t.
x[
j][i] / t.
x[i][i];
2795 for (k = 0; k < 3; k++)
2797 t.
x[
j][k] -= f * t.
x[i][k];
2798 s.
x[
j][k] -= f * s.
x[i][k];
2805 for (i = 2; i >= 0; --i)
2809 if ((f = t.
x[i][i]) == 0) {
return Matrix33 (); }
2811 for (j = 0; j < 3; j++)
2817 for (j = 0; j < i; j++)
2821 for (k = 0; k < 3; k++)
2823 t.
x[
j][k] -= f * t.
x[i][k];
2824 s.
x[
j][k] -= f * s.
x[i][k];
2836 *
this = inverse (singExc);
2852 if (
x[0][2] != 0 ||
x[1][2] != 0 ||
x[2][2] != 1)
2855 x[1][1] *
x[2][2] -
x[2][1] *
x[1][2],
2856 x[2][1] * x[0][2] - x[0][1] * x[2][2],
2857 x[0][1] * x[1][2] - x[1][1] * x[0][2],
2859 x[2][0] * x[1][2] - x[1][0] * x[2][2],
2860 x[0][0] * x[2][2] - x[2][0] * x[0][2],
2861 x[1][0] * x[0][2] - x[0][0] * x[1][2],
2863 x[1][0] * x[2][1] - x[2][0] * x[1][1],
2864 x[2][0] * x[0][1] - x[0][0] * x[2][1],
2865 x[0][0] * x[1][1] - x[1][0] * x[0][1]);
2867 T r = x[0][0] * s[0][0] + x[0][1] * s[1][0] + x[0][2] * s[2][0];
2871 for (
int i = 0; i < 3; ++i)
2873 for (
int j = 0;
j < 3; ++
j)
2884 for (
int i = 0; i < 3; ++i)
2886 for (
int j = 0;
j < 3; ++
j)
2895 throw std::invalid_argument (
"Cannot invert "
2896 "singular matrix.");
2920 T r =
x[0][0] *
x[1][1] -
x[1][0] *
x[0][1];
2924 for (
int i = 0; i < 2; ++i)
2926 for (
int j = 0;
j < 2; ++
j)
2937 for (
int i = 0; i < 2; ++i)
2939 for (
int j = 0;
j < 2; ++
j)
2948 throw std::invalid_argument (
"Cannot invert "
2949 "singular matrix.");
2956 s.
x[2][0] = -x[2][0] * s.
x[0][0] - x[2][1] * s.
x[1][0];
2957 s.
x[2][1] = -x[2][0] * s.
x[0][1] - x[2][1] * s.
x[1][1];
2967 if (
x[0][2] != 0 ||
x[1][2] != 0 ||
x[2][2] != 1)
2970 x[1][1] *
x[2][2] -
x[2][1] *
x[1][2],
2971 x[2][1] * x[0][2] - x[0][1] * x[2][2],
2972 x[0][1] * x[1][2] - x[1][1] * x[0][2],
2974 x[2][0] * x[1][2] - x[1][0] * x[2][2],
2975 x[0][0] * x[2][2] - x[2][0] * x[0][2],
2976 x[1][0] * x[0][2] - x[0][0] * x[1][2],
2978 x[1][0] * x[2][1] - x[2][0] * x[1][1],
2979 x[2][0] * x[0][1] - x[0][0] * x[2][1],
2980 x[0][0] * x[1][1] - x[1][0] * x[0][1]);
2982 T r = x[0][0] * s.
x[0][0] + x[0][1] * s.
x[1][0] + x[0][2] * s.
x[2][0];
2986 for (
int i = 0; i < 3; ++i)
2988 for (
int j = 0;
j < 3; ++
j)
2999 for (
int i = 0; i < 3; ++i)
3001 for (
int j = 0;
j < 3; ++
j)
3032 T r =
x[0][0] *
x[1][1] -
x[1][0] *
x[0][1];
3036 for (
int i = 0; i < 2; ++i)
3038 for (
int j = 0;
j < 2; ++
j)
3049 for (
int i = 0; i < 2; ++i)
3051 for (
int j = 0;
j < 2; ++
j)
3065 s.
x[2][0] = -x[2][0] * s.
x[0][0] - x[2][1] * s.
x[1][0];
3066 s.
x[2][1] = -x[2][0] * s.
x[0][1] - x[2][1] * s.
x[1][1];
3076 int r0 = 0 + (
r < 1 ? 1 : 0);
3077 int r1 = 1 + (
r < 2 ? 1 : 0);
3078 int c0 = 0 + (
c < 1 ? 1 : 0);
3079 int c1 = 1 + (
c < 2 ? 1 : 0);
3081 return x[r0][c0] *
x[r1][c1] -
x[r1][c0] *
x[r0][c1];
3087 const int r0,
const int r1,
const int c0,
const int c1)
const IMATH_NOEXCEPT
3089 return x[r0][c0] *
x[r1][c1] -
x[r0][c1] *
x[r1][c0];
3096 return x[0][0] * (
x[1][1] *
x[2][2] -
x[1][2] *
x[2][1]) +
3097 x[0][1] * (
x[1][2] *
x[2][0] -
x[1][0] *
x[2][2]) +
3098 x[0][2] * (x[1][0] * x[2][1] - x[1][1] * x[2][0]);
3105 return x[0][0] +
x[1][1] +
x[2][2];
3115 cos_r = cos ((
T)
r);
3116 sin_r = sin ((
T) r);
3237 x[2][0] +=
t.
x *
x[0][0] +
t.y *
x[1][0];
3238 x[2][1] +=
t.x *
x[0][1] +
t.y *
x[1][1];
3239 x[2][2] +=
t.x *
x[0][2] +
t.y *
x[1][2];
3295 x[1][0] += xy *
x[0][0];
3296 x[1][1] += xy * x[0][1];
3297 x[1][2] += xy * x[0][2];
3309 x[0][0] = P.
x[0][0] +
h.y * P.
x[1][0];
3310 x[0][1] = P.
x[0][1] +
h.y * P.
x[1][1];
3311 x[0][2] = P.
x[0][2] +
h.y * P.
x[1][2];
3313 x[1][0] = P.
x[1][0] +
h.x * P.
x[0][0];
3314 x[1][1] = P.
x[1][1] +
h.x * P.
x[0][1];
3315 x[1][2] = P.
x[1][2] +
h.x * P.
x[0][2];
3384 const T
a[4][4]) IMATH_NOEXCEPT
3445 x[0][0] =
r.x[0][0];
3446 x[0][1] =
r.x[0][1];
3447 x[0][2] =
r.x[0][2];
3449 x[1][0] =
r.x[1][0];
3450 x[1][1] =
r.x[1][1];
3451 x[1][2] =
r.x[1][2];
3453 x[2][0] =
r.x[2][0];
3454 x[2][1] =
r.x[2][1];
3455 x[2][2] =
r.x[2][2];
3467 x[0][0] =
v.x[0][0];
3468 x[0][1] =
v.x[0][1];
3469 x[0][2] =
v.x[0][2];
3470 x[0][3] =
v.x[0][3];
3471 x[1][0] =
v.x[1][0];
3472 x[1][1] =
v.x[1][1];
3473 x[1][2] =
v.x[1][2];
3474 x[1][3] =
v.x[1][3];
3475 x[2][0] =
v.x[2][0];
3476 x[2][1] =
v.x[2][1];
3477 x[2][2] =
v.x[2][2];
3478 x[2][3] =
v.x[2][3];
3479 x[3][0] =
v.x[3][0];
3480 x[3][1] =
v.x[3][1];
3481 x[3][2] =
v.x[3][2];
3482 x[3][3] =
v.x[3][3];
3490 x[0][0] =
T (
v.x[0][0]);
3491 x[0][1] =
T (
v.x[0][1]);
3492 x[0][2] =
T (
v.x[0][2]);
3493 x[0][3] =
T (
v.x[0][3]);
3494 x[1][0] =
T (
v.x[1][0]);
3495 x[1][1] =
T (
v.x[1][1]);
3496 x[1][2] =
T (
v.x[1][2]);
3497 x[1][3] =
T (
v.x[1][3]);
3498 x[2][0] =
T (
v.x[2][0]);
3499 x[2][1] =
T (
v.x[2][1]);
3500 x[2][2] =
T (
v.x[2][2]);
3501 x[2][3] =
T (
v.x[2][3]);
3502 x[3][0] =
T (
v.x[3][0]);
3503 x[3][1] =
T (
v.x[3][1]);
3504 x[3][2] =
T (
v.x[3][2]);
3505 x[3][3] =
T (
v.x[3][3]);
3512 x[0][0] =
v.
x[0][0];
3513 x[0][1] =
v.x[0][1];
3514 x[0][2] =
v.x[0][2];
3515 x[0][3] =
v.x[0][3];
3516 x[1][0] =
v.x[1][0];
3517 x[1][1] =
v.x[1][1];
3518 x[1][2] =
v.x[1][2];
3519 x[1][3] =
v.x[1][3];
3520 x[2][0] =
v.x[2][0];
3521 x[2][1] =
v.x[2][1];
3522 x[2][2] =
v.x[2][2];
3523 x[2][3] =
v.x[2][3];
3524 x[3][0] =
v.x[3][0];
3525 x[3][1] =
v.x[3][1];
3526 x[3][2] =
v.x[3][2];
3527 x[3][3] =
v.x[3][3];
3558 return reinterpret_cast<T*
> (
this);
3565 return reinterpret_cast<const T*
> (
this);
3573 v.x[0][0] =
x[0][0];
3574 v.x[0][1] =
x[0][1];
3575 v.x[0][2] =
x[0][2];
3576 v.x[0][3] =
x[0][3];
3577 v.x[1][0] =
x[1][0];
3578 v.x[1][1] =
x[1][1];
3579 v.x[1][2] =
x[1][2];
3580 v.x[1][3] =
x[1][3];
3581 v.x[2][0] =
x[2][0];
3582 v.x[2][1] =
x[2][1];
3583 v.x[2][2] =
x[2][2];
3584 v.x[2][3] =
x[2][3];
3585 v.x[3][0] =
x[3][0];
3586 v.x[3][1] =
x[3][1];
3587 v.x[3][2] =
x[3][2];
3588 v.x[3][3] =
x[3][3];
3596 x[0][0] =
T(
v.x[0][0]);
3597 x[0][1] =
T(
v.x[0][1]);
3598 x[0][2] =
T(
v.x[0][2]);
3599 x[0][3] =
T(
v.x[0][3]);
3600 x[1][0] =
T(
v.x[1][0]);
3601 x[1][1] =
T(
v.x[1][1]);
3602 x[1][2] =
T(
v.x[1][2]);
3603 x[1][3] =
T(
v.x[1][3]);
3604 x[2][0] =
T(
v.x[2][0]);
3605 x[2][1] =
T(
v.x[2][1]);
3606 x[2][2] =
T(
v.x[2][2]);
3607 x[2][3] =
T(
v.x[2][3]);
3608 x[3][0] =
T(
v.x[3][0]);
3609 x[3][1] =
T(
v.x[3][1]);
3610 x[3][2] =
T(
v.x[3][2]);
3611 x[3][3] =
T(
v.x[3][3]);
3620 x[0][0] =
v.
x[0][0];
3621 x[0][1] =
v.x[0][1];
3622 x[0][2] =
v.x[0][2];
3623 x[0][3] =
v.x[0][3];
3624 x[1][0] =
v.x[1][0];
3625 x[1][1] =
v.x[1][1];
3626 x[1][2] =
v.x[1][2];
3627 x[1][3] =
v.x[1][3];
3628 x[2][0] =
v.x[2][0];
3629 x[2][1] =
v.x[2][1];
3630 x[2][2] =
v.x[2][2];
3631 x[2][3] =
v.x[2][3];
3632 x[3][0] =
v.x[3][0];
3633 x[3][1] =
v.x[3][1];
3634 x[3][2] =
v.x[3][2];
3635 x[3][3] =
v.x[3][3];
3665 return x[0][0] ==
v.x[0][0] &&
x[0][1] ==
v.x[0][1] &&
3666 x[0][2] ==
v.x[0][2] &&
x[0][3] ==
v.x[0][3] &&
3667 x[1][0] ==
v.x[1][0] &&
x[1][1] ==
v.x[1][1] &&
3668 x[1][2] ==
v.x[1][2] &&
x[1][3] ==
v.x[1][3] &&
3669 x[2][0] ==
v.x[2][0] &&
x[2][1] ==
v.x[2][1] &&
3670 x[2][2] ==
v.x[2][2] &&
x[2][3] ==
v.x[2][3] &&
3671 x[3][0] ==
v.x[3][0] &&
x[3][1] ==
v.x[3][1] &&
3672 x[3][2] ==
v.x[3][2] &&
x[3][3] ==
v.x[3][3];
3679 return x[0][0] !=
v.x[0][0] ||
x[0][1] !=
v.x[0][1] ||
3680 x[0][2] !=
v.x[0][2] ||
x[0][3] !=
v.x[0][3] ||
3681 x[1][0] !=
v.x[1][0] ||
x[1][1] !=
v.x[1][1] ||
3682 x[1][2] !=
v.x[1][2] ||
x[1][3] !=
v.x[1][3] ||
3683 x[2][0] !=
v.x[2][0] ||
x[2][1] !=
v.x[2][1] ||
3684 x[2][2] !=
v.x[2][2] ||
x[2][3] !=
v.x[2][3] ||
3685 x[3][0] !=
v.x[3][0] ||
x[3][1] !=
v.x[3][1] ||
3686 x[3][2] !=
v.x[3][2] ||
x[3][3] !=
v.x[3][3];
3693 for (
int i = 0; i < 4; i++)
3694 for (
int j = 0;
j < 4;
j++)
3696 (*this).x[i][
j], m.x[i][j], e))
3706 for (
int i = 0; i < 4; i++)
3707 for (
int j = 0;
j < 4;
j++)
3709 (*this).x[i][
j], m.x[i][j], e))
3719 x[0][0] +=
v.
x[0][0];
3720 x[0][1] +=
v.x[0][1];
3721 x[0][2] +=
v.x[0][2];
3722 x[0][3] +=
v.x[0][3];
3723 x[1][0] +=
v.x[1][0];
3724 x[1][1] +=
v.x[1][1];
3725 x[1][2] +=
v.x[1][2];
3726 x[1][3] +=
v.x[1][3];
3727 x[2][0] +=
v.x[2][0];
3728 x[2][1] +=
v.x[2][1];
3729 x[2][2] +=
v.x[2][2];
3730 x[2][3] +=
v.x[2][3];
3731 x[3][0] +=
v.x[3][0];
3732 x[3][1] +=
v.x[3][1];
3733 x[3][2] +=
v.x[3][2];
3734 x[3][3] +=
v.x[3][3];
3768 x[0][0] +
v.x[0][0],
3769 x[0][1] +
v.x[0][1],
3770 x[0][2] +
v.x[0][2],
3771 x[0][3] +
v.x[0][3],
3772 x[1][0] +
v.x[1][0],
3773 x[1][1] +
v.x[1][1],
3774 x[1][2] +
v.x[1][2],
3775 x[1][3] +
v.x[1][3],
3776 x[2][0] +
v.x[2][0],
3777 x[2][1] +
v.x[2][1],
3778 x[2][2] +
v.x[2][2],
3779 x[2][3] +
v.x[2][3],
3780 x[3][0] +
v.x[3][0],
3781 x[3][1] +
v.x[3][1],
3782 x[3][2] +
v.x[3][2],
3783 x[3][3] +
v.x[3][3]);
3790 x[0][0] -=
v.
x[0][0];
3791 x[0][1] -=
v.x[0][1];
3792 x[0][2] -=
v.x[0][2];
3793 x[0][3] -=
v.x[0][3];
3794 x[1][0] -=
v.x[1][0];
3795 x[1][1] -=
v.x[1][1];
3796 x[1][2] -=
v.x[1][2];
3797 x[1][3] -=
v.x[1][3];
3798 x[2][0] -=
v.x[2][0];
3799 x[2][1] -=
v.x[2][1];
3800 x[2][2] -=
v.x[2][2];
3801 x[2][3] -=
v.x[2][3];
3802 x[3][0] -=
v.x[3][0];
3803 x[3][1] -=
v.x[3][1];
3804 x[3][2] -=
v.x[3][2];
3805 x[3][3] -=
v.x[3][3];
3839 x[0][0] -
v.x[0][0],
3840 x[0][1] -
v.x[0][1],
3841 x[0][2] -
v.x[0][2],
3842 x[0][3] -
v.x[0][3],
3843 x[1][0] -
v.x[1][0],
3844 x[1][1] -
v.x[1][1],
3845 x[1][2] -
v.x[1][2],
3846 x[1][3] -
v.x[1][3],
3847 x[2][0] -
v.x[2][0],
3848 x[2][1] -
v.x[2][1],
3849 x[2][2] -
v.x[2][2],
3850 x[2][3] -
v.x[2][3],
3851 x[3][0] -
v.x[3][0],
3852 x[3][1] -
v.x[3][1],
3853 x[3][2] -
v.x[3][2],
3854 x[3][3] -
v.x[3][3]);
3963 const auto a00 =
a.x[0][0];
3964 const auto a01 =
a.x[0][1];
3965 const auto a02 =
a.x[0][2];
3966 const auto a03 =
a.x[0][3];
3969 a00 *
b.x[0][0] + a01 *
b.x[1][0] + a02 *
b.x[2][0] + a03 *
b.x[3][0];
3971 a00 *
b.x[0][1] + a01 *
b.x[1][1] + a02 *
b.x[2][1] + a03 *
b.x[3][1];
3973 a00 *
b.x[0][2] + a01 *
b.x[1][2] + a02 *
b.x[2][2] + a03 *
b.x[3][2];
3975 a00 *
b.x[0][3] + a01 *
b.x[1][3] + a02 *
b.x[2][3] + a03 *
b.x[3][3];
3977 const auto a10 =
a.x[1][0];
3978 const auto a11 =
a.x[1][1];
3979 const auto a12 =
a.x[1][2];
3980 const auto a13 =
a.x[1][3];
3983 a10 *
b.x[0][0] + a11 *
b.x[1][0] + a12 *
b.x[2][0] + a13 *
b.x[3][0];
3985 a10 *
b.x[0][1] + a11 *
b.x[1][1] + a12 *
b.x[2][1] + a13 *
b.x[3][1];
3987 a10 *
b.x[0][2] + a11 *
b.x[1][2] + a12 *
b.x[2][2] + a13 *
b.x[3][2];
3989 a10 *
b.x[0][3] + a11 *
b.x[1][3] + a12 *
b.x[2][3] + a13 *
b.x[3][3];
3991 const auto a20 =
a.x[2][0];
3992 const auto a21 =
a.x[2][1];
3993 const auto a22 =
a.x[2][2];
3994 const auto a23 =
a.x[2][3];
3997 a20 *
b.x[0][0] + a21 *
b.x[1][0] + a22 *
b.x[2][0] + a23 *
b.x[3][0];
3999 a20 *
b.x[0][1] + a21 *
b.x[1][1] + a22 *
b.x[2][1] + a23 *
b.x[3][1];
4001 a20 *
b.x[0][2] + a21 *
b.x[1][2] + a22 *
b.x[2][2] + a23 *
b.x[3][2];
4003 a20 *
b.x[0][3] + a21 *
b.x[1][3] + a22 *
b.x[2][3] + a23 *
b.x[3][3];
4005 const auto a30 =
a.x[3][0];
4006 const auto a31 =
a.x[3][1];
4007 const auto a32 =
a.x[3][2];
4008 const auto a33 =
a.x[3][3];
4011 a30 *
b.x[0][0] + a31 *
b.x[1][0] + a32 *
b.x[2][0] + a33 *
b.x[3][0];
4013 a30 *
b.x[0][1] + a31 *
b.x[1][1] + a32 *
b.x[2][1] + a33 *
b.x[3][1];
4015 a30 *
b.x[0][2] + a31 *
b.x[1][2] + a32 *
b.x[2][2] + a33 *
b.x[3][2];
4017 a30 *
b.x[0][3] + a31 *
b.x[1][3] + a32 *
b.x[2][3] + a33 *
b.x[3][3];
4068 a =
src.x *
x[0][0] +
src.y *
x[1][0] +
src.z *
x[2][0] +
x[3][0];
4069 b =
src.x * x[0][1] +
src.y * x[1][1] +
src.z * x[2][1] + x[3][1];
4070 c =
src.x * x[0][2] +
src.y * x[1][2] +
src.z * x[2][2] + x[3][2];
4071 w =
src.x * x[0][3] +
src.y * x[1][3] +
src.z * x[2][3] + x[3][3];
4086 a =
src.x *
x[0][0] +
src.y *
x[1][0] +
src.z *
x[2][0];
4087 b =
src.x *
x[0][1] +
src.y *
x[1][1] +
src.z *
x[2][1];
4088 c =
src.x *
x[0][2] +
src.y *
x[1][2] +
src.z *
x[2][2];
4194 *
this = gjInverse (singExc);
4202 *
this = gjInverse ();
4216 for (i = 0; i < 3; i++)
4220 T pivotsize = t.
x[i][i];
4222 if (pivotsize < 0) pivotsize = -pivotsize;
4224 for (j = i + 1; j < 4; j++)
4228 if (tmp < 0) tmp = -tmp;
4230 if (tmp > pivotsize)
4240 throw std::invalid_argument (
"Cannot invert singular matrix.");
4247 for (j = 0; j < 4; j++)
4261 for (j = i + 1; j < 4; j++)
4263 T f = t.
x[
j][i] / t.
x[i][i];
4265 for (k = 0; k < 4; k++)
4267 t.
x[
j][k] -= f * t.
x[i][k];
4268 s.
x[
j][k] -= f * s.
x[i][k];
4275 for (i = 3; i >= 0; --i)
4279 if ((f = t.
x[i][i]) == 0)
4282 throw std::invalid_argument (
"Cannot invert singular matrix.");
4287 for (j = 0; j < 4; j++)
4293 for (j = 0; j < i; j++)
4297 for (k = 0; k < 4; k++)
4299 t.
x[
j][k] -= f * t.
x[i][k];
4300 s.
x[
j][k] -= f * s.
x[i][k];
4318 for (i = 0; i < 3; i++)
4322 T pivotsize = t.
x[i][i];
4324 if (pivotsize < 0) pivotsize = -pivotsize;
4326 for (j = i + 1; j < 4; j++)
4330 if (tmp < 0) tmp = -tmp;
4332 if (tmp > pivotsize)
4339 if (pivotsize == 0) {
return Matrix44 (); }
4343 for (j = 0; j < 4; j++)
4357 for (j = i + 1; j < 4; j++)
4359 T f = t.
x[
j][i] / t.
x[i][i];
4361 for (k = 0; k < 4; k++)
4363 t.
x[
j][k] -= f * t.
x[i][k];
4364 s.
x[
j][k] -= f * s.
x[i][k];
4371 for (i = 3; i >= 0; --i)
4375 if ((f = t.
x[i][i]) == 0) {
return Matrix44 (); }
4377 for (j = 0; j < 4; j++)
4383 for (j = 0; j < i; j++)
4387 for (k = 0; k < 4; k++)
4389 t.
x[
j][k] -= f * t.
x[i][k];
4390 s.
x[
j][k] -= f * s.
x[i][k];
4402 *
this = inverse (singExc);
4418 if (
x[0][3] != 0 ||
x[1][3] != 0 ||
x[2][3] != 0 ||
x[3][3] != 1)
4419 return gjInverse (singExc);
4422 x[1][1] *
x[2][2] -
x[2][1] *
x[1][2],
4423 x[2][1] * x[0][2] - x[0][1] * x[2][2],
4424 x[0][1] * x[1][2] - x[1][1] * x[0][2],
4427 x[2][0] * x[1][2] - x[1][0] * x[2][2],
4428 x[0][0] * x[2][2] - x[2][0] * x[0][2],
4429 x[1][0] * x[0][2] - x[0][0] * x[1][2],
4432 x[1][0] * x[2][1] - x[2][0] * x[1][1],
4433 x[2][0] * x[0][1] - x[0][0] * x[2][1],
4434 x[0][0] * x[1][1] - x[1][0] * x[0][1],
4442 T r = x[0][0] * s.
x[0][0] + x[0][1] * s.
x[1][0] + x[0][2] * s.
x[2][0];
4446 for (
int i = 0; i < 3; ++i)
4448 for (
int j = 0;
j < 3; ++
j)
4459 for (
int i = 0; i < 3; ++i)
4461 for (
int j = 0;
j < 3; ++
j)
4470 throw std::invalid_argument (
4471 "Cannot invert singular matrix.");
4480 -x[3][0] * s.
x[0][0] - x[3][1] * s.
x[1][0] - x[3][2] * s.
x[2][0];
4482 -x[3][0] * s.
x[0][1] - x[3][1] * s.
x[1][1] - x[3][2] * s.
x[2][1];
4484 -x[3][0] * s.
x[0][2] - x[3][1] * s.
x[1][2] - x[3][2] * s.
x[2][2];
4493 if (
x[0][3] != 0 ||
x[1][3] != 0 ||
x[2][3] != 0 ||
x[3][3] != 1)
4494 return gjInverse ();
4497 x[1][1] *
x[2][2] -
x[2][1] *
x[1][2],
4498 x[2][1] * x[0][2] - x[0][1] * x[2][2],
4499 x[0][1] * x[1][2] - x[1][1] * x[0][2],
4502 x[2][0] * x[1][2] - x[1][0] * x[2][2],
4503 x[0][0] * x[2][2] - x[2][0] * x[0][2],
4504 x[1][0] * x[0][2] - x[0][0] * x[1][2],
4507 x[1][0] * x[2][1] - x[2][0] * x[1][1],
4508 x[2][0] * x[0][1] - x[0][0] * x[2][1],
4509 x[0][0] * x[1][1] - x[1][0] * x[0][1],
4517 T r = x[0][0] * s.
x[0][0] + x[0][1] * s.
x[1][0] + x[0][2] * s.
x[2][0];
4521 for (
int i = 0; i < 3; ++i)
4523 for (
int j = 0;
j < 3; ++
j)
4534 for (
int i = 0; i < 3; ++i)
4536 for (
int j = 0;
j < 3; ++
j)
4551 -x[3][0] * s.
x[0][0] - x[3][1] * s.
x[1][0] - x[3][2] * s.
x[2][0];
4553 -x[3][0] * s.
x[0][1] - x[3][1] * s.
x[1][1] - x[3][2] * s.
x[2][1];
4555 -x[3][0] * s.
x[0][2] - x[3][1] * s.
x[1][2] - x[3][2] * s.
x[2][2];
4568 const int c2)
const IMATH_NOEXCEPT
4570 return x[r0][c0] * (
x[r1][c1] *
x[r2][c2] -
x[r1][c2] *
x[r2][c1]) +
4571 x[r0][c1] * (
x[r1][c2] *
x[r2][c0] -
x[r1][c0] *
x[r2][c2]) +
4572 x[r0][c2] * (
x[r1][c0] *
x[r2][c1] -
x[r1][c1] *
x[r2][c0]);
4579 int r0 = 0 + (
r < 1 ? 1 : 0);
4580 int r1 = 1 + (
r < 2 ? 1 : 0);
4581 int r2 = 2 + (
r < 3 ? 1 : 0);
4582 int c0 = 0 + (
c < 1 ? 1 : 0);
4583 int c1 = 1 + (
c < 2 ? 1 : 0);
4584 int c2 = 2 + (
c < 3 ? 1 : 0);
4606 if (
x[0][3] != 0.) sum -=
x[0][3] * fastMinor (1, 2, 3, 0, 1, 2);
4607 if (
x[1][3] != 0.) sum +=
x[1][3] * fastMinor (0, 2, 3, 0, 1, 2);
4608 if (
x[2][3] != 0.) sum -=
x[2][3] * fastMinor (0, 1, 3, 0, 1, 2);
4609 if (
x[3][3] != 0.) sum +=
x[3][3] * fastMinor (0, 1, 2, 0, 1, 2);
4618 return x[0][0] +
x[1][1] +
x[2][2] +
x[3][3];
4626 S cos_rz, sin_rz, cos_ry, sin_ry, cos_rx, sin_rx;
4628 cos_rz = cos ((
T)
r.z);
4629 cos_ry = cos ((
T)
r.y);
4630 cos_rx = cos ((
T)
r.x);
4632 sin_rz = sin ((
T)
r.z);
4633 sin_ry = sin ((
T)
r.y);
4634 sin_rx = sin ((
T)
r.x);
4636 x[0][0] = cos_rz * cos_ry;
4637 x[0][1] = sin_rz * cos_ry;
4641 x[1][0] = -sin_rz * cos_rx + cos_rz * sin_ry * sin_rx;
4642 x[1][1] = cos_rz * cos_rx + sin_rz * sin_ry * sin_rx;
4643 x[1][2] = cos_ry * sin_rx;
4646 x[2][0] = sin_rz * sin_rx + cos_rz * sin_ry * cos_rx;
4647 x[2][1] = -cos_rz * sin_rx + sin_rz * sin_ry * cos_rx;
4648 x[2][2] = cos_ry * cos_rx;
4665 S sine = std::sin (
angle);
4666 S cosine = std::cos (
angle);
4668 x[0][0] =
unit.x *
unit.x * (1 - cosine) + cosine;
4674 x[1][1] =
unit.y *
unit.y * (1 - cosine) + cosine;
4680 x[2][2] =
unit.z *
unit.z * (1 - cosine) + cosine;
4696 S cos_rz, sin_rz, cos_ry, sin_ry, cos_rx, sin_rx;
4701 cos_rz = cos ((
S)
r.z);
4702 cos_ry = cos ((
S)
r.y);
4703 cos_rx = cos ((
S)
r.x);
4705 sin_rz = sin ((
S)
r.z);
4706 sin_ry = sin ((
S)
r.y);
4707 sin_rx = sin ((
S)
r.x);
4709 m00 = cos_rz * cos_ry;
4710 m01 = sin_rz * cos_ry;
4712 m10 = -sin_rz * cos_rx + cos_rz * sin_ry * sin_rx;
4713 m11 = cos_rz * cos_rx + sin_rz * sin_ry * sin_rx;
4714 m12 = cos_ry * sin_rx;
4715 m20 = -sin_rz * -sin_rx + cos_rz * sin_ry * cos_rx;
4716 m21 = cos_rz * -sin_rx + sin_rz * sin_ry * cos_rx;
4717 m22 = cos_ry * cos_rx;
4721 x[0][0] = P.
x[0][0] * m00 + P.
x[1][0] * m01 + P.
x[2][0] * m02;
4722 x[0][1] = P.
x[0][1] * m00 + P.
x[1][1] * m01 + P.
x[2][1] * m02;
4723 x[0][2] = P.
x[0][2] * m00 + P.
x[1][2] * m01 + P.
x[2][2] * m02;
4724 x[0][3] = P.
x[0][3] * m00 + P.
x[1][3] * m01 + P.
x[2][3] * m02;
4726 x[1][0] = P.
x[0][0] * m10 + P.
x[1][0] * m11 + P.
x[2][0] * m12;
4727 x[1][1] = P.
x[0][1] * m10 + P.
x[1][1] * m11 + P.
x[2][1] * m12;
4728 x[1][2] = P.
x[0][2] * m10 + P.
x[1][2] * m11 + P.
x[2][2] * m12;
4729 x[1][3] = P.
x[0][3] * m10 + P.
x[1][3] * m11 + P.
x[2][3] * m12;
4731 x[2][0] = P.
x[0][0] * m20 + P.
x[1][0] * m21 + P.
x[2][0] * m22;
4732 x[2][1] = P.
x[0][1] * m20 + P.
x[1][1] * m21 + P.
x[2][1] * m22;
4733 x[2][2] = P.
x[0][2] * m20 + P.
x[1][2] * m21 + P.
x[2][2] * m22;
4734 x[2][3] = P.
x[0][3] * m20 + P.
x[1][3] * m21 + P.
x[2][3] * m22;
4857 return Vec3<T> (
x[3][0], x[3][1], x[3][2]);
4865 x[3][0] +=
t.
x *
x[0][0] +
t.y *
x[1][0] +
t.z *
x[2][0];
4866 x[3][1] +=
t.x *
x[0][1] +
t.y *
x[1][1] +
t.z *
x[2][1];
4867 x[3][2] +=
t.x *
x[0][2] +
t.y *
x[1][2] +
t.z *
x[2][2];
4868 x[3][3] +=
t.x *
x[0][3] +
t.y *
x[1][3] +
t.z *
x[2][3];
4940 for (
int i = 0; i < 4; i++)
4942 x[2][i] +=
h.y *
x[0][i] +
h.z *
x[1][i];
4943 x[1][i] +=
h.
x *
x[0][i];
4956 for (
int i = 0; i < 4; i++)
4958 x[0][i] = P.
x[0][i] +
h.yx * P.
x[1][i] +
h.zx * P.
x[2][i];
4959 x[1][i] =
h.xy * P.
x[0][i] + P.
x[1][i] +
h.zy * P.
x[2][i];
4960 x[2][i] =
h.xz * P.
x[0][i] +
h.yz * P.
x[1][i] + P.
x[2][i];
4972 operator<< (std::ostream& s, const Matrix22<T>& m)
4974 std::ios_base::fmtflags oldFlags =
s.flags ();
4979 s.setf (std::ios_base::showpoint);
4980 width =
static_cast<int> (
s.precision ()) + 5;
4984 s.setf (std::ios_base::scientific);
4985 s.setf (std::ios_base::showpoint);
4986 width =
static_cast<int> (
s.precision ()) + 8;
4989 s <<
"(" << std::setw (width) << m[0][0] <<
" " << std::setw (width)
4993 " " << std::setw (width) << m[1][0] <<
" " << std::setw (width)
4994 << m[1][1] <<
")\n";
5002 operator<< (std::ostream& s, const Matrix33<T>& m)
5004 std::ios_base::fmtflags oldFlags =
s.flags ();
5009 s.setf (std::ios_base::showpoint);
5010 width =
static_cast<int> (
s.precision ()) + 5;
5014 s.setf (std::ios_base::scientific);
5015 s.setf (std::ios_base::showpoint);
5016 width =
static_cast<int> (
s.precision ()) + 8;
5019 s <<
"(" << std::setw (width) << m[0][0] <<
" " << std::setw (width)
5020 << m[0][1] <<
" " << std::setw (width) << m[0][2] <<
"\n"
5023 " " << std::setw (width) << m[1][0] <<
" " << std::setw (width)
5024 << m[1][1] <<
" " << std::setw (width) << m[1][2] <<
"\n"
5027 " " << std::setw (width) << m[2][0] <<
" " << std::setw (width)
5028 << m[2][1] <<
" " << std::setw (width) << m[2][2] <<
")\n";
5036 operator<< (std::ostream& s, const Matrix44<T>& m)
5038 std::ios_base::fmtflags oldFlags =
s.flags ();
5043 s.setf (std::ios_base::showpoint);
5044 width =
static_cast<int> (
s.precision ()) + 5;
5048 s.setf (std::ios_base::scientific);
5049 s.setf (std::ios_base::showpoint);
5050 width =
static_cast<int> (
s.precision ()) + 8;
5053 s <<
"(" << std::setw (width) << m[0][0] <<
" " << std::setw (width)
5054 << m[0][1] <<
" " << std::setw (width) << m[0][2] <<
" "
5055 << std::setw (width) << m[0][3] <<
"\n"
5058 " " << std::setw (width) << m[1][0] <<
" " << std::setw (width)
5059 << m[1][1] <<
" " << std::setw (width) << m[1][2] <<
" "
5060 << std::setw (width) << m[1][3] <<
"\n"
5063 " " << std::setw (width) << m[2][0] <<
" " << std::setw (width)
5064 << m[2][1] <<
" " << std::setw (width) << m[2][2] <<
" "
5065 << std::setw (width) << m[2][3] <<
"\n"
5068 " " << std::setw (width) << m[3][0] <<
" " << std::setw (width)
5069 << m[3][1] <<
" " << std::setw (width) << m[3][2] <<
" "
5070 << std::setw (width) << m[3][3] <<
")\n";
5080 template <
class S,
class T>
5084 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0]);
5085 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1]);
5093 template <
class S,
class T>
5097 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0]);
5098 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1]);
5103 template <
class S,
class T>
5107 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0] + m.x[2][0]);
5108 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1] + m.x[2][1]);
5109 S w =
S (
v.x * m.x[0][2] +
v.y * m.x[1][2] + m.x[2][2]);
5117 template <
class S,
class T>
5121 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0] + m.x[2][0]);
5122 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1] + m.x[2][1]);
5123 S w =
S (
v.x * m.x[0][2] +
v.y * m.x[1][2] + m.x[2][2]);
5128 template <
class S,
class T>
5132 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0] +
v.z * m.x[2][0]);
5133 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1] +
v.z * m.x[2][1]);
5134 S z =
S (
v.x * m.x[0][2] +
v.y * m.x[1][2] +
v.z * m.x[2][2]);
5143 template <
class S,
class T>
5147 S x =
S (
v.x * m.x[0][0] +
v.y * m.x[1][0] +
v.z * m.x[2][0]);
5148 S y =
S (
v.x * m.x[0][1] +
v.y * m.x[1][1] +
v.z * m.x[2][1]);
5149 S z =
S (
v.x * m.x[0][2] +
v.y * m.x[1][2] +
v.z * m.x[2][2]);
5154 template <
class S,
class T>
5158 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]);
5159 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]);
5160 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]);
5161 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]);
5170 template <
class S,
class T>
5174 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]);
5175 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]);
5176 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]);
5177 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]);
5182 template <
class S,
class T>
5187 v.x * m.x[0][0] +
v.y * m.x[1][0] +
v.z * m.x[2][0] +
v.w * m.x[3][0]);
5189 v.x * m.x[0][1] +
v.y * m.x[1][1] +
v.z * m.x[2][1] +
v.w * m.x[3][1]);
5191 v.x * m.x[0][2] +
v.y * m.x[1][2] +
v.z * m.x[2][2] +
v.w * m.x[3][2]);
5193 v.x * m.x[0][3] +
v.y * m.x[1][3] +
v.z * m.x[2][3] +
v.w * m.x[3][3]);
5203 template <
class S,
class T>
5208 v.x * m.x[0][0] +
v.y * m.x[1][0] +
v.z * m.x[2][0] +
v.w * m.x[3][0]);
5210 v.x * m.x[0][1] +
v.y * m.x[1][1] +
v.z * m.x[2][1] +
v.w * m.x[3][1]);
5212 v.x * m.x[0][2] +
v.y * m.x[1][2] +
v.z * m.x[2][2] +
v.w * m.x[3][2]);
5214 v.x * m.x[0][3] +
v.y * m.x[1][3] +
v.z * m.x[2][3] +
v.w * m.x[3][3]);
5219 IMATH_INTERNAL_NAMESPACE_HEADER_EXIT
5221 #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
IMATH_HOSTDEVICE Matrix44(const M &m)
Matrix33 operator+() const
Unary plus of a matrix.
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.
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.
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.
GLboolean GLboolean GLboolean GLboolean a
IMATH_HOSTDEVICE T * operator[](int i) IMATH_NOEXCEPT
Row access.
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.
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 T * operator[](int i) IMATH_NOEXCEPT
Row access.
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...
IMATH_HOSTDEVICE constexpr T trace() const IMATH_NOEXCEPT
Trace.
Matrix44< double > M44d
4x4 matrix of double
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 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 T * operator[](int i) IMATH_NOEXCEPT
Row access.
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 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
IMATH_HOSTDEVICE T * getValue() IMATH_NOEXCEPT
Return a raw pointer to the array of values.
GLboolean GLboolean GLboolean b
IMATH_HOSTDEVICE static constexpr T baseTypeEpsilon() IMATH_NOEXCEPT
Smallest possible e for which 1+e != 1.
#define IMATH_ENABLE_IF(...)
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 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.
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 Matrix22(const M &m)
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.
LeafData & operator=(const LeafData &)=delete
IMATH_HOSTDEVICE Matrix33(const M &m)
#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
IMATH_HOSTDEVICE constexpr T trace() const IMATH_NOEXCEPT
Trace.
Vec4< T > BaseVecType
The base vector type.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33 & rotate(S r) IMATH_NOEXCEPT
IMATH_HOSTDEVICE T * getValue() IMATH_NOEXCEPT
Return a raw pointer to the array of values.
IMATH_HOSTDEVICE constexpr T trace() const IMATH_NOEXCEPT
Trace.
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_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 T * getValue() IMATH_NOEXCEPT
Return a raw pointer to the array of values.
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.
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 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.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44 & operator=(const Matrix44 &v) IMATH_NOEXCEPT
Assignment operator.