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,673 @@
|
|
|
1
|
+
# Quaternion
|
|
2
|
+
|
|
3
|
+
> Auto-generated from `src/stdlib/quaternion.mcrs` — do not edit manually.
|
|
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
|
+
W component of the identity quaternion `(0, 0, 0, 1)`.
|
|
47
|
+
|
|
48
|
+
```redscript
|
|
49
|
+
fn quat_identity_w(): int
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Returns:** `10000`
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## `quat_identity_x` <Badge type="info" text="v2.0.0" />
|
|
57
|
+
|
|
58
|
+
X component of the identity quaternion.
|
|
59
|
+
|
|
60
|
+
```redscript
|
|
61
|
+
fn quat_identity_x(): int
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Returns:** `0`
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## `quat_identity_y` <Badge type="info" text="v2.0.0" />
|
|
69
|
+
|
|
70
|
+
Y component of the identity quaternion.
|
|
71
|
+
|
|
72
|
+
```redscript
|
|
73
|
+
fn quat_identity_y(): int
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Returns:** `0`
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## `quat_identity_z` <Badge type="info" text="v2.0.0" />
|
|
81
|
+
|
|
82
|
+
Z component of the identity quaternion.
|
|
83
|
+
|
|
84
|
+
```redscript
|
|
85
|
+
fn quat_identity_z(): int
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Returns:** `0`
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## `quat_axis_x_x` <Badge type="info" text="v2.0.0" />
|
|
93
|
+
|
|
94
|
+
X component of a quaternion representing rotation by `angle_deg` around the X axis.
|
|
95
|
+
|
|
96
|
+
```redscript
|
|
97
|
+
fn quat_axis_x_x(angle_deg: int): int
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Parameters**
|
|
101
|
+
|
|
102
|
+
| Parameter | Description |
|
|
103
|
+
|-----------|-------------|
|
|
104
|
+
| `angle_deg` | Rotation angle in degrees (integer) |
|
|
105
|
+
|
|
106
|
+
**Returns:** `sin(angle/2)` ×10000
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## `quat_axis_x_y` <Badge type="info" text="v2.0.0" />
|
|
111
|
+
|
|
112
|
+
Y component of a quaternion representing rotation by `angle_deg` around the X axis.
|
|
113
|
+
|
|
114
|
+
```redscript
|
|
115
|
+
fn quat_axis_x_y(angle_deg: int): int
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Parameters**
|
|
119
|
+
|
|
120
|
+
| Parameter | Description |
|
|
121
|
+
|-----------|-------------|
|
|
122
|
+
| `angle_deg` | Rotation angle in degrees |
|
|
123
|
+
|
|
124
|
+
**Returns:** `0`
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## `quat_axis_x_z` <Badge type="info" text="v2.0.0" />
|
|
129
|
+
|
|
130
|
+
Z component of a quaternion representing rotation by `angle_deg` around the X axis.
|
|
131
|
+
|
|
132
|
+
```redscript
|
|
133
|
+
fn quat_axis_x_z(angle_deg: int): int
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Parameters**
|
|
137
|
+
|
|
138
|
+
| Parameter | Description |
|
|
139
|
+
|-----------|-------------|
|
|
140
|
+
| `angle_deg` | Rotation angle in degrees |
|
|
141
|
+
|
|
142
|
+
**Returns:** `0`
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## `quat_axis_x_w` <Badge type="info" text="v2.0.0" />
|
|
147
|
+
|
|
148
|
+
W component of a quaternion representing rotation by `angle_deg` around the X axis.
|
|
149
|
+
|
|
150
|
+
```redscript
|
|
151
|
+
fn quat_axis_x_w(angle_deg: int): int
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Parameters**
|
|
155
|
+
|
|
156
|
+
| Parameter | Description |
|
|
157
|
+
|-----------|-------------|
|
|
158
|
+
| `angle_deg` | Rotation angle in degrees |
|
|
159
|
+
|
|
160
|
+
**Returns:** `cos(angle/2)` ×10000
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## `quat_axis_y_x` <Badge type="info" text="v2.0.0" />
|
|
165
|
+
|
|
166
|
+
X component of a quaternion representing rotation by `angle_deg` around the Y axis.
|
|
167
|
+
|
|
168
|
+
```redscript
|
|
169
|
+
fn quat_axis_y_x(angle_deg: int): int
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Parameters**
|
|
173
|
+
|
|
174
|
+
| Parameter | Description |
|
|
175
|
+
|-----------|-------------|
|
|
176
|
+
| `angle_deg` | Rotation angle in degrees |
|
|
177
|
+
|
|
178
|
+
**Returns:** `0`
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## `quat_axis_y_y` <Badge type="info" text="v2.0.0" />
|
|
183
|
+
|
|
184
|
+
Y component of a quaternion representing rotation by `angle_deg` around the Y axis.
|
|
185
|
+
|
|
186
|
+
```redscript
|
|
187
|
+
fn quat_axis_y_y(angle_deg: int): int
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Parameters**
|
|
191
|
+
|
|
192
|
+
| Parameter | Description |
|
|
193
|
+
|-----------|-------------|
|
|
194
|
+
| `angle_deg` | Rotation angle in degrees |
|
|
195
|
+
|
|
196
|
+
**Returns:** `sin(angle/2)` ×10000
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## `quat_axis_y_z` <Badge type="info" text="v2.0.0" />
|
|
201
|
+
|
|
202
|
+
Z component of a quaternion representing rotation by `angle_deg` around the Y axis.
|
|
203
|
+
|
|
204
|
+
```redscript
|
|
205
|
+
fn quat_axis_y_z(angle_deg: int): int
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Parameters**
|
|
209
|
+
|
|
210
|
+
| Parameter | Description |
|
|
211
|
+
|-----------|-------------|
|
|
212
|
+
| `angle_deg` | Rotation angle in degrees |
|
|
213
|
+
|
|
214
|
+
**Returns:** `0`
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## `quat_axis_y_w` <Badge type="info" text="v2.0.0" />
|
|
219
|
+
|
|
220
|
+
W component of a quaternion representing rotation by `angle_deg` around the Y axis.
|
|
221
|
+
|
|
222
|
+
```redscript
|
|
223
|
+
fn quat_axis_y_w(angle_deg: int): int
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Parameters**
|
|
227
|
+
|
|
228
|
+
| Parameter | Description |
|
|
229
|
+
|-----------|-------------|
|
|
230
|
+
| `angle_deg` | Rotation angle in degrees |
|
|
231
|
+
|
|
232
|
+
**Returns:** `cos(angle/2)` ×10000
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## `quat_axis_z_x` <Badge type="info" text="v2.0.0" />
|
|
237
|
+
|
|
238
|
+
X component of a quaternion representing rotation by `angle_deg` around the Z axis.
|
|
239
|
+
|
|
240
|
+
```redscript
|
|
241
|
+
fn quat_axis_z_x(angle_deg: int): int
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Parameters**
|
|
245
|
+
|
|
246
|
+
| Parameter | Description |
|
|
247
|
+
|-----------|-------------|
|
|
248
|
+
| `angle_deg` | Rotation angle in degrees |
|
|
249
|
+
|
|
250
|
+
**Returns:** `0`
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## `quat_axis_z_y` <Badge type="info" text="v2.0.0" />
|
|
255
|
+
|
|
256
|
+
Y component of a quaternion representing rotation by `angle_deg` around the Z axis.
|
|
257
|
+
|
|
258
|
+
```redscript
|
|
259
|
+
fn quat_axis_z_y(angle_deg: int): int
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Parameters**
|
|
263
|
+
|
|
264
|
+
| Parameter | Description |
|
|
265
|
+
|-----------|-------------|
|
|
266
|
+
| `angle_deg` | Rotation angle in degrees |
|
|
267
|
+
|
|
268
|
+
**Returns:** `0`
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## `quat_axis_z_z` <Badge type="info" text="v2.0.0" />
|
|
273
|
+
|
|
274
|
+
Z component of a quaternion representing rotation by `angle_deg` around the Z axis.
|
|
275
|
+
|
|
276
|
+
```redscript
|
|
277
|
+
fn quat_axis_z_z(angle_deg: int): int
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
**Parameters**
|
|
281
|
+
|
|
282
|
+
| Parameter | Description |
|
|
283
|
+
|-----------|-------------|
|
|
284
|
+
| `angle_deg` | Rotation angle in degrees |
|
|
285
|
+
|
|
286
|
+
**Returns:** `sin(angle/2)` ×10000
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## `quat_axis_z_w` <Badge type="info" text="v2.0.0" />
|
|
291
|
+
|
|
292
|
+
W component of a quaternion representing rotation by `angle_deg` around the Z axis.
|
|
293
|
+
|
|
294
|
+
```redscript
|
|
295
|
+
fn quat_axis_z_w(angle_deg: int): int
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**Parameters**
|
|
299
|
+
|
|
300
|
+
| Parameter | Description |
|
|
301
|
+
|-----------|-------------|
|
|
302
|
+
| `angle_deg` | Rotation angle in degrees |
|
|
303
|
+
|
|
304
|
+
**Returns:** `cos(angle/2)` ×10000
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## `quat_mul_x` <Badge type="info" text="v2.0.0" />
|
|
309
|
+
|
|
310
|
+
X component of quaternion product `a × b`.
|
|
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
|
+
**Parameters**
|
|
317
|
+
|
|
318
|
+
| Parameter | Description |
|
|
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
|
+
**Returns:** X component of `a × b` ×10000
|
|
324
|
+
|
|
325
|
+
**Example**
|
|
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
|
+
Y component of quaternion product `a × b`.
|
|
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
|
+
**Parameters**
|
|
342
|
+
|
|
343
|
+
| Parameter | Description |
|
|
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
|
+
**Returns:** Y component of `a × b` ×10000
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## `quat_mul_z` <Badge type="info" text="v2.0.0" />
|
|
353
|
+
|
|
354
|
+
Z component of quaternion product `a × b`.
|
|
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
|
+
**Parameters**
|
|
361
|
+
|
|
362
|
+
| Parameter | Description |
|
|
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
|
+
**Returns:** Z component of `a × b` ×10000
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## `quat_mul_w` <Badge type="info" text="v2.0.0" />
|
|
372
|
+
|
|
373
|
+
W component of quaternion product `a × b`.
|
|
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
|
+
**Parameters**
|
|
380
|
+
|
|
381
|
+
| Parameter | Description |
|
|
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
|
+
**Returns:** W component of `a × b` ×10000
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
## `quat_conj_x` <Badge type="info" text="v2.0.0" />
|
|
391
|
+
|
|
392
|
+
X component of the conjugate of quaternion `(qx, qy, qz, qw)`.
|
|
393
|
+
|
|
394
|
+
```redscript
|
|
395
|
+
fn quat_conj_x(qx: int, qy: int, qz: int, qw: int): int
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
**Parameters**
|
|
399
|
+
|
|
400
|
+
| Parameter | Description |
|
|
401
|
+
|-----------|-------------|
|
|
402
|
+
| `qx` | @param qy @param qz @param qw Input quaternion ×10000 |
|
|
403
|
+
|
|
404
|
+
**Returns:** `-qx`
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## `quat_conj_y` <Badge type="info" text="v2.0.0" />
|
|
409
|
+
|
|
410
|
+
Y component of the conjugate of quaternion `(qx, qy, qz, qw)`.
|
|
411
|
+
|
|
412
|
+
```redscript
|
|
413
|
+
fn quat_conj_y(qx: int, qy: int, qz: int, qw: int): int
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**Parameters**
|
|
417
|
+
|
|
418
|
+
| Parameter | Description |
|
|
419
|
+
|-----------|-------------|
|
|
420
|
+
| `qx` | @param qy @param qz @param qw Input quaternion ×10000 |
|
|
421
|
+
|
|
422
|
+
**Returns:** `-qy`
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## `quat_conj_z` <Badge type="info" text="v2.0.0" />
|
|
427
|
+
|
|
428
|
+
Z component of the conjugate of quaternion `(qx, qy, qz, qw)`.
|
|
429
|
+
|
|
430
|
+
```redscript
|
|
431
|
+
fn quat_conj_z(qx: int, qy: int, qz: int, qw: int): int
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
**Parameters**
|
|
435
|
+
|
|
436
|
+
| Parameter | Description |
|
|
437
|
+
|-----------|-------------|
|
|
438
|
+
| `qx` | @param qy @param qz @param qw Input quaternion ×10000 |
|
|
439
|
+
|
|
440
|
+
**Returns:** `-qz`
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
## `quat_conj_w` <Badge type="info" text="v2.0.0" />
|
|
445
|
+
|
|
446
|
+
W component of the conjugate of quaternion `(qx, qy, qz, qw)`.
|
|
447
|
+
|
|
448
|
+
```redscript
|
|
449
|
+
fn quat_conj_w(qx: int, qy: int, qz: int, qw: int): int
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
**Parameters**
|
|
453
|
+
|
|
454
|
+
| Parameter | Description |
|
|
455
|
+
|-----------|-------------|
|
|
456
|
+
| `qx` | @param qy @param qz @param qw Input quaternion ×10000 |
|
|
457
|
+
|
|
458
|
+
**Returns:** `qw` (unchanged)
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## `quat_mag_sq` <Badge type="info" text="v2.0.0" />
|
|
463
|
+
|
|
464
|
+
Magnitude squared of a quaternion in ×10000 scale.
|
|
465
|
+
|
|
466
|
+
For a unit quaternion this should equal `10000`.
|
|
467
|
+
|
|
468
|
+
```redscript
|
|
469
|
+
fn quat_mag_sq(qx: int, qy: int, qz: int, qw: int): int
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
**Parameters**
|
|
473
|
+
|
|
474
|
+
| Parameter | Description |
|
|
475
|
+
|-----------|-------------|
|
|
476
|
+
| `qx` | @param qy @param qz @param qw Quaternion components ×10000 |
|
|
477
|
+
|
|
478
|
+
**Returns:** `qx²/10000 + qy²/10000 + qz²/10000 + qw²/10000` (×10000)
|
|
479
|
+
|
|
480
|
+
---
|
|
481
|
+
|
|
482
|
+
## `quat_dot` <Badge type="info" text="v2.0.0" />
|
|
483
|
+
|
|
484
|
+
Dot product of two quaternions in ×10000 scale.
|
|
485
|
+
|
|
486
|
+
```redscript
|
|
487
|
+
fn quat_dot(ax: int, ay: int, az: int, aw: int, bx: int, by: int, bz: int, bw: int): int
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
**Parameters**
|
|
491
|
+
|
|
492
|
+
| Parameter | Description |
|
|
493
|
+
|-----------|-------------|
|
|
494
|
+
| `ax` | @param ay @param az @param aw Quaternion a ×10000 |
|
|
495
|
+
| `bx` | @param by @param bz @param bw Quaternion b ×10000 |
|
|
496
|
+
|
|
497
|
+
**Returns:** `ax*bx/10000 + ay*by/10000 + az*bz/10000 + aw*bw/10000`
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
## `quat_slerp_x` <Badge type="info" text="v2.0.0" />
|
|
502
|
+
|
|
503
|
+
X component of the SLERP interpolation between quaternions `a` and `b` at `t/1000`.
|
|
504
|
+
|
|
505
|
+
Uses LERP + normalise (good approximation for small angles).
|
|
506
|
+
|
|
507
|
+
```redscript
|
|
508
|
+
fn quat_slerp_x(ax: int, ay: int, az: int, aw: int, bx: int, by: int, bz: int, bw: int, t: int): int
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
**Parameters**
|
|
512
|
+
|
|
513
|
+
| Parameter | Description |
|
|
514
|
+
|-----------|-------------|
|
|
515
|
+
| `ax` | @param ay @param az @param aw Start quaternion ×10000 |
|
|
516
|
+
| `bx` | @param by @param bz @param bw End quaternion ×10000 |
|
|
517
|
+
| `t` | Interpolation factor ×1000 (0 = a, 1000 = b) |
|
|
518
|
+
|
|
519
|
+
**Returns:** X component of interpolated quaternion ×10000
|
|
520
|
+
|
|
521
|
+
**Example**
|
|
522
|
+
|
|
523
|
+
```redscript
|
|
524
|
+
let rx: int = quat_slerp_x(ax, ay, az, aw, bx, by, bz, bw, 500)
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
---
|
|
528
|
+
|
|
529
|
+
## `quat_slerp_y` <Badge type="info" text="v2.0.0" />
|
|
530
|
+
|
|
531
|
+
Y component of the SLERP interpolation between quaternions `a` and `b` at `t/1000`.
|
|
532
|
+
|
|
533
|
+
```redscript
|
|
534
|
+
fn quat_slerp_y(ax: int, ay: int, az: int, aw: int, bx: int, by: int, bz: int, bw: int, t: int): int
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
**Parameters**
|
|
538
|
+
|
|
539
|
+
| Parameter | Description |
|
|
540
|
+
|-----------|-------------|
|
|
541
|
+
| `ax` | @param ay @param az @param aw Start quaternion ×10000 |
|
|
542
|
+
| `bx` | @param by @param bz @param bw End quaternion ×10000 |
|
|
543
|
+
| `t` | Interpolation factor ×1000 |
|
|
544
|
+
|
|
545
|
+
**Returns:** Y component of interpolated quaternion ×10000
|
|
546
|
+
|
|
547
|
+
---
|
|
548
|
+
|
|
549
|
+
## `quat_slerp_z` <Badge type="info" text="v2.0.0" />
|
|
550
|
+
|
|
551
|
+
Z component of the SLERP interpolation between quaternions `a` and `b` at `t/1000`.
|
|
552
|
+
|
|
553
|
+
```redscript
|
|
554
|
+
fn quat_slerp_z(ax: int, ay: int, az: int, aw: int, bx: int, by: int, bz: int, bw: int, t: int): int
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
**Parameters**
|
|
558
|
+
|
|
559
|
+
| Parameter | Description |
|
|
560
|
+
|-----------|-------------|
|
|
561
|
+
| `ax` | @param ay @param az @param aw Start quaternion ×10000 |
|
|
562
|
+
| `bx` | @param by @param bz @param bw End quaternion ×10000 |
|
|
563
|
+
| `t` | Interpolation factor ×1000 |
|
|
564
|
+
|
|
565
|
+
**Returns:** Z component of interpolated quaternion ×10000
|
|
566
|
+
|
|
567
|
+
---
|
|
568
|
+
|
|
569
|
+
## `quat_slerp_w` <Badge type="info" text="v2.0.0" />
|
|
570
|
+
|
|
571
|
+
W component of the SLERP interpolation between quaternions `a` and `b` at `t/1000`.
|
|
572
|
+
|
|
573
|
+
```redscript
|
|
574
|
+
fn quat_slerp_w(ax: int, ay: int, az: int, aw: int, bx: int, by: int, bz: int, bw: int, t: int): int
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
**Parameters**
|
|
578
|
+
|
|
579
|
+
| Parameter | Description |
|
|
580
|
+
|-----------|-------------|
|
|
581
|
+
| `ax` | @param ay @param az @param aw Start quaternion ×10000 |
|
|
582
|
+
| `bx` | @param by @param bz @param bw End quaternion ×10000 |
|
|
583
|
+
| `t` | Interpolation factor ×1000 |
|
|
584
|
+
|
|
585
|
+
**Returns:** W component of interpolated quaternion ×10000
|
|
586
|
+
|
|
587
|
+
---
|
|
588
|
+
|
|
589
|
+
## `quat_euler_x` <Badge type="info" text="v2.0.0" />
|
|
590
|
+
|
|
591
|
+
X component of the quaternion from Euler angles (YXZ order, MC convention).
|
|
592
|
+
|
|
593
|
+
```redscript
|
|
594
|
+
fn quat_euler_x(yaw: int, pitch: int, roll: int): int
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
**Parameters**
|
|
598
|
+
|
|
599
|
+
| Parameter | Description |
|
|
600
|
+
|-----------|-------------|
|
|
601
|
+
| `yaw` | Y-axis rotation in degrees |
|
|
602
|
+
| `pitch` | X-axis rotation in degrees |
|
|
603
|
+
| `roll` | Z-axis rotation in degrees |
|
|
604
|
+
|
|
605
|
+
**Returns:** X component ×10000
|
|
606
|
+
|
|
607
|
+
**Example**
|
|
608
|
+
|
|
609
|
+
```redscript
|
|
610
|
+
let qx: int = quat_euler_x(90, 0, 0)
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
---
|
|
614
|
+
|
|
615
|
+
## `quat_euler_y` <Badge type="info" text="v2.0.0" />
|
|
616
|
+
|
|
617
|
+
Y component of the quaternion from Euler angles (YXZ order, MC convention).
|
|
618
|
+
|
|
619
|
+
```redscript
|
|
620
|
+
fn quat_euler_y(yaw: int, pitch: int, roll: int): int
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
**Parameters**
|
|
624
|
+
|
|
625
|
+
| Parameter | Description |
|
|
626
|
+
|-----------|-------------|
|
|
627
|
+
| `yaw` | Y-axis rotation in degrees |
|
|
628
|
+
| `pitch` | X-axis rotation in degrees |
|
|
629
|
+
| `roll` | Z-axis rotation in degrees |
|
|
630
|
+
|
|
631
|
+
**Returns:** Y component ×10000
|
|
632
|
+
|
|
633
|
+
---
|
|
634
|
+
|
|
635
|
+
## `quat_euler_z` <Badge type="info" text="v2.0.0" />
|
|
636
|
+
|
|
637
|
+
Z component of the quaternion from Euler angles (YXZ order, MC convention).
|
|
638
|
+
|
|
639
|
+
```redscript
|
|
640
|
+
fn quat_euler_z(yaw: int, pitch: int, roll: int): int
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
**Parameters**
|
|
644
|
+
|
|
645
|
+
| Parameter | Description |
|
|
646
|
+
|-----------|-------------|
|
|
647
|
+
| `yaw` | Y-axis rotation in degrees |
|
|
648
|
+
| `pitch` | X-axis rotation in degrees |
|
|
649
|
+
| `roll` | Z-axis rotation in degrees |
|
|
650
|
+
|
|
651
|
+
**Returns:** Z component ×10000
|
|
652
|
+
|
|
653
|
+
---
|
|
654
|
+
|
|
655
|
+
## `quat_euler_w` <Badge type="info" text="v2.0.0" />
|
|
656
|
+
|
|
657
|
+
W component of the quaternion from Euler angles (YXZ order, MC convention).
|
|
658
|
+
|
|
659
|
+
```redscript
|
|
660
|
+
fn quat_euler_w(yaw: int, pitch: int, roll: int): int
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
**Parameters**
|
|
664
|
+
|
|
665
|
+
| Parameter | Description |
|
|
666
|
+
|-----------|-------------|
|
|
667
|
+
| `yaw` | Y-axis rotation in degrees |
|
|
668
|
+
| `pitch` | X-axis rotation in degrees |
|
|
669
|
+
| `roll` | Z-axis rotation in degrees |
|
|
670
|
+
|
|
671
|
+
**Returns:** W component ×10000
|
|
672
|
+
|
|
673
|
+
---
|