Skip to content

Commit b26c0ba

Browse files
authored
Update math_module.md
Make code comments more accurate and consistent.
1 parent 3da2a41 commit b26c0ba

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/lang/articles/math/math_module.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test():
4141
x = tm.sin(a) # [0.841471, 0.909297, 0.141120]
4242
y = tm.floor(a) # [1.000000, 2.000000, 3.000000]
4343
z = tm.degrees(a) # [57.295780, 114.591560, 171.887344]
44-
b = ti.Vector([2.0, 3.0, 4.0])
44+
b = ti.Vector([2.0, 3.0, 4.0]) # [2.000000, 3.000000, 4.000000]
4545
w = tm.atan2(b, a) # [1.107149, 0.982794, 0.927295]
4646
...
4747
```
@@ -87,13 +87,13 @@ vec3 = ti.math.mat3
8787
vec4 = ti.math.vec4
8888

8989
m = mat2(1) # [[1., 1.], [1., 1.]]
90-
m = mat2(1, 2, 3, 4) # [[1., 2.], [3, 4.]]
91-
m = mat2([1, 2], [3, 4]) # [[1., 2.], [3, 4.]]
92-
m = mat2([1, 2, 3, 4]) # [[1., 2.], [3, 4.]]
93-
v = vec3(1, 2, 3)
94-
m = mat2(v, 4) # [[1., 2.], [3, 4.]]
95-
u = vec4([1, 2], [3, 4])
96-
u = vec4(v, 4.0)
90+
m = mat2(1, 2, 3, 4) # [[1., 2.], [3., 4.]]
91+
m = mat2([1, 2], [3, 4]) # [[1., 2.], [3., 4.]]
92+
m = mat2([1, 2, 3, 4]) # [[1., 2.], [3., 4.]]
93+
v = vec3(1, 2, 3) # [1., 2., 3.]
94+
m = mat2(v, 4) # [[1., 2.], [3., 4.]]
95+
u = vec4([1, 2], [3, 4]) # [1., 2., 3., 4.]
96+
u = vec4(v, 4.0) # [1., 2., 3., 4.]
9797
```
9898

9999
Another important feature of vector types created by `ti.types.vector()` is that they support **vector swizzling** just as GLSL vectors do. This means you can use `xyzw`, `rgba`, `stpq` to access their elements with indices ≤ four:

0 commit comments

Comments
 (0)