Skip to content

Matrix Classes Design Notes

Toksaitov Dmitrii Alexandrovich edited this page Oct 30, 2023 · 3 revisions

UML Class Diagrams of Matrix Classes

Design Considerations

  • In the constructor MatX(m00: float, m01: float, ...) the element mIJ should go into array m at index I and J.
  • For Mat4 parameters m30, m31, and m32 should be considered translation components x, y, z.
  • m: float[] should be a 1-D array.
  • String representation of a matrix must be in a format "(" + m00 + ", " + m01 + "," + ... + ")";
  • The data types must be immutable.

Mat2 Class

-----------------------------------------
|                  Mat2                 |
| ------------------------------------- |
| - m: float[]                          |
| ------------------------------------- |
| + Mat2()                              |
| + Mat2(m00: float, m01: float, ...)   |
| + Mat2(m: float[])                    |
| + get(i: int, j: int): float          |
| + transp(): Mat2                      |
| + mul(other: Mat2): Mat2              |
| + mul(other: Vec2): Vec2              |
| + toString(): String                  |
| + toArray(): float[]                  |
-----------------------------------------

Mat3 Class

-----------------------------------------
|                  Mat3                 |
| ------------------------------------- |
| - m: float[]                          |
| ------------------------------------- |
| + Mat3()                              |
| + Mat3(m00: float, m01: float, ...)   |
| + Mat3(m: float[])                    |
| + get(i: int, j: int): float          |
| + transp(): Mat3                      |
| + mul(other: Mat3): Mat3              |
| + mul(other: Vec3): Vec3              |
| + toString(): String                  |
| + toArray(): float[]                  |
-----------------------------------------

Mat4 Class

-----------------------------------------
|                  Mat4                 |
| ------------------------------------- |
| - m: float[]                          |
| ------------------------------------- |
| + Mat4()                              |
| + Mat4(m00: float, m01: float, ...)   |
| + Mat4(m: float[])                    |
| + get(i: int, j: int): float          |
| + transp(): Mat4                      |
| + mul(other: Mat4): Mat4              |
| + mul(other: Vec4): Vec4              |
| + toString(): String                  |
| + toArray(): float[]                  |
-----------------------------------------

Clone this wiki locally