From 6a83950e6f6b50a9cff4b2c37a1da114c5a8c517 Mon Sep 17 00:00:00 2001 From: Ruibin Liu Date: Thu, 29 Jun 2023 11:39:00 -0400 Subject: [PATCH 1/2] Update math_module.md Make code comments more accurate and consistent. --- docs/lang/articles/math/math_module.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/lang/articles/math/math_module.md b/docs/lang/articles/math/math_module.md index a638f695811ce..5109f75c516c9 100644 --- a/docs/lang/articles/math/math_module.md +++ b/docs/lang/articles/math/math_module.md @@ -41,7 +41,7 @@ def test(): x = tm.sin(a) # [0.841471, 0.909297, 0.141120] y = tm.floor(a) # [1.000000, 2.000000, 3.000000] z = tm.degrees(a) # [57.295780, 114.591560, 171.887344] - b = ti.Vector([2.0, 3.0, 4.0]) + b = ti.Vector([2.0, 3.0, 4.0]) # [2.000000, 3.000000, 4.000000] w = tm.atan2(b, a) # [1.107149, 0.982794, 0.927295] ... ``` @@ -87,13 +87,13 @@ vec3 = ti.math.mat3 vec4 = ti.math.vec4 m = mat2(1) # [[1., 1.], [1., 1.]] -m = mat2(1, 2, 3, 4) # [[1., 2.], [3, 4.]] -m = mat2([1, 2], [3, 4]) # [[1., 2.], [3, 4.]] -m = mat2([1, 2, 3, 4]) # [[1., 2.], [3, 4.]] -v = vec3(1, 2, 3) -m = mat2(v, 4) # [[1., 2.], [3, 4.]] -u = vec4([1, 2], [3, 4]) -u = vec4(v, 4.0) +m = mat2(1, 2, 3, 4) # [[1., 2.], [3., 4.]] +m = mat2([1, 2], [3, 4]) # [[1., 2.], [3., 4.]] +m = mat2([1, 2, 3, 4]) # [[1., 2.], [3., 4.]] +v = vec3(1, 2, 3) # [1., 2., 3.] +m = mat2(v, 4) # [[1., 2.], [3., 4.]] +u = vec4([1, 2], [3, 4]) # [1., 2., 3., 4.] +u = vec4(v, 4.0) # [1., 2., 3., 4.] ``` 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: From 54059ba21eeb90f1058bb72c625685f2506219f6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 11:15:33 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/python/test_ipython.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/python/test_ipython.ipynb b/tests/python/test_ipython.ipynb index a895423861032..28988c259cb50 100644 --- a/tests/python/test_ipython.ipynb +++ b/tests/python/test_ipython.ipynb @@ -1,5 +1,5 @@ { - "cells": [ + "cells": [ { "cell_type": "markdown", "id": "51b3b00e",