tools:matrix:start
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tools:matrix:start [2021/11/14 17:15] – [Matrix Operations] ursgraf | tools:matrix:start [2022/04/20 13:29] (current) – [Logging Matrices] ursgraf | ||
---|---|---|---|
Line 8: | Line 8: | ||
Vector3<> | Vector3<> | ||
</ | </ | ||
- | as '' | + | as '' |
<code cpp> | <code cpp> | ||
v = {1.5, -2, 0} | v = {1.5, -2, 0} | ||
Line 17: | Line 17: | ||
<code cpp> | <code cpp> | ||
Matrix< | Matrix< | ||
- | m << 1, 4, 7, | + | m << 1, 2, 3, |
- | 2, 5, 8, | + | 4, 5, 6, |
- | 3, 6, 9; | + | 7, 8, 9; |
</ | </ | ||
- | The first three numbers will be filled into the first colon. While the internal representation is simply a one dimensional vector, the matrix could be visualized as | + | The first three numbers will be filled into the first row. While the internal representation is simply a one dimensional vector, the matrix could be visualized as |
| ^col0^col1^col2^ | | ^col0^col1^col2^ | ||
Line 27: | Line 27: | ||
^row1|4|5|6| | ^row1|4|5|6| | ||
^row2|7|8|9| | ^row2|7|8|9| | ||
+ | When declaring and initializing a matrix, the values must be given colon per colon. The same matrix as given above would be initialized as follows | ||
+ | <code cpp> | ||
+ | Matrix< | ||
+ | </ | ||
===== Accessing Elements ===== | ===== Accessing Elements ===== | ||
You can access rows, columns or single elements of matrices with the following methods: | You can access rows, columns or single elements of matrices with the following methods: | ||
<code cpp> | <code cpp> | ||
m.get(0, | m.get(0, | ||
- | m.getRow(1); | + | m.get(1, |
- | m.getCol(0); | + | m.getRow(1); |
- | m.getSubMatrix< | + | m.getCol(0); |
+ | m.getSubMatrix< | ||
</ | </ | ||
Single elements, rows or columns can be written with the methods //set()//, // | Single elements, rows or columns can be written with the methods //set()//, // | ||
Line 65: | Line 69: | ||
< | < | ||
2021-09-16 17: | 2021-09-16 17: | ||
- | 2021-09-16 17: | + | 2021-09-16 17: |
- | 2021-09-16 17: | + | 2021-09-16 17: |
</ | </ | ||
tools/matrix/start.1636906519.txt.gz · Last modified: 2021/11/14 17:15 by ursgraf