Files
XCEngine/docs/api/math/matrix3/operator-subscript.md
2026-03-20 02:35:15 +08:00

28 lines
475 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Matrix3::operator[]
```cpp
float* operator[](int row)
const float* operator[](int row) const
```
访问矩阵指定行的元素。
**参数:**
- `row` - 行索引0-2
**返回:** `float*` / `const float*` - 指向该行首元素的指针
**复杂度:** O(1)
**示例:**
```cpp
Matrix3 m;
m[0][0] = 1; m[0][1] = 2; m[0][2] = 3;
m[1][0] = 4; m[1][1] = 5; m[1][2] = 6;
m[2][0] = 7; m[2][1] = 8; m[2][2] = 9;
// 访问元素
float val = m[1][2]; // 6
```