|
|
|
|
@ -121,7 +121,8 @@ Int[] mat = { 2, 4, 6,
|
|
|
|
|
1, 3, 5 }; |
|
|
|
|
Math::Matrix2x3<Int>::from(mat) *= 2; // mat == { 4, 8, 12, 2, 6, 10 } |
|
|
|
|
@endcode |
|
|
|
|
Note that unlike constructors, this function has no way to check whether the |
|
|
|
|
|
|
|
|
|
Note that, unlike constructors, this function has no way to check whether the |
|
|
|
|
array is long enough to contain all elements, so use with caution. |
|
|
|
|
|
|
|
|
|
You can also *explicitly* convert between data types: |
|
|
|
|
@ -133,8 +134,7 @@ auto integral = Vector4i(floating); // {1, 2, -15, 7}
|
|
|
|
|
@section matrix-vector-component-access Accessing matrix and vector components |
|
|
|
|
|
|
|
|
|
Column vectors of matrices and vector components can be accessed using square |
|
|
|
|
brackets, there is also round bracket operator for accessing matrix components |
|
|
|
|
directly: |
|
|
|
|
brackets: |
|
|
|
|
@code |
|
|
|
|
Matrix3x2 a; |
|
|
|
|
a[2] /= 2.0f; // third column (column major indexing, see explanation below) |
|
|
|
|
@ -145,7 +145,7 @@ b[1] = 1; // second element
|
|
|
|
|
@endcode |
|
|
|
|
|
|
|
|
|
Row vectors can be accessed too, but only for reading, and the access is slower |
|
|
|
|
due to the way the matrix is stored (see explanation below): |
|
|
|
|
due to the way the matrix is stored (see @ref matrix-vector-column-major "explanation below"): |
|
|
|
|
@code |
|
|
|
|
Vector2i c = a.row(2); // third row |
|
|
|
|
@endcode |
|
|
|
|
|