| 1 | #pragma once |
| 2 | |
| 3 | #include <math/seadMatrixCalcCommon.h> |
| 4 | #ifndef SEAD_MATH_MATRIX_H_ |
| 5 | #include <math/seadMatrix.h> |
| 6 | #endif |
| 7 | |
| 8 | namespace sead |
| 9 | { |
| 10 | template <typename T> |
| 11 | inline Matrix22<T>::Matrix22(T a00, T a01, T a10, T a11) |
| 12 | { |
| 13 | this->m[0][0] = a00; |
| 14 | this->m[0][1] = a01; |
| 15 | |
| 16 | this->m[1][0] = a10; |
| 17 | this->m[1][1] = a11; |
| 18 | } |
| 19 | |
| 20 | template <typename T> |
| 21 | inline T Matrix22<T>::operator()(s32 i, s32 j) const |
| 22 | { |
| 23 | return this->m[i][j]; |
| 24 | } |
| 25 | |
| 26 | template <typename T> |
| 27 | inline T& Matrix22<T>::operator()(s32 i, s32 j) |
| 28 | { |
| 29 | return this->m[i][j]; |
| 30 | } |
| 31 | |
| 32 | template <typename T> |
| 33 | inline Matrix22<T>& Matrix22<T>::operator=(const Self& n) |
| 34 | { |
| 35 | Matrix22CalcCommon<T>::copy(*this, n); |
| 36 | return *this; |
| 37 | } |
| 38 | |
| 39 | template <typename T> |
| 40 | inline void Matrix22<T>::makeIdentity() |
| 41 | { |
| 42 | Matrix22CalcCommon<T>::makeIdentity(*this); |
| 43 | } |
| 44 | |
| 45 | template <typename T> |
| 46 | inline void Matrix22<T>::makeZero() |
| 47 | { |
| 48 | Matrix22CalcCommon<T>::makeZero(*this); |
| 49 | } |
| 50 | |
| 51 | template <typename T> |
| 52 | inline void Matrix22<T>::setInverse(const Self& n) |
| 53 | { |
| 54 | Matrix22CalcCommon<T>::inverse(*this, n); |
| 55 | } |
| 56 | |
| 57 | template <typename T> |
| 58 | inline void Matrix22<T>::setInverseTranspose(const Self& n) |
| 59 | { |
| 60 | Matrix22CalcCommon<T>::inverseTranspose(*this, n); |
| 61 | } |
| 62 | |
| 63 | template <typename T> |
| 64 | inline void Matrix22<T>::setMul(const Self& a, const Self& b) |
| 65 | { |
| 66 | Matrix22CalcCommon<T>::multiply(*this, a, b); |
| 67 | } |
| 68 | |
| 69 | template <typename T> |
| 70 | inline void Matrix22<T>::setTranspose(const Self& n) |
| 71 | { |
| 72 | Matrix22CalcCommon<T>::transposeTo(*this, n); |
| 73 | } |
| 74 | |
| 75 | template <typename T> |
| 76 | inline void Matrix22<T>::transpose() |
| 77 | { |
| 78 | Matrix22CalcCommon<T>::transpose(*this); |
| 79 | } |
| 80 | |
| 81 | template <typename T> |
| 82 | inline Matrix33<T>::Matrix33(T a00, T a01, T a02, T a10, T a11, T a12, T a20, T a21, T a22) |
| 83 | { |
| 84 | this->m[0][0] = a00; |
| 85 | this->m[0][1] = a01; |
| 86 | this->m[0][2] = a02; |
| 87 | |
| 88 | this->m[1][0] = a10; |
| 89 | this->m[1][1] = a11; |
| 90 | this->m[1][2] = a12; |
| 91 | |
| 92 | this->m[2][0] = a20; |
| 93 | this->m[2][1] = a21; |
| 94 | this->m[2][2] = a22; |
| 95 | } |
| 96 | |
| 97 | template <typename T> |
| 98 | inline Matrix33<T>::Matrix33(const Mtx34& mtx34) |
| 99 | { |
| 100 | Matrix33CalcCommon<T>::copy(*this, mtx34); |
| 101 | } |
| 102 | |
| 103 | template <typename T> |
| 104 | inline T Matrix33<T>::operator()(s32 i, s32 j) const |
| 105 | { |
| 106 | return this->m[i][j]; |
| 107 | } |
| 108 | |
| 109 | template <typename T> |
| 110 | inline T& Matrix33<T>::operator()(s32 i, s32 j) |
| 111 | { |
| 112 | return this->m[i][j]; |
| 113 | } |
| 114 | |
| 115 | template <typename T> |
| 116 | inline Matrix33<T>& Matrix33<T>::operator=(const Self& n) |
| 117 | { |
| 118 | Matrix33CalcCommon<T>::copy(*this, n); |
| 119 | return *this; |
| 120 | } |
| 121 | |
| 122 | template <typename T> |
| 123 | inline void Matrix33<T>::makeIdentity() |
| 124 | { |
| 125 | Matrix33CalcCommon<T>::makeIdentity(*this); |
| 126 | } |
| 127 | |
| 128 | template <typename T> |
| 129 | inline void Matrix33<T>::makeZero() |
| 130 | { |
| 131 | Matrix33CalcCommon<T>::makeZero(*this); |
| 132 | } |
| 133 | |
| 134 | template <typename T> |
| 135 | inline void Matrix33<T>::setInverse(const Self& n) |
| 136 | { |
| 137 | Matrix33CalcCommon<T>::inverse(*this, n); |
| 138 | } |
| 139 | |
| 140 | template <typename T> |
| 141 | inline void Matrix33<T>::setInverseTranspose(const Self& n) |
| 142 | { |
| 143 | Matrix33CalcCommon<T>::inverseTranspose(*this, n); |
| 144 | } |
| 145 | |
| 146 | template <typename T> |
| 147 | inline void Matrix33<T>::setMul(const Self& a, const Self& b) |
| 148 | { |
| 149 | Matrix33CalcCommon<T>::multiply(*this, a, b); |
| 150 | } |
| 151 | |
| 152 | template <typename T> |
| 153 | inline void Matrix33<T>::setMul(const Mtx34& a, const Self& b) |
| 154 | { |
| 155 | Matrix33CalcCommon<T>::multiply(*this, a, b); |
| 156 | } |
| 157 | |
| 158 | template <typename T> |
| 159 | inline void Matrix33<T>::setMul(const Self& a, const Mtx34& b) |
| 160 | { |
| 161 | Matrix33CalcCommon<T>::multiply(*this, a, b); |
| 162 | } |
| 163 | |
| 164 | template <typename T> |
| 165 | inline void Matrix33<T>::setTranspose(const Self& n) |
| 166 | { |
| 167 | Matrix33CalcCommon<T>::transposeTo(*this, n); |
| 168 | } |
| 169 | |
| 170 | template <typename T> |
| 171 | inline void Matrix33<T>::transpose() |
| 172 | { |
| 173 | Matrix33CalcCommon<T>::transpose(*this); |
| 174 | } |
| 175 | |
| 176 | template <typename T> |
| 177 | inline void Matrix33<T>::fromQuat(const Quat<T>& q) |
| 178 | { |
| 179 | Matrix33CalcCommon<T>::makeQ(*this, q); |
| 180 | } |
| 181 | |
| 182 | template <typename T> |
| 183 | inline void Matrix33<T>::makeR(const Vec3& r) |
| 184 | { |
| 185 | Matrix33CalcCommon<T>::makeR(*this, r); |
| 186 | } |
| 187 | |
| 188 | template <typename T> |
| 189 | inline void Matrix33<T>::makeRIdx(u32 xr, u32 yr, u32 zr) |
| 190 | { |
| 191 | Matrix33CalcCommon<T>::makeRIdx(*this, xr, yr, zr); |
| 192 | } |
| 193 | |
| 194 | template <typename T> |
| 195 | inline void Matrix33<T>::makeRzxyIdx(u32 xr, u32 yr, u32 zr) |
| 196 | { |
| 197 | Matrix33CalcCommon<T>::makeRzxyIdx(*this, xr, yr, zr); |
| 198 | } |
| 199 | |
| 200 | template <typename T> |
| 201 | inline void Matrix33<T>::makeS(const Vec3& s) |
| 202 | { |
| 203 | Matrix33CalcCommon<T>::makeS(*this, s); |
| 204 | } |
| 205 | |
| 206 | template <typename T> |
| 207 | inline void Matrix33<T>::makeS(T x, T y, T z) |
| 208 | { |
| 209 | Vec3 s(x, y, z); |
| 210 | Matrix33CalcCommon<T>::makeS(*this, s); |
| 211 | } |
| 212 | |
| 213 | template <typename T> |
| 214 | inline void Matrix33<T>::makeSR(const Vec3& s, const Vec3& r) |
| 215 | { |
| 216 | Matrix33CalcCommon<T>::makeSR(*this, s, r); |
| 217 | } |
| 218 | |
| 219 | template <typename T> |
| 220 | inline void Matrix33<T>::makeSRIdx(const Vec3& s, const Vector3<u32>& r) |
| 221 | { |
| 222 | Matrix33CalcCommon<T>::makeSRIdx(*this, s, r); |
| 223 | } |
| 224 | |
| 225 | template <typename T> |
| 226 | inline void Matrix33<T>::makeSRzxyIdx(const Vec3& s, const Vector3<u32>& r) |
| 227 | { |
| 228 | Matrix33CalcCommon<T>::makeSRzxyIdx(*this, s, r); |
| 229 | } |
| 230 | |
| 231 | template <typename T> |
| 232 | inline void Matrix33<T>::toQuat(Quat<T>& q) const |
| 233 | { |
| 234 | Matrix33CalcCommon<T>::toQuat(q, *this); |
| 235 | } |
| 236 | |
| 237 | template <typename T> |
| 238 | inline Vector3<T> Matrix33<T>::getBase(s32 axis) const |
| 239 | { |
| 240 | Vec3 o; |
| 241 | Matrix33CalcCommon<T>::getBase(o, *this, axis); |
| 242 | return o; |
| 243 | } |
| 244 | |
| 245 | template <typename T> |
| 246 | inline Vector3<T> Matrix33<T>::getRow(s32 axis) const |
| 247 | { |
| 248 | Vec3 o; |
| 249 | Matrix33CalcCommon<T>::getRow(o, *this, axis); |
| 250 | return o; |
| 251 | } |
| 252 | |
| 253 | template <typename T> |
| 254 | inline void Matrix33<T>::getBase(Vec3& o, s32 axis) const |
| 255 | { |
| 256 | Matrix33CalcCommon<T>::getBase(o, *this, axis); |
| 257 | } |
| 258 | |
| 259 | template <typename T> |
| 260 | inline void Matrix33<T>::getRow(Vec3& o, s32 row) const |
| 261 | { |
| 262 | Matrix33CalcCommon<T>::getRow(o, *this, row); |
| 263 | } |
| 264 | |
| 265 | template <typename T> |
| 266 | inline void Matrix33<T>::setBase(s32 axis, const Vec3& v) |
| 267 | { |
| 268 | Matrix33CalcCommon<T>::setBase(*this, axis, v); |
| 269 | } |
| 270 | |
| 271 | template <typename T> |
| 272 | inline void Matrix33<T>::setRow(s32 row, const Vec3& v) |
| 273 | { |
| 274 | Matrix33CalcCommon<T>::setRow(*this, v, row); |
| 275 | } |
| 276 | |
| 277 | template <typename T> |
| 278 | inline Matrix34<T>::Matrix34(T a00, T a01, T a02, T a03, T a10, T a11, T a12, T a13, T a20, T a21, |
| 279 | T a22, T a23) |
| 280 | { |
| 281 | this->m[0][0] = a00; |
| 282 | this->m[0][1] = a01; |
| 283 | this->m[0][2] = a02; |
| 284 | this->m[0][3] = a03; |
| 285 | |
| 286 | this->m[1][0] = a10; |
| 287 | this->m[1][1] = a11; |
| 288 | this->m[1][2] = a12; |
| 289 | this->m[1][3] = a13; |
| 290 | |
| 291 | this->m[2][0] = a20; |
| 292 | this->m[2][1] = a21; |
| 293 | this->m[2][2] = a22; |
| 294 | this->m[2][3] = a23; |
| 295 | } |
| 296 | |
| 297 | template <typename T> |
| 298 | inline Matrix34<T>::Matrix34(const Mtx33& mtx33, const Vec3& t) |
| 299 | { |
| 300 | Matrix34CalcCommon<T>::copy(*this, mtx33, t); |
| 301 | } |
| 302 | |
| 303 | template <typename T> |
| 304 | inline Matrix34<T>::Matrix34(const Mtx44& mtx44) |
| 305 | { |
| 306 | Matrix34CalcCommon<T>::copy(*this, mtx44); |
| 307 | } |
| 308 | |
| 309 | template <typename T> |
| 310 | inline T Matrix34<T>::operator()(s32 i, s32 j) const |
| 311 | { |
| 312 | return this->m[i][j]; |
| 313 | } |
| 314 | |
| 315 | template <typename T> |
| 316 | inline T& Matrix34<T>::operator()(s32 i, s32 j) |
| 317 | { |
| 318 | return this->m[i][j]; |
| 319 | } |
| 320 | |
| 321 | template <typename T> |
| 322 | inline Matrix34<T>& Matrix34<T>::operator=(const Self& n) |
| 323 | { |
| 324 | Matrix34CalcCommon<T>::copy(*this, n); |
| 325 | return *this; |
| 326 | } |
| 327 | |
| 328 | template <typename T> |
| 329 | inline void Matrix34<T>::makeIdentity() |
| 330 | { |
| 331 | Matrix34CalcCommon<T>::makeIdentity(*this); |
| 332 | } |
| 333 | |
| 334 | template <typename T> |
| 335 | inline void Matrix34<T>::makeZero() |
| 336 | { |
| 337 | Matrix34CalcCommon<T>::makeZero(*this); |
| 338 | } |
| 339 | |
| 340 | template <typename T> |
| 341 | inline bool Matrix34<T>::invert() |
| 342 | { |
| 343 | return setInverse(*this); |
| 344 | } |
| 345 | |
| 346 | template <typename T> |
| 347 | inline bool Matrix34<T>::invert33() |
| 348 | { |
| 349 | return setInverse33(*this); |
| 350 | } |
| 351 | |
| 352 | template <typename T> |
| 353 | inline bool Matrix34<T>::invertTranspose() |
| 354 | { |
| 355 | return setInverseTranspose(*this); |
| 356 | } |
| 357 | |
| 358 | template <typename T> |
| 359 | inline bool Matrix34<T>::setInverse(const Self& n) |
| 360 | { |
| 361 | return Matrix34CalcCommon<T>::inverse(*this, n); |
| 362 | } |
| 363 | |
| 364 | template <typename T> |
| 365 | inline bool Matrix34<T>::setInverse33(const Self& n) |
| 366 | { |
| 367 | return Matrix34CalcCommon<T>::inverse33(*this, n); |
| 368 | } |
| 369 | |
| 370 | template <typename T> |
| 371 | inline bool Matrix34<T>::setInverseTranspose(const Self& n) |
| 372 | { |
| 373 | return Matrix34CalcCommon<T>::inverseTranspose(*this, n); |
| 374 | } |
| 375 | |
| 376 | template <typename T> |
| 377 | inline void Matrix34<T>::setMul(const Self& a, const Self& b) |
| 378 | { |
| 379 | Matrix34CalcCommon<T>::multiply(*this, a, b); |
| 380 | } |
| 381 | |
| 382 | template <typename T> |
| 383 | inline void Matrix34<T>::setMul(const Mtx33& a, const Self& b) |
| 384 | { |
| 385 | Matrix34CalcCommon<T>::multiply(*this, a, b); |
| 386 | } |
| 387 | |
| 388 | template <typename T> |
| 389 | inline void Matrix34<T>::setTranspose(const Self& n) |
| 390 | { |
| 391 | Matrix34CalcCommon<T>::transposeTo(*this, n); |
| 392 | } |
| 393 | |
| 394 | template <typename T> |
| 395 | inline void Matrix34<T>::transpose() |
| 396 | { |
| 397 | Matrix34CalcCommon<T>::transpose(*this); |
| 398 | } |
| 399 | |
| 400 | template <typename T> |
| 401 | inline void Matrix34<T>::fromQuat(const QuatT& q) |
| 402 | { |
| 403 | Matrix34CalcCommon<T>::makeQ(*this, q); |
| 404 | } |
| 405 | |
| 406 | template <typename T> |
| 407 | inline void Matrix34<T>::makeQT(const QuatT& q, const Vec3& t) |
| 408 | { |
| 409 | Matrix34CalcCommon<T>::makeQT(*this, q, t); |
| 410 | } |
| 411 | |
| 412 | template <typename T> |
| 413 | inline void Matrix34<T>::makeR(const Vec3& r) |
| 414 | { |
| 415 | Matrix34CalcCommon<T>::makeR(*this, r); |
| 416 | } |
| 417 | |
| 418 | template <typename T> |
| 419 | inline void Matrix34<T>::makeRIdx(u32 xr, u32 yr, u32 zr) |
| 420 | { |
| 421 | Matrix34CalcCommon<T>::makeRIdx(*this, xr, yr, zr); |
| 422 | } |
| 423 | |
| 424 | template <typename T> |
| 425 | inline void Matrix34<T>::makeRT(const Vec3& r, const Vec3& t) |
| 426 | { |
| 427 | Matrix34CalcCommon<T>::makeRT(*this, r, t); |
| 428 | } |
| 429 | |
| 430 | template <typename T> |
| 431 | inline void Matrix34<T>::makeRTIdx(const Vector3<u32>& r, const Vec3& t) |
| 432 | { |
| 433 | Matrix34CalcCommon<T>::makeRTIdx(*this, r, t); |
| 434 | } |
| 435 | |
| 436 | template <typename T> |
| 437 | inline void Matrix34<T>::makeRzxyIdx(u32 xr, u32 yr, u32 zr) |
| 438 | { |
| 439 | Matrix34CalcCommon<T>::makeRzxyIdx(*this, xr, yr, zr); |
| 440 | } |
| 441 | |
| 442 | template <typename T> |
| 443 | inline void Matrix34<T>::makeRzxyTIdx(const Vector3<u32>& r, const Vec3& t) |
| 444 | { |
| 445 | Matrix34CalcCommon<T>::makeRzxyTIdx(*this, r, t); |
| 446 | } |
| 447 | |
| 448 | template <typename T> |
| 449 | inline void Matrix34<T>::makeS(const Vec3& s) |
| 450 | { |
| 451 | Matrix34CalcCommon<T>::makeS(*this, s); |
| 452 | } |
| 453 | |
| 454 | template <typename T> |
| 455 | inline void Matrix34<T>::makeS(T x, T y, T z) |
| 456 | { |
| 457 | Vec3 s(x, y, z); |
| 458 | Matrix34CalcCommon<T>::makeS(*this, s); |
| 459 | } |
| 460 | |
| 461 | template <typename T> |
| 462 | inline void Matrix34<T>::makeSQT(const Vec3& s, const QuatT& q, const Vec3& t) |
| 463 | { |
| 464 | Matrix34CalcCommon<T>::makeSQT(*this, s, q, t); |
| 465 | } |
| 466 | |
| 467 | template <typename T> |
| 468 | inline void Matrix34<T>::makeSR(const Vec3& s, const Vec3& r) |
| 469 | { |
| 470 | Matrix34CalcCommon<T>::makeSR(*this, s, r); |
| 471 | } |
| 472 | |
| 473 | template <typename T> |
| 474 | inline void Matrix34<T>::makeSRIdx(const Vec3& s, const Vector3<u32>& r) |
| 475 | { |
| 476 | Matrix34CalcCommon<T>::makeSRIdx(*this, s, r); |
| 477 | } |
| 478 | |
| 479 | template <typename T> |
| 480 | inline void Matrix34<T>::makeSRT(const Vec3& s, const Vec3& r, const Vec3& t) |
| 481 | { |
| 482 | Matrix34CalcCommon<T>::makeSRT(*this, s, r, t); |
| 483 | } |
| 484 | |
| 485 | template <typename T> |
| 486 | inline void Matrix34<T>::makeSRTIdx(const Vec3& s, const Vector3<u32>& r, const Vec3& t) |
| 487 | { |
| 488 | Matrix34CalcCommon<T>::makeSRTIdx(*this, s, r, t); |
| 489 | } |
| 490 | |
| 491 | template <typename T> |
| 492 | inline void Matrix34<T>::makeSRzxyIdx(const Vec3& s, const Vector3<u32>& r) |
| 493 | { |
| 494 | Matrix34CalcCommon<T>::makeSRzxyIdx(*this, s, r); |
| 495 | } |
| 496 | |
| 497 | template <typename T> |
| 498 | inline void Matrix34<T>::makeSRzxyTIdx(const Vec3& s, const Vector3<u32>& r, const Vec3& t) |
| 499 | { |
| 500 | Matrix34CalcCommon<T>::makeSRzxyTIdx(*this, s, r, t); |
| 501 | } |
| 502 | |
| 503 | template <typename T> |
| 504 | inline void Matrix34<T>::makeST(const Vec3& s, const Vec3& t) |
| 505 | { |
| 506 | Matrix34CalcCommon<T>::makeST(*this, s, t); |
| 507 | } |
| 508 | |
| 509 | template <typename T> |
| 510 | inline void Matrix34<T>::makeT(const Vec3& t) |
| 511 | { |
| 512 | Matrix34CalcCommon<T>::makeT(*this, t); |
| 513 | } |
| 514 | |
| 515 | template <typename T> |
| 516 | inline void Matrix34<T>::makeT(T x, T y, T z) |
| 517 | { |
| 518 | Vec3 t(x, y, z); |
| 519 | Matrix34CalcCommon<T>::makeT(*this, t); |
| 520 | } |
| 521 | |
| 522 | template <typename T> |
| 523 | inline void Matrix34<T>::toQuat(QuatT& q) const |
| 524 | { |
| 525 | Matrix34CalcCommon<T>::toQuat(q, *this); |
| 526 | } |
| 527 | |
| 528 | template <typename T> |
| 529 | inline Vector3<T> Matrix34<T>::getBase(s32 axis) const |
| 530 | { |
| 531 | Vec3 o; |
| 532 | Matrix34CalcCommon<T>::getBase(o, *this, axis); |
| 533 | return o; |
| 534 | } |
| 535 | |
| 536 | template <typename T> |
| 537 | inline Vector4<T> Matrix34<T>::getRow(s32 axis) const |
| 538 | { |
| 539 | Vec4 o; |
| 540 | Matrix34CalcCommon<T>::getRow(o, *this, axis); |
| 541 | return o; |
| 542 | } |
| 543 | |
| 544 | template <typename T> |
| 545 | inline Vector3<T> Matrix34<T>::getTranslation() const |
| 546 | { |
| 547 | Vec3 o; |
| 548 | Matrix34CalcCommon<T>::getTranslation(o, *this); |
| 549 | return o; |
| 550 | } |
| 551 | |
| 552 | template <typename T> |
| 553 | inline Vector3<T> Matrix34<T>::getRotation() const |
| 554 | { |
| 555 | Vec3 o; |
| 556 | Matrix34CalcCommon<T>::getRotation(o, *this); |
| 557 | return o; |
| 558 | } |
| 559 | |
| 560 | template <typename T> |
| 561 | inline void Matrix34<T>::getBase(Vec3& o, s32 axis) const |
| 562 | { |
| 563 | Matrix34CalcCommon<T>::getBase(o, *this, axis); |
| 564 | } |
| 565 | |
| 566 | template <typename T> |
| 567 | inline void Matrix34<T>::getRow(Vec4& o, s32 row) const |
| 568 | { |
| 569 | Matrix34CalcCommon<T>::getRow(o, *this, row); |
| 570 | } |
| 571 | |
| 572 | template <typename T> |
| 573 | inline void Matrix34<T>::getTranslation(Vec3& o) const |
| 574 | { |
| 575 | Matrix34CalcCommon<T>::getTranslation(o, *this); |
| 576 | } |
| 577 | |
| 578 | template <typename T> |
| 579 | inline void Matrix34<T>::getRotation(Vec3& o) const |
| 580 | { |
| 581 | Matrix34CalcCommon<T>::getRotation(o, *this); |
| 582 | } |
| 583 | |
| 584 | template <typename T> |
| 585 | inline void Matrix34<T>::scaleAllElements(T s) |
| 586 | { |
| 587 | Matrix34CalcCommon<T>::scaleAllElements(*this, s); |
| 588 | } |
| 589 | |
| 590 | template <typename T> |
| 591 | inline void Matrix34<T>::scaleBases(T sx, T sy, T sz) |
| 592 | { |
| 593 | Matrix34CalcCommon<T>::scaleBases(*this, sx, sy, sz); |
| 594 | } |
| 595 | |
| 596 | template <typename T> |
| 597 | inline void Matrix34<T>::setBase(s32 axis, const Vec3& v) |
| 598 | { |
| 599 | Matrix34CalcCommon<T>::setBase(*this, axis, v); |
| 600 | } |
| 601 | |
| 602 | template <typename T> |
| 603 | inline void Matrix34<T>::setRow(s32 row, const Vec4& v) |
| 604 | { |
| 605 | Matrix34CalcCommon<T>::setRow(*this, v, row); |
| 606 | } |
| 607 | |
| 608 | template <typename T> |
| 609 | inline void Matrix34<T>::setTranslation(const Vec3& t) |
| 610 | { |
| 611 | Matrix34CalcCommon<T>::setTranslation(*this, t); |
| 612 | } |
| 613 | |
| 614 | template <typename T> |
| 615 | inline void Matrix34<T>::setTranslation(T x, T y, T z) |
| 616 | { |
| 617 | Vec3 t(x, y, z); |
| 618 | Matrix34CalcCommon<T>::setTranslation(*this, t); |
| 619 | } |
| 620 | |
| 621 | template <typename T> |
| 622 | inline Matrix44<T>::Matrix44(T a00, T a01, T a02, T a03, T a10, T a11, T a12, T a13, T a20, T a21, |
| 623 | T a22, T a23, T a30, T a31, T a32, T a33) |
| 624 | { |
| 625 | this->m[0][0] = a00; |
| 626 | this->m[0][1] = a01; |
| 627 | this->m[0][2] = a02; |
| 628 | this->m[0][3] = a03; |
| 629 | |
| 630 | this->m[1][0] = a10; |
| 631 | this->m[1][1] = a11; |
| 632 | this->m[1][2] = a12; |
| 633 | this->m[1][3] = a13; |
| 634 | |
| 635 | this->m[2][0] = a20; |
| 636 | this->m[2][1] = a21; |
| 637 | this->m[2][2] = a22; |
| 638 | this->m[2][3] = a23; |
| 639 | |
| 640 | this->m[3][0] = a30; |
| 641 | this->m[3][1] = a31; |
| 642 | this->m[3][2] = a32; |
| 643 | this->m[3][3] = a33; |
| 644 | } |
| 645 | |
| 646 | template <typename T> |
| 647 | inline Matrix44<T>::Matrix44(const Mtx33& mtx33, const Vec3& t, const Vec4& vw) |
| 648 | { |
| 649 | Matrix44CalcCommon<T>::copy(*this, mtx33, t, vw); |
| 650 | } |
| 651 | |
| 652 | template <typename T> |
| 653 | inline Matrix44<T>::Matrix44(const Mtx34& mtx34, const Vec4& vw) |
| 654 | { |
| 655 | Matrix44CalcCommon<T>::copy(*this, mtx34, vw); |
| 656 | } |
| 657 | |
| 658 | template <typename T> |
| 659 | inline T Matrix44<T>::operator()(s32 i, s32 j) const |
| 660 | { |
| 661 | return this->m[i][j]; |
| 662 | } |
| 663 | |
| 664 | template <typename T> |
| 665 | inline T& Matrix44<T>::operator()(s32 i, s32 j) |
| 666 | { |
| 667 | return this->m[i][j]; |
| 668 | } |
| 669 | |
| 670 | template <typename T> |
| 671 | inline Matrix44<T>& Matrix44<T>::operator=(const Self& n) |
| 672 | { |
| 673 | Matrix44CalcCommon<T>::copy(*this, n); |
| 674 | return *this; |
| 675 | } |
| 676 | |
| 677 | template <typename T> |
| 678 | inline void Matrix44<T>::makeIdentity() |
| 679 | { |
| 680 | Matrix44CalcCommon<T>::makeIdentity(); |
| 681 | } |
| 682 | |
| 683 | template <typename T> |
| 684 | inline void Matrix44<T>::makeZero() |
| 685 | { |
| 686 | Matrix44CalcCommon<T>::makeZero(); |
| 687 | } |
| 688 | |
| 689 | template <typename T> |
| 690 | inline void Matrix44<T>::setInverse(const Self& n) |
| 691 | { |
| 692 | Matrix44CalcCommon<T>::inverse(*this, n); |
| 693 | } |
| 694 | |
| 695 | template <typename T> |
| 696 | inline void Matrix44<T>::setMul(const Self& a, const Self& b) |
| 697 | { |
| 698 | Matrix44CalcCommon<T>::multiply(*this, a, b); |
| 699 | } |
| 700 | |
| 701 | template <typename T> |
| 702 | inline void Matrix44<T>::setMul(const Mtx34& a, const Self& b) |
| 703 | { |
| 704 | Matrix44CalcCommon<T>::multiply(*this, a, b); |
| 705 | } |
| 706 | |
| 707 | template <typename T> |
| 708 | inline void Matrix44<T>::setMul(const Self& a, const Mtx34& b) |
| 709 | { |
| 710 | Matrix44CalcCommon<T>::multiply(*this, a, b); |
| 711 | } |
| 712 | |
| 713 | template <typename T> |
| 714 | inline void Matrix44<T>::setTranspose(const Self& n) |
| 715 | { |
| 716 | Matrix44CalcCommon<T>::transposeTo(*this, n); |
| 717 | } |
| 718 | |
| 719 | template <typename T> |
| 720 | inline void Matrix44<T>::transpose() |
| 721 | { |
| 722 | Matrix44CalcCommon<T>::transpose(*this); |
| 723 | } |
| 724 | |
| 725 | template <typename T> |
| 726 | inline void Matrix44<T>::fromQuat(const Quat<T>& q) |
| 727 | { |
| 728 | Matrix44CalcCommon<T>::makeQ(*this, q); |
| 729 | } |
| 730 | |
| 731 | template <typename T> |
| 732 | inline void Matrix44<T>::makeR(const Vec3& r) |
| 733 | { |
| 734 | Matrix44CalcCommon<T>::makeR(*this, r); |
| 735 | } |
| 736 | |
| 737 | template <typename T> |
| 738 | inline void Matrix44<T>::makeRIdx(u32 xr, u32 yr, u32 zr) |
| 739 | { |
| 740 | Matrix44CalcCommon<T>::makeRIdx(*this, xr, yr, zr); |
| 741 | } |
| 742 | |
| 743 | template <typename T> |
| 744 | inline void Matrix44<T>::makeRzxyIdx(u32 xr, u32 yr, u32 zr) |
| 745 | { |
| 746 | Matrix44CalcCommon<T>::makeRzxyIdx(*this, xr, yr, zr); |
| 747 | } |
| 748 | |
| 749 | template <typename T> |
| 750 | inline void Matrix44<T>::toQuat(Quat<T>& q) const |
| 751 | { |
| 752 | Matrix44CalcCommon<T>::toQuat(q, *this); |
| 753 | } |
| 754 | |
| 755 | template <typename T> |
| 756 | inline Vector4<T> Matrix44<T>::getCol(s32 axis) const |
| 757 | { |
| 758 | Vec4 o; |
| 759 | Matrix44CalcCommon<T>::getCol(o, *this, axis); |
| 760 | return o; |
| 761 | } |
| 762 | |
| 763 | template <typename T> |
| 764 | inline Vector4<T> Matrix44<T>::getRow(s32 axis) const |
| 765 | { |
| 766 | Vec4 o; |
| 767 | Matrix44CalcCommon<T>::getRow(o, *this, axis); |
| 768 | return o; |
| 769 | } |
| 770 | |
| 771 | template <typename T> |
| 772 | inline void Matrix44<T>::getCol(Vec4& o, s32 axis) const |
| 773 | { |
| 774 | Matrix44CalcCommon<T>::getCol(o, *this, axis); |
| 775 | } |
| 776 | |
| 777 | template <typename T> |
| 778 | inline void Matrix44<T>::getRow(Vec4& o, s32 row) const |
| 779 | { |
| 780 | Matrix44CalcCommon<T>::getRow(o, *this, row); |
| 781 | } |
| 782 | |
| 783 | template <typename T> |
| 784 | inline void Matrix44<T>::scaleAllElements(T s) |
| 785 | { |
| 786 | Matrix44CalcCommon<T>::scaleAllElements(*this, s); |
| 787 | } |
| 788 | |
| 789 | template <typename T> |
| 790 | inline void Matrix44<T>::scaleBases(T sx, T sy, T sz, T sw) |
| 791 | { |
| 792 | Matrix44CalcCommon<T>::scaleBases(*this, sx, sy, sz, sw); |
| 793 | } |
| 794 | |
| 795 | template <typename T> |
| 796 | inline void Matrix44<T>::setCol(s32 axis, const Vec4& v) |
| 797 | { |
| 798 | Matrix44CalcCommon<T>::setCol(*this, axis, v); |
| 799 | } |
| 800 | |
| 801 | template <typename T> |
| 802 | inline void Matrix44<T>::setRow(s32 row, const Vec4& v) |
| 803 | { |
| 804 | Matrix44CalcCommon<T>::setRow(*this, row, v); |
| 805 | } |
| 806 | |
| 807 | template <typename T> |
| 808 | inline bool operator==(const Matrix34<T>& lhs, const Matrix34<T>& rhs) |
| 809 | { |
| 810 | return lhs.a == rhs.a; |
| 811 | } |
| 812 | |
| 813 | template <typename T> |
| 814 | inline bool operator!=(const Matrix34<T>& lhs, const Matrix34<T>& rhs) |
| 815 | { |
| 816 | return lhs.a != rhs.a; |
| 817 | } |
| 818 | |
| 819 | } // namespace sead |
| 820 | |