redscript-mc 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +1 -0
- package/README.md +119 -313
- package/README.zh.md +118 -314
- package/ROADMAP.md +5 -5
- package/dist/data/impl_test/function/counter/get.mcfunction +5 -0
- package/dist/data/impl_test/function/counter/inc.mcfunction +7 -0
- package/dist/data/impl_test/function/counter/new.mcfunction +4 -0
- package/dist/data/impl_test/function/load.mcfunction +1 -0
- package/dist/data/impl_test/function/test_impl.mcfunction +10 -0
- package/dist/data/minecraft/tags/function/load.json +5 -0
- package/dist/data/playground/function/load.mcfunction +1 -0
- package/dist/data/playground/function/start.mcfunction +4 -0
- package/dist/data/playground/function/start__say_macro_t1.mcfunction +1 -0
- package/dist/data/playground/function/stop.mcfunction +5 -0
- package/dist/data/playground/function/stop__say_macro_t0.mcfunction +1 -0
- package/dist/data/stdlib_queue8_test/function/__queue_append_apply.mcfunction +4 -0
- package/dist/data/stdlib_queue8_test/function/__queue_peek_apply.mcfunction +4 -0
- package/dist/data/stdlib_queue8_test/function/__queue_size_raw_apply.mcfunction +4 -0
- package/dist/data/stdlib_queue8_test/function/load.mcfunction +1 -0
- package/dist/data/stdlib_queue8_test/function/queue_clear.mcfunction +6 -0
- package/dist/data/stdlib_queue8_test/function/queue_empty__merge_1.mcfunction +5 -0
- package/dist/data/stdlib_queue8_test/function/queue_empty__then_0.mcfunction +5 -0
- package/dist/data/stdlib_queue8_test/function/queue_peek__merge_1.mcfunction +13 -0
- package/dist/data/stdlib_queue8_test/function/queue_peek__then_0.mcfunction +5 -0
- package/dist/data/stdlib_queue8_test/function/queue_pop__merge_1.mcfunction +15 -0
- package/dist/data/stdlib_queue8_test/function/queue_pop__then_0.mcfunction +5 -0
- package/dist/data/stdlib_queue8_test/function/queue_push__const_11.mcfunction +6 -0
- package/dist/data/stdlib_queue8_test/function/queue_push__const_22.mcfunction +6 -0
- package/dist/data/stdlib_queue8_test/function/queue_size.mcfunction +13 -0
- package/dist/data/stdlib_queue8_test/function/test_queue_push_and_size.mcfunction +13 -0
- package/dist/data/test/function/load.mcfunction +1 -0
- package/dist/data/test/function/say_at.mcfunction +6 -0
- package/dist/data/test/function/test.mcfunction +4 -0
- package/dist/pack.mcmeta +6 -0
- package/dist/package.json +1 -1
- package/dist/src/__tests__/formatter-extra.test.d.ts +7 -0
- package/dist/src/__tests__/formatter-extra.test.js +123 -0
- package/dist/src/__tests__/global-vars.test.d.ts +13 -0
- package/dist/src/__tests__/global-vars.test.js +156 -0
- package/dist/src/__tests__/lint/new-rules.test.d.ts +9 -0
- package/dist/src/__tests__/lint/new-rules.test.js +402 -0
- package/dist/src/__tests__/lsp-rename.test.d.ts +8 -0
- package/dist/src/__tests__/lsp-rename.test.js +157 -0
- package/dist/src/__tests__/mc-integration/say-fstring.test.d.ts +11 -0
- package/dist/src/__tests__/mc-integration/say-fstring.test.js +220 -0
- package/dist/src/__tests__/mc-integration/stdlib-coverage-2.test.js +1 -1
- package/dist/src/__tests__/mc-integration/stdlib-coverage-3.test.js +1 -1
- package/dist/src/__tests__/mc-integration/stdlib-coverage-4.test.js +1 -1
- package/dist/src/__tests__/mc-integration/stdlib-coverage-5.test.js +1 -1
- package/dist/src/__tests__/mc-integration/stdlib-coverage-6.test.js +1 -1
- package/dist/src/__tests__/mc-integration/stdlib-coverage-7.test.js +1 -1
- package/dist/src/__tests__/mc-integration/stdlib-coverage-8.test.js +1 -1
- package/dist/src/__tests__/mc-syntax.test.js +4 -1
- package/dist/src/__tests__/monomorphize-coverage.test.d.ts +9 -0
- package/dist/src/__tests__/monomorphize-coverage.test.js +204 -0
- package/dist/src/__tests__/optimizer-cse.test.d.ts +7 -0
- package/dist/src/__tests__/optimizer-cse.test.js +226 -0
- package/dist/src/__tests__/parser.test.js +4 -13
- package/dist/src/__tests__/repl-server-extra.test.js +6 -7
- package/dist/src/__tests__/repl-server.test.js +5 -7
- package/dist/src/__tests__/stdlib/queue.test.js +6 -6
- package/dist/src/cli.js +0 -0
- package/dist/src/lexer/index.js +2 -1
- package/dist/src/lint/index.d.ts +12 -5
- package/dist/src/lint/index.js +730 -5
- package/dist/src/lsp/main.js +0 -0
- package/dist/src/mc-test/client.d.ts +21 -0
- package/dist/src/mc-test/client.js +34 -0
- package/dist/src/mir/lower.js +108 -6
- package/dist/src/optimizer/interprocedural.js +37 -2
- package/dist/src/parser/decl-parser.d.ts +19 -0
- package/dist/src/parser/decl-parser.js +323 -0
- package/dist/src/parser/expr-parser.d.ts +46 -0
- package/dist/src/parser/expr-parser.js +759 -0
- package/dist/src/parser/index.d.ts +8 -129
- package/dist/src/parser/index.js +13 -2262
- package/dist/src/parser/stmt-parser.d.ts +28 -0
- package/dist/src/parser/stmt-parser.js +577 -0
- package/dist/src/parser/type-parser.d.ts +20 -0
- package/dist/src/parser/type-parser.js +257 -0
- package/dist/src/parser/utils.d.ts +34 -0
- package/dist/src/parser/utils.js +141 -0
- package/docs/dev/README-mc-integration-tests.md +141 -0
- package/docs/lint-rules.md +162 -0
- package/docs/stdlib/bigint.md +2 -0
- package/editors/vscode/README.md +63 -41
- package/editors/vscode/out/extension.js +1881 -1776
- package/editors/vscode/out/lsp-server.js +4257 -3651
- package/editors/vscode/package-lock.json +3 -3
- package/editors/vscode/package.json +1 -1
- package/examples/loops-demo.mcrs +87 -0
- package/package.json +1 -1
- package/redscript-docs/docs/en/stdlib/advanced.md +629 -0
- package/redscript-docs/docs/en/stdlib/bigint.md +316 -0
- package/redscript-docs/docs/en/stdlib/bits.md +292 -0
- package/redscript-docs/docs/en/stdlib/bossbar.md +177 -0
- package/redscript-docs/docs/en/stdlib/calculus.md +289 -0
- package/redscript-docs/docs/en/stdlib/color.md +353 -0
- package/redscript-docs/docs/en/stdlib/combat.md +88 -0
- package/redscript-docs/docs/en/stdlib/cooldown.md +82 -0
- package/redscript-docs/docs/en/stdlib/dialog.md +155 -0
- package/redscript-docs/docs/en/stdlib/easing.md +558 -0
- package/redscript-docs/docs/en/stdlib/ecs.md +475 -0
- package/redscript-docs/docs/en/stdlib/effects.md +324 -0
- package/redscript-docs/docs/en/stdlib/events.md +3 -0
- package/redscript-docs/docs/en/stdlib/expr.md +45 -0
- package/redscript-docs/docs/en/stdlib/fft.md +141 -0
- package/redscript-docs/docs/en/stdlib/geometry.md +430 -0
- package/redscript-docs/docs/en/stdlib/graph.md +259 -0
- package/redscript-docs/docs/en/stdlib/heap.md +185 -0
- package/redscript-docs/docs/en/stdlib/interactions.md +179 -0
- package/redscript-docs/docs/en/stdlib/inventory.md +97 -0
- package/redscript-docs/docs/en/stdlib/linalg.md +557 -0
- package/redscript-docs/docs/en/stdlib/list.md +559 -0
- package/redscript-docs/docs/en/stdlib/map.md +140 -0
- package/redscript-docs/docs/en/stdlib/math.md +193 -0
- package/redscript-docs/docs/en/stdlib/math_hp.md +149 -0
- package/redscript-docs/docs/en/stdlib/matrix.md +403 -0
- package/redscript-docs/docs/en/stdlib/mobs.md +965 -0
- package/redscript-docs/docs/en/stdlib/noise.md +244 -0
- package/redscript-docs/docs/en/stdlib/ode.md +253 -0
- package/redscript-docs/docs/en/stdlib/parabola.md +342 -0
- package/redscript-docs/docs/en/stdlib/particles.md +311 -0
- package/redscript-docs/docs/en/stdlib/pathfind.md +255 -0
- package/redscript-docs/docs/en/stdlib/physics.md +493 -0
- package/redscript-docs/docs/en/stdlib/player.md +78 -0
- package/redscript-docs/docs/en/stdlib/quaternion.md +673 -0
- package/redscript-docs/docs/en/stdlib/queue.md +134 -0
- package/redscript-docs/docs/en/stdlib/random.md +223 -0
- package/redscript-docs/docs/en/stdlib/result.md +143 -0
- package/redscript-docs/docs/en/stdlib/scheduler.md +183 -0
- package/redscript-docs/docs/en/stdlib/set_int.md +190 -0
- package/redscript-docs/docs/en/stdlib/sets.md +101 -0
- package/redscript-docs/docs/en/stdlib/signal.md +400 -0
- package/redscript-docs/docs/en/stdlib/sort.md +104 -0
- package/redscript-docs/docs/en/stdlib/spawn.md +147 -0
- package/redscript-docs/docs/en/stdlib/state.md +142 -0
- package/redscript-docs/docs/en/stdlib/strings.md +154 -0
- package/redscript-docs/docs/en/stdlib/tags.md +3451 -0
- package/redscript-docs/docs/en/stdlib/teams.md +153 -0
- package/redscript-docs/docs/en/stdlib/timer.md +246 -0
- package/redscript-docs/docs/en/stdlib/vec.md +158 -0
- package/redscript-docs/docs/en/stdlib/world.md +298 -0
- package/redscript-docs/docs/zh/stdlib/advanced.md +615 -0
- package/redscript-docs/docs/zh/stdlib/bigint.md +316 -0
- package/redscript-docs/docs/zh/stdlib/bits.md +292 -0
- package/redscript-docs/docs/zh/stdlib/bossbar.md +170 -0
- package/redscript-docs/docs/zh/stdlib/calculus.md +287 -0
- package/redscript-docs/docs/zh/stdlib/color.md +353 -0
- package/redscript-docs/docs/zh/stdlib/combat.md +88 -0
- package/redscript-docs/docs/zh/stdlib/cooldown.md +84 -0
- package/redscript-docs/docs/zh/stdlib/dialog.md +152 -0
- package/redscript-docs/docs/zh/stdlib/easing.md +558 -0
- package/redscript-docs/docs/zh/stdlib/ecs.md +472 -0
- package/redscript-docs/docs/zh/stdlib/effects.md +324 -0
- package/redscript-docs/docs/zh/stdlib/events.md +3 -0
- package/redscript-docs/docs/zh/stdlib/expr.md +37 -0
- package/redscript-docs/docs/zh/stdlib/fft.md +128 -0
- package/redscript-docs/docs/zh/stdlib/geometry.md +430 -0
- package/redscript-docs/docs/zh/stdlib/graph.md +259 -0
- package/redscript-docs/docs/zh/stdlib/heap.md +185 -0
- package/redscript-docs/docs/zh/stdlib/interactions.md +160 -0
- package/redscript-docs/docs/zh/stdlib/inventory.md +94 -0
- package/redscript-docs/docs/zh/stdlib/linalg.md +543 -0
- package/redscript-docs/docs/zh/stdlib/list.md +561 -0
- package/redscript-docs/docs/zh/stdlib/map.md +132 -0
- package/redscript-docs/docs/zh/stdlib/math.md +193 -0
- package/redscript-docs/docs/zh/stdlib/math_hp.md +143 -0
- package/redscript-docs/docs/zh/stdlib/matrix.md +396 -0
- package/redscript-docs/docs/zh/stdlib/mobs.md +965 -0
- package/redscript-docs/docs/zh/stdlib/noise.md +244 -0
- package/redscript-docs/docs/zh/stdlib/ode.md +243 -0
- package/redscript-docs/docs/zh/stdlib/parabola.md +337 -0
- package/redscript-docs/docs/zh/stdlib/particles.md +307 -0
- package/redscript-docs/docs/zh/stdlib/pathfind.md +255 -0
- package/redscript-docs/docs/zh/stdlib/physics.md +493 -0
- package/redscript-docs/docs/zh/stdlib/player.md +78 -0
- package/redscript-docs/docs/zh/stdlib/quaternion.md +669 -0
- package/redscript-docs/docs/zh/stdlib/queue.md +124 -0
- package/redscript-docs/docs/zh/stdlib/random.md +222 -0
- package/redscript-docs/docs/zh/stdlib/result.md +147 -0
- package/redscript-docs/docs/zh/stdlib/scheduler.md +173 -0
- package/redscript-docs/docs/zh/stdlib/set_int.md +180 -0
- package/redscript-docs/docs/zh/stdlib/sets.md +107 -0
- package/redscript-docs/docs/zh/stdlib/signal.md +373 -0
- package/redscript-docs/docs/zh/stdlib/sort.md +104 -0
- package/redscript-docs/docs/zh/stdlib/spawn.md +142 -0
- package/redscript-docs/docs/zh/stdlib/state.md +134 -0
- package/redscript-docs/docs/zh/stdlib/strings.md +107 -0
- package/redscript-docs/docs/zh/stdlib/tags.md +3451 -0
- package/redscript-docs/docs/zh/stdlib/teams.md +150 -0
- package/redscript-docs/docs/zh/stdlib/timer.md +254 -0
- package/redscript-docs/docs/zh/stdlib/vec.md +158 -0
- package/redscript-docs/docs/zh/stdlib/world.md +289 -0
- package/src/__tests__/formatter-extra.test.ts +139 -0
- package/src/__tests__/global-vars.test.ts +171 -0
- package/src/__tests__/lint/new-rules.test.ts +437 -0
- package/src/__tests__/lsp-rename.test.ts +171 -0
- package/src/__tests__/mc-integration/say-fstring.test.ts +211 -0
- package/src/__tests__/mc-integration/stdlib-coverage-2.test.ts +1 -1
- package/src/__tests__/mc-integration/stdlib-coverage-3.test.ts +1 -1
- package/src/__tests__/mc-integration/stdlib-coverage-4.test.ts +1 -1
- package/src/__tests__/mc-integration/stdlib-coverage-5.test.ts +1 -1
- package/src/__tests__/mc-integration/stdlib-coverage-6.test.ts +1 -1
- package/src/__tests__/mc-integration/stdlib-coverage-7.test.ts +1 -1
- package/src/__tests__/mc-integration/stdlib-coverage-8.test.ts +1 -1
- package/src/__tests__/mc-syntax.test.ts +3 -0
- package/src/__tests__/monomorphize-coverage.test.ts +220 -0
- package/src/__tests__/optimizer-cse.test.ts +250 -0
- package/src/__tests__/parser.test.ts +4 -13
- package/src/__tests__/repl-server-extra.test.ts +6 -6
- package/src/__tests__/repl-server.test.ts +5 -6
- package/src/__tests__/stdlib/queue.test.ts +6 -6
- package/src/lexer/index.ts +2 -1
- package/src/lint/index.ts +713 -5
- package/src/mc-test/client.ts +40 -0
- package/src/mir/lower.ts +111 -2
- package/src/optimizer/interprocedural.ts +40 -2
- package/src/parser/decl-parser.ts +349 -0
- package/src/parser/expr-parser.ts +838 -0
- package/src/parser/index.ts +17 -2558
- package/src/parser/stmt-parser.ts +585 -0
- package/src/parser/type-parser.ts +276 -0
- package/src/parser/utils.ts +173 -0
- package/src/stdlib/queue.mcrs +19 -6
|
@@ -0,0 +1,669 @@
|
|
|
1
|
+
# Quaternion
|
|
2
|
+
|
|
3
|
+
> 本文档由 `src/stdlib/quaternion.mcrs` 自动生成,请勿手动编辑。
|
|
4
|
+
|
|
5
|
+
## API 列表
|
|
6
|
+
|
|
7
|
+
- [quat_identity_w](#quat-identity-w)
|
|
8
|
+
- [quat_identity_x](#quat-identity-x)
|
|
9
|
+
- [quat_identity_y](#quat-identity-y)
|
|
10
|
+
- [quat_identity_z](#quat-identity-z)
|
|
11
|
+
- [quat_axis_x_x](#quat-axis-x-x)
|
|
12
|
+
- [quat_axis_x_y](#quat-axis-x-y)
|
|
13
|
+
- [quat_axis_x_z](#quat-axis-x-z)
|
|
14
|
+
- [quat_axis_x_w](#quat-axis-x-w)
|
|
15
|
+
- [quat_axis_y_x](#quat-axis-y-x)
|
|
16
|
+
- [quat_axis_y_y](#quat-axis-y-y)
|
|
17
|
+
- [quat_axis_y_z](#quat-axis-y-z)
|
|
18
|
+
- [quat_axis_y_w](#quat-axis-y-w)
|
|
19
|
+
- [quat_axis_z_x](#quat-axis-z-x)
|
|
20
|
+
- [quat_axis_z_y](#quat-axis-z-y)
|
|
21
|
+
- [quat_axis_z_z](#quat-axis-z-z)
|
|
22
|
+
- [quat_axis_z_w](#quat-axis-z-w)
|
|
23
|
+
- [quat_mul_x](#quat-mul-x)
|
|
24
|
+
- [quat_mul_y](#quat-mul-y)
|
|
25
|
+
- [quat_mul_z](#quat-mul-z)
|
|
26
|
+
- [quat_mul_w](#quat-mul-w)
|
|
27
|
+
- [quat_conj_x](#quat-conj-x)
|
|
28
|
+
- [quat_conj_y](#quat-conj-y)
|
|
29
|
+
- [quat_conj_z](#quat-conj-z)
|
|
30
|
+
- [quat_conj_w](#quat-conj-w)
|
|
31
|
+
- [quat_mag_sq](#quat-mag-sq)
|
|
32
|
+
- [quat_dot](#quat-dot)
|
|
33
|
+
- [quat_slerp_x](#quat-slerp-x)
|
|
34
|
+
- [quat_slerp_y](#quat-slerp-y)
|
|
35
|
+
- [quat_slerp_z](#quat-slerp-z)
|
|
36
|
+
- [quat_slerp_w](#quat-slerp-w)
|
|
37
|
+
- [quat_euler_x](#quat-euler-x)
|
|
38
|
+
- [quat_euler_y](#quat-euler-y)
|
|
39
|
+
- [quat_euler_z](#quat-euler-z)
|
|
40
|
+
- [quat_euler_w](#quat-euler-w)
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## `quat_identity_w` <Badge type="info" text="v2.0.0" />
|
|
45
|
+
|
|
46
|
+
单位四元数 (0,0,0,1) 的 W 分量
|
|
47
|
+
|
|
48
|
+
```redscript
|
|
49
|
+
fn quat_identity_w(): int
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**返回:** 10000
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## `quat_identity_x` <Badge type="info" text="v2.0.0" />
|
|
57
|
+
|
|
58
|
+
单位四元数的 X 分量
|
|
59
|
+
|
|
60
|
+
```redscript
|
|
61
|
+
fn quat_identity_x(): int
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**返回:** 0
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## `quat_identity_y` <Badge type="info" text="v2.0.0" />
|
|
69
|
+
|
|
70
|
+
单位四元数的 Y 分量
|
|
71
|
+
|
|
72
|
+
```redscript
|
|
73
|
+
fn quat_identity_y(): int
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**返回:** 0
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## `quat_identity_z` <Badge type="info" text="v2.0.0" />
|
|
81
|
+
|
|
82
|
+
单位四元数的 Z 分量
|
|
83
|
+
|
|
84
|
+
```redscript
|
|
85
|
+
fn quat_identity_z(): int
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**返回:** 0
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## `quat_axis_x_x` <Badge type="info" text="v2.0.0" />
|
|
93
|
+
|
|
94
|
+
绕 X 轴旋转 angle_deg° 的四元数 X 分量
|
|
95
|
+
|
|
96
|
+
```redscript
|
|
97
|
+
fn quat_axis_x_x(angle_deg: int): int
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**参数**
|
|
101
|
+
|
|
102
|
+
| 参数 | 说明 |
|
|
103
|
+
|------|------|
|
|
104
|
+
| `angle_deg` | 旋转角度(整数,度) |
|
|
105
|
+
|
|
106
|
+
**返回:** sin(angle/2) ×10000
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## `quat_axis_x_y` <Badge type="info" text="v2.0.0" />
|
|
111
|
+
|
|
112
|
+
绕 X 轴旋转 angle_deg° 的四元数 Y 分量
|
|
113
|
+
|
|
114
|
+
```redscript
|
|
115
|
+
fn quat_axis_x_y(angle_deg: int): int
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**参数**
|
|
119
|
+
|
|
120
|
+
| 参数 | 说明 |
|
|
121
|
+
|------|------|
|
|
122
|
+
| `angle_deg` | 旋转角度(度) |
|
|
123
|
+
|
|
124
|
+
**返回:** 0
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## `quat_axis_x_z` <Badge type="info" text="v2.0.0" />
|
|
129
|
+
|
|
130
|
+
绕 X 轴旋转 angle_deg° 的四元数 Z 分量
|
|
131
|
+
|
|
132
|
+
```redscript
|
|
133
|
+
fn quat_axis_x_z(angle_deg: int): int
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**参数**
|
|
137
|
+
|
|
138
|
+
| 参数 | 说明 |
|
|
139
|
+
|------|------|
|
|
140
|
+
| `angle_deg` | 旋转角度(度) |
|
|
141
|
+
|
|
142
|
+
**返回:** 0
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## `quat_axis_x_w` <Badge type="info" text="v2.0.0" />
|
|
147
|
+
|
|
148
|
+
绕 X 轴旋转 angle_deg° 的四元数 W 分量
|
|
149
|
+
|
|
150
|
+
```redscript
|
|
151
|
+
fn quat_axis_x_w(angle_deg: int): int
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**参数**
|
|
155
|
+
|
|
156
|
+
| 参数 | 说明 |
|
|
157
|
+
|------|------|
|
|
158
|
+
| `angle_deg` | 旋转角度(度) |
|
|
159
|
+
|
|
160
|
+
**返回:** cos(angle/2) ×10000
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## `quat_axis_y_x` <Badge type="info" text="v2.0.0" />
|
|
165
|
+
|
|
166
|
+
绕 Y 轴旋转 angle_deg° 的四元数 X 分量
|
|
167
|
+
|
|
168
|
+
```redscript
|
|
169
|
+
fn quat_axis_y_x(angle_deg: int): int
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**参数**
|
|
173
|
+
|
|
174
|
+
| 参数 | 说明 |
|
|
175
|
+
|------|------|
|
|
176
|
+
| `angle_deg` | 旋转角度(度) |
|
|
177
|
+
|
|
178
|
+
**返回:** 0
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## `quat_axis_y_y` <Badge type="info" text="v2.0.0" />
|
|
183
|
+
|
|
184
|
+
绕 Y 轴旋转 angle_deg° 的四元数 Y 分量
|
|
185
|
+
|
|
186
|
+
```redscript
|
|
187
|
+
fn quat_axis_y_y(angle_deg: int): int
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**参数**
|
|
191
|
+
|
|
192
|
+
| 参数 | 说明 |
|
|
193
|
+
|------|------|
|
|
194
|
+
| `angle_deg` | 旋转角度(度) |
|
|
195
|
+
|
|
196
|
+
**返回:** sin(angle/2) ×10000
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## `quat_axis_y_z` <Badge type="info" text="v2.0.0" />
|
|
201
|
+
|
|
202
|
+
绕 Y 轴旋转 angle_deg° 的四元数 Z 分量
|
|
203
|
+
|
|
204
|
+
```redscript
|
|
205
|
+
fn quat_axis_y_z(angle_deg: int): int
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**参数**
|
|
209
|
+
|
|
210
|
+
| 参数 | 说明 |
|
|
211
|
+
|------|------|
|
|
212
|
+
| `angle_deg` | 旋转角度(度) |
|
|
213
|
+
|
|
214
|
+
**返回:** 0
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## `quat_axis_y_w` <Badge type="info" text="v2.0.0" />
|
|
219
|
+
|
|
220
|
+
绕 Y 轴旋转 angle_deg° 的四元数 W 分量
|
|
221
|
+
|
|
222
|
+
```redscript
|
|
223
|
+
fn quat_axis_y_w(angle_deg: int): int
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**参数**
|
|
227
|
+
|
|
228
|
+
| 参数 | 说明 |
|
|
229
|
+
|------|------|
|
|
230
|
+
| `angle_deg` | 旋转角度(度) |
|
|
231
|
+
|
|
232
|
+
**返回:** cos(angle/2) ×10000
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## `quat_axis_z_x` <Badge type="info" text="v2.0.0" />
|
|
237
|
+
|
|
238
|
+
绕 Z 轴旋转 angle_deg° 的四元数 X 分量
|
|
239
|
+
|
|
240
|
+
```redscript
|
|
241
|
+
fn quat_axis_z_x(angle_deg: int): int
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**参数**
|
|
245
|
+
|
|
246
|
+
| 参数 | 说明 |
|
|
247
|
+
|------|------|
|
|
248
|
+
| `angle_deg` | 旋转角度(度) |
|
|
249
|
+
|
|
250
|
+
**返回:** 0
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## `quat_axis_z_y` <Badge type="info" text="v2.0.0" />
|
|
255
|
+
|
|
256
|
+
绕 Z 轴旋转 angle_deg° 的四元数 Y 分量
|
|
257
|
+
|
|
258
|
+
```redscript
|
|
259
|
+
fn quat_axis_z_y(angle_deg: int): int
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**参数**
|
|
263
|
+
|
|
264
|
+
| 参数 | 说明 |
|
|
265
|
+
|------|------|
|
|
266
|
+
| `angle_deg` | 旋转角度(度) |
|
|
267
|
+
|
|
268
|
+
**返回:** 0
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## `quat_axis_z_z` <Badge type="info" text="v2.0.0" />
|
|
273
|
+
|
|
274
|
+
绕 Z 轴旋转 angle_deg° 的四元数 Z 分量
|
|
275
|
+
|
|
276
|
+
```redscript
|
|
277
|
+
fn quat_axis_z_z(angle_deg: int): int
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
**参数**
|
|
281
|
+
|
|
282
|
+
| 参数 | 说明 |
|
|
283
|
+
|------|------|
|
|
284
|
+
| `angle_deg` | 旋转角度(度) |
|
|
285
|
+
|
|
286
|
+
**返回:** sin(angle/2) ×10000
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## `quat_axis_z_w` <Badge type="info" text="v2.0.0" />
|
|
291
|
+
|
|
292
|
+
绕 Z 轴旋转 angle_deg° 的四元数 W 分量
|
|
293
|
+
|
|
294
|
+
```redscript
|
|
295
|
+
fn quat_axis_z_w(angle_deg: int): int
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**参数**
|
|
299
|
+
|
|
300
|
+
| 参数 | 说明 |
|
|
301
|
+
|------|------|
|
|
302
|
+
| `angle_deg` | 旋转角度(度) |
|
|
303
|
+
|
|
304
|
+
**返回:** cos(angle/2) ×10000
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## `quat_mul_x` <Badge type="info" text="v2.0.0" />
|
|
309
|
+
|
|
310
|
+
四元数乘积 a×b 的 X 分量(所有分量 ×10000)
|
|
311
|
+
|
|
312
|
+
```redscript
|
|
313
|
+
fn quat_mul_x(ax: int, ay: int, az: int, aw: int, bx: int, by: int, bz: int, bw: int): int
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**参数**
|
|
317
|
+
|
|
318
|
+
| 参数 | 说明 |
|
|
319
|
+
|------|------|
|
|
320
|
+
| `ax` | @param ay @param az @param aw Quaternion a components ×10000 |
|
|
321
|
+
| `bx` | @param by @param bz @param bw Quaternion b components ×10000 |
|
|
322
|
+
|
|
323
|
+
**返回:** (a×b) 的 X 分量 ×10000
|
|
324
|
+
|
|
325
|
+
**示例**
|
|
326
|
+
|
|
327
|
+
```redscript
|
|
328
|
+
let rx: int = quat_mul_x(ax, ay, az, aw, bx, by, bz, bw)
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## `quat_mul_y` <Badge type="info" text="v2.0.0" />
|
|
334
|
+
|
|
335
|
+
四元数乘积 a×b 的 Y 分量
|
|
336
|
+
|
|
337
|
+
```redscript
|
|
338
|
+
fn quat_mul_y(ax: int, ay: int, az: int, aw: int, bx: int, by: int, bz: int, bw: int): int
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**参数**
|
|
342
|
+
|
|
343
|
+
| 参数 | 说明 |
|
|
344
|
+
|------|------|
|
|
345
|
+
| `ax` | @param ay @param az @param aw Quaternion a components ×10000 |
|
|
346
|
+
| `bx` | @param by @param bz @param bw Quaternion b components ×10000 |
|
|
347
|
+
|
|
348
|
+
**返回:** (a×b) 的 Y 分量 ×10000
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## `quat_mul_z` <Badge type="info" text="v2.0.0" />
|
|
353
|
+
|
|
354
|
+
四元数乘积 a×b 的 Z 分量
|
|
355
|
+
|
|
356
|
+
```redscript
|
|
357
|
+
fn quat_mul_z(ax: int, ay: int, az: int, aw: int, bx: int, by: int, bz: int, bw: int): int
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
**参数**
|
|
361
|
+
|
|
362
|
+
| 参数 | 说明 |
|
|
363
|
+
|------|------|
|
|
364
|
+
| `ax` | @param ay @param az @param aw Quaternion a components ×10000 |
|
|
365
|
+
| `bx` | @param by @param bz @param bw Quaternion b components ×10000 |
|
|
366
|
+
|
|
367
|
+
**返回:** (a×b) 的 Z 分量 ×10000
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## `quat_mul_w` <Badge type="info" text="v2.0.0" />
|
|
372
|
+
|
|
373
|
+
四元数乘积 a×b 的 W 分量
|
|
374
|
+
|
|
375
|
+
```redscript
|
|
376
|
+
fn quat_mul_w(ax: int, ay: int, az: int, aw: int, bx: int, by: int, bz: int, bw: int): int
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
**参数**
|
|
380
|
+
|
|
381
|
+
| 参数 | 说明 |
|
|
382
|
+
|------|------|
|
|
383
|
+
| `ax` | @param ay @param az @param aw Quaternion a components ×10000 |
|
|
384
|
+
| `bx` | @param by @param bz @param bw Quaternion b components ×10000 |
|
|
385
|
+
|
|
386
|
+
**返回:** (a×b) 的 W 分量 ×10000
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
## `quat_conj_x` <Badge type="info" text="v2.0.0" />
|
|
391
|
+
|
|
392
|
+
四元数共轭的 X 分量
|
|
393
|
+
|
|
394
|
+
```redscript
|
|
395
|
+
fn quat_conj_x(qx: int, qy: int, qz: int, qw: int): int
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
**参数**
|
|
399
|
+
|
|
400
|
+
| 参数 | 说明 |
|
|
401
|
+
|------|------|
|
|
402
|
+
| `qx` | @param qy @param qz @param qw Input quaternion ×10000 |
|
|
403
|
+
|
|
404
|
+
**返回:** -qx
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## `quat_conj_y` <Badge type="info" text="v2.0.0" />
|
|
409
|
+
|
|
410
|
+
四元数共轭的 Y 分量
|
|
411
|
+
|
|
412
|
+
```redscript
|
|
413
|
+
fn quat_conj_y(qx: int, qy: int, qz: int, qw: int): int
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**参数**
|
|
417
|
+
|
|
418
|
+
| 参数 | 说明 |
|
|
419
|
+
|------|------|
|
|
420
|
+
| `qx` | @param qy @param qz @param qw Input quaternion ×10000 |
|
|
421
|
+
|
|
422
|
+
**返回:** -qy
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## `quat_conj_z` <Badge type="info" text="v2.0.0" />
|
|
427
|
+
|
|
428
|
+
四元数共轭的 Z 分量
|
|
429
|
+
|
|
430
|
+
```redscript
|
|
431
|
+
fn quat_conj_z(qx: int, qy: int, qz: int, qw: int): int
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
**参数**
|
|
435
|
+
|
|
436
|
+
| 参数 | 说明 |
|
|
437
|
+
|------|------|
|
|
438
|
+
| `qx` | @param qy @param qz @param qw Input quaternion ×10000 |
|
|
439
|
+
|
|
440
|
+
**返回:** -qz
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
## `quat_conj_w` <Badge type="info" text="v2.0.0" />
|
|
445
|
+
|
|
446
|
+
四元数共轭的 W 分量(不变)
|
|
447
|
+
|
|
448
|
+
```redscript
|
|
449
|
+
fn quat_conj_w(qx: int, qy: int, qz: int, qw: int): int
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
**参数**
|
|
453
|
+
|
|
454
|
+
| 参数 | 说明 |
|
|
455
|
+
|------|------|
|
|
456
|
+
| `qx` | @param qy @param qz @param qw Input quaternion ×10000 |
|
|
457
|
+
|
|
458
|
+
**返回:** qw
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## `quat_mag_sq` <Badge type="info" text="v2.0.0" />
|
|
463
|
+
|
|
464
|
+
四元数的模平方(×10000);单位四元数应等于 10000
|
|
465
|
+
|
|
466
|
+
```redscript
|
|
467
|
+
fn quat_mag_sq(qx: int, qy: int, qz: int, qw: int): int
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
**参数**
|
|
471
|
+
|
|
472
|
+
| 参数 | 说明 |
|
|
473
|
+
|------|------|
|
|
474
|
+
| `qx` | @param qy @param qz @param qw Quaternion components ×10000 |
|
|
475
|
+
|
|
476
|
+
**返回:** qx²/10000 + qy²/10000 + qz²/10000 + qw²/10000
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
## `quat_dot` <Badge type="info" text="v2.0.0" />
|
|
481
|
+
|
|
482
|
+
两个四元数的点积(×10000)
|
|
483
|
+
|
|
484
|
+
```redscript
|
|
485
|
+
fn quat_dot(ax: int, ay: int, az: int, aw: int, bx: int, by: int, bz: int, bw: int): int
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
**参数**
|
|
489
|
+
|
|
490
|
+
| 参数 | 说明 |
|
|
491
|
+
|------|------|
|
|
492
|
+
| `ax` | @param ay @param az @param aw Quaternion a ×10000 |
|
|
493
|
+
| `bx` | @param by @param bz @param bw Quaternion b ×10000 |
|
|
494
|
+
|
|
495
|
+
**返回:** ax*bx/10000 + ay*by/10000 + az*bz/10000 + aw*bw/10000
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## `quat_slerp_x` <Badge type="info" text="v2.0.0" />
|
|
500
|
+
|
|
501
|
+
两个四元数在 t/1000 处球面线性插值的 X 分量(LERP + 归一化近似)
|
|
502
|
+
|
|
503
|
+
```redscript
|
|
504
|
+
fn quat_slerp_x(ax: int, ay: int, az: int, aw: int, bx: int, by: int, bz: int, bw: int, t: int): int
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
**参数**
|
|
508
|
+
|
|
509
|
+
| 参数 | 说明 |
|
|
510
|
+
|------|------|
|
|
511
|
+
| `ax` | @param ay @param az @param aw Start quaternion ×10000 |
|
|
512
|
+
| `bx` | @param by @param bz @param bw End quaternion ×10000 |
|
|
513
|
+
| `t` | 插值系数 ×1000(0=a,1000=b) |
|
|
514
|
+
|
|
515
|
+
**返回:** 插值四元数的 X 分量 ×10000
|
|
516
|
+
|
|
517
|
+
**示例**
|
|
518
|
+
|
|
519
|
+
```redscript
|
|
520
|
+
let rx: int = quat_slerp_x(ax, ay, az, aw, bx, by, bz, bw, 500)
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
|
|
525
|
+
## `quat_slerp_y` <Badge type="info" text="v2.0.0" />
|
|
526
|
+
|
|
527
|
+
两个四元数在 t/1000 处球面线性插值的 Y 分量
|
|
528
|
+
|
|
529
|
+
```redscript
|
|
530
|
+
fn quat_slerp_y(ax: int, ay: int, az: int, aw: int, bx: int, by: int, bz: int, bw: int, t: int): int
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
**参数**
|
|
534
|
+
|
|
535
|
+
| 参数 | 说明 |
|
|
536
|
+
|------|------|
|
|
537
|
+
| `ax` | @param ay @param az @param aw Start quaternion ×10000 |
|
|
538
|
+
| `bx` | @param by @param bz @param bw End quaternion ×10000 |
|
|
539
|
+
| `t` | Interpolation factor ×1000 |
|
|
540
|
+
|
|
541
|
+
**返回:** 插值四元数的 Y 分量 ×10000
|
|
542
|
+
|
|
543
|
+
---
|
|
544
|
+
|
|
545
|
+
## `quat_slerp_z` <Badge type="info" text="v2.0.0" />
|
|
546
|
+
|
|
547
|
+
两个四元数在 t/1000 处球面线性插值的 Z 分量
|
|
548
|
+
|
|
549
|
+
```redscript
|
|
550
|
+
fn quat_slerp_z(ax: int, ay: int, az: int, aw: int, bx: int, by: int, bz: int, bw: int, t: int): int
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
**参数**
|
|
554
|
+
|
|
555
|
+
| 参数 | 说明 |
|
|
556
|
+
|------|------|
|
|
557
|
+
| `ax` | @param ay @param az @param aw Start quaternion ×10000 |
|
|
558
|
+
| `bx` | @param by @param bz @param bw End quaternion ×10000 |
|
|
559
|
+
| `t` | Interpolation factor ×1000 |
|
|
560
|
+
|
|
561
|
+
**返回:** 插值四元数的 Z 分量 ×10000
|
|
562
|
+
|
|
563
|
+
---
|
|
564
|
+
|
|
565
|
+
## `quat_slerp_w` <Badge type="info" text="v2.0.0" />
|
|
566
|
+
|
|
567
|
+
两个四元数在 t/1000 处球面线性插值的 W 分量
|
|
568
|
+
|
|
569
|
+
```redscript
|
|
570
|
+
fn quat_slerp_w(ax: int, ay: int, az: int, aw: int, bx: int, by: int, bz: int, bw: int, t: int): int
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
**参数**
|
|
574
|
+
|
|
575
|
+
| 参数 | 说明 |
|
|
576
|
+
|------|------|
|
|
577
|
+
| `ax` | @param ay @param az @param aw Start quaternion ×10000 |
|
|
578
|
+
| `bx` | @param by @param bz @param bw End quaternion ×10000 |
|
|
579
|
+
| `t` | Interpolation factor ×1000 |
|
|
580
|
+
|
|
581
|
+
**返回:** 插值四元数的 W 分量 ×10000
|
|
582
|
+
|
|
583
|
+
---
|
|
584
|
+
|
|
585
|
+
## `quat_euler_x` <Badge type="info" text="v2.0.0" />
|
|
586
|
+
|
|
587
|
+
欧拉角(YXZ 顺序,MC 约定)转换为四元数的 X 分量
|
|
588
|
+
|
|
589
|
+
```redscript
|
|
590
|
+
fn quat_euler_x(yaw: int, pitch: int, roll: int): int
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
**参数**
|
|
594
|
+
|
|
595
|
+
| 参数 | 说明 |
|
|
596
|
+
|------|------|
|
|
597
|
+
| `yaw` | Y 轴旋转(度) |
|
|
598
|
+
| `pitch` | X 轴旋转(度) |
|
|
599
|
+
| `roll` | Z 轴旋转(度) |
|
|
600
|
+
|
|
601
|
+
**返回:** X 分量 ×10000
|
|
602
|
+
|
|
603
|
+
**示例**
|
|
604
|
+
|
|
605
|
+
```redscript
|
|
606
|
+
let qx: int = quat_euler_x(90, 0, 0)
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
---
|
|
610
|
+
|
|
611
|
+
## `quat_euler_y` <Badge type="info" text="v2.0.0" />
|
|
612
|
+
|
|
613
|
+
欧拉角(YXZ 顺序)转换为四元数的 Y 分量
|
|
614
|
+
|
|
615
|
+
```redscript
|
|
616
|
+
fn quat_euler_y(yaw: int, pitch: int, roll: int): int
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
**参数**
|
|
620
|
+
|
|
621
|
+
| 参数 | 说明 |
|
|
622
|
+
|------|------|
|
|
623
|
+
| `yaw` | Y 轴旋转(度) |
|
|
624
|
+
| `pitch` | X 轴旋转(度) |
|
|
625
|
+
| `roll` | Z 轴旋转(度) |
|
|
626
|
+
|
|
627
|
+
**返回:** Y 分量 ×10000
|
|
628
|
+
|
|
629
|
+
---
|
|
630
|
+
|
|
631
|
+
## `quat_euler_z` <Badge type="info" text="v2.0.0" />
|
|
632
|
+
|
|
633
|
+
欧拉角(YXZ 顺序)转换为四元数的 Z 分量
|
|
634
|
+
|
|
635
|
+
```redscript
|
|
636
|
+
fn quat_euler_z(yaw: int, pitch: int, roll: int): int
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
**参数**
|
|
640
|
+
|
|
641
|
+
| 参数 | 说明 |
|
|
642
|
+
|------|------|
|
|
643
|
+
| `yaw` | Y 轴旋转(度) |
|
|
644
|
+
| `pitch` | X 轴旋转(度) |
|
|
645
|
+
| `roll` | Z 轴旋转(度) |
|
|
646
|
+
|
|
647
|
+
**返回:** Z 分量 ×10000
|
|
648
|
+
|
|
649
|
+
---
|
|
650
|
+
|
|
651
|
+
## `quat_euler_w` <Badge type="info" text="v2.0.0" />
|
|
652
|
+
|
|
653
|
+
欧拉角(YXZ 顺序)转换为四元数的 W 分量
|
|
654
|
+
|
|
655
|
+
```redscript
|
|
656
|
+
fn quat_euler_w(yaw: int, pitch: int, roll: int): int
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
**参数**
|
|
660
|
+
|
|
661
|
+
| 参数 | 说明 |
|
|
662
|
+
|------|------|
|
|
663
|
+
| `yaw` | Y 轴旋转(度) |
|
|
664
|
+
| `pitch` | X 轴旋转(度) |
|
|
665
|
+
| `roll` | Z 轴旋转(度) |
|
|
666
|
+
|
|
667
|
+
**返回:** W 分量 ×10000
|
|
668
|
+
|
|
669
|
+
---
|