You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/lang/articles/math/math_module.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ def test():
41
41
x = tm.sin(a) # [0.841471, 0.909297, 0.141120]
42
42
y = tm.floor(a) # [1.000000, 2.000000, 3.000000]
43
43
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]
45
45
w = tm.atan2(b, a) # [1.107149, 0.982794, 0.927295]
46
46
...
47
47
```
@@ -87,13 +87,13 @@ vec3 = ti.math.mat3
87
87
vec4 = ti.math.vec4
88
88
89
89
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.]
97
97
```
98
98
99
99
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