@origingame/engine 0.1.1 → 0.3.0

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.
Files changed (109) hide show
  1. package/bin/og.mjs +1 -1
  2. package/dist/web/origin-engine.d.ts +219 -5
  3. package/dist/web/origin-engine.js +1344 -125
  4. package/dist/web/origin-engine_bg.wasm +0 -0
  5. package/dist/web/origin-engine_bg.wasm.d.ts +68 -3
  6. package/dist/web-publish/origin-engine-lanes.js +1007 -22
  7. package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
  8. package/dist/web-publish/origin-engine.d.ts +162 -5
  9. package/dist/web-publish/origin-engine.js +1004 -19
  10. package/dist/web-publish/origin-engine_bg.wasm +0 -0
  11. package/dist/web-publish/origin-engine_bg.wasm.d.ts +52 -3
  12. package/dist/web-publish-2d/origin-engine-lanes.js +1007 -22
  13. package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
  14. package/dist/web-publish-2d/origin-engine.d.ts +162 -5
  15. package/dist/web-publish-2d/origin-engine.js +1004 -19
  16. package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
  17. package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +52 -3
  18. package/knowledge/looks/catalogue.json +40 -40
  19. package/knowledge/package.json +4 -4
  20. package/knowledge/scaffold/distribution.json +14 -0
  21. package/knowledge/scaffold/origin-engine.json +2 -2
  22. package/knowledge/scaffold/template/README.md +2 -1
  23. package/knowledge/scaffold/template/assets/audio/sting.ogt +10 -0
  24. package/knowledge/scaffold/template/assets/timelines/intro.ogt +101 -0
  25. package/knowledge/scaffold/template/assets/timelines/narration.srt +11 -0
  26. package/knowledge/scaffold/template/host.d.ts +46 -0
  27. package/knowledge/scaffold/template/package.json +1 -1
  28. package/knowledge/scaffold/template/project.ogt +1 -1
  29. package/knowledge/scaffold/template/src/main.ts +1 -1
  30. package/knowledge/scaffold/template/tests/frames.ts +134 -0
  31. package/knowledge/scaffold/template/tests/intro.og.ts +65 -0
  32. package/knowledge/scaffold/template/tests/smoke.og.ts +30 -36
  33. package/knowledge/scaffold/template/tsconfig.json +1 -1
  34. package/knowledge/scripts/mount.ts +2 -1
  35. package/knowledge/scripts/validate.ts +21 -11
  36. package/knowledge/skills/og-build/SKILL.md +25 -6
  37. package/knowledge/skills/og-core/SKILL.md +11 -0
  38. package/knowledge/skills/og-feel/SKILL.md +8 -1
  39. package/knowledge/skills/og-game/SKILL.md +994 -21
  40. package/knowledge/skills/og-i18n/SKILL.md +12 -3
  41. package/knowledge/skills/og-platform-sdk/SKILL.md +4 -1
  42. package/knowledge/skills/og-taste/SKILL.md +82 -73
  43. package/knowledge/skills/og-ui/SKILL.md +82 -54
  44. package/knowledge/wiki/ai.md +20 -20
  45. package/knowledge/wiki/anim.md +384 -41
  46. package/knowledge/wiki/atmosphere.md +36 -13
  47. package/knowledge/wiki/audio.md +18 -18
  48. package/knowledge/wiki/camera.md +19 -13
  49. package/knowledge/wiki/commands.md +19 -13
  50. package/knowledge/wiki/debug.md +414 -0
  51. package/knowledge/wiki/game.md +8 -8
  52. package/knowledge/wiki/i18n.md +7 -7
  53. package/knowledge/wiki/index.md +265 -7
  54. package/knowledge/wiki/input.md +47 -47
  55. package/knowledge/wiki/load.md +236 -68
  56. package/knowledge/wiki/math.md +2614 -7
  57. package/knowledge/wiki/nav.md +34 -34
  58. package/knowledge/wiki/net.md +340 -0
  59. package/knowledge/wiki/path.md +402 -0
  60. package/knowledge/wiki/physics.md +124 -106
  61. package/knowledge/wiki/platform.md +465 -31
  62. package/knowledge/wiki/probe.md +681 -67
  63. package/knowledge/wiki/reflect.md +15 -15
  64. package/knowledge/wiki/render.md +3904 -1897
  65. package/knowledge/wiki/rng.md +14 -14
  66. package/knowledge/wiki/stream.md +15 -15
  67. package/knowledge/wiki/system.md +8 -8
  68. package/knowledge/wiki/systems.md +2 -2
  69. package/knowledge/wiki/terrain.md +19 -19
  70. package/knowledge/wiki/tilemap.md +19 -15
  71. package/knowledge/wiki/time.md +4 -4
  72. package/knowledge/wiki/timeline.md +396 -0
  73. package/knowledge/wiki/transform.md +8 -8
  74. package/knowledge/wiki/tween.md +17 -17
  75. package/knowledge/wiki/ui.md +603 -629
  76. package/knowledge/wiki/video.md +157 -0
  77. package/knowledge/wiki/world.md +67 -37
  78. package/package.json +7 -6
  79. package/schema/api.schema.json +21071 -13964
  80. package/shell/page.ts +26 -2
  81. package/shell/platform.ts +46 -0
  82. package/shell/player.ts +7 -0
  83. package/src/depth.ts +71 -0
  84. package/src/e6.ts +32 -1
  85. package/src/env.d.ts +5 -1
  86. package/src/generated/abi.ts +189 -3
  87. package/src/index.ts +26 -4
  88. package/src/light.ts +18 -0
  89. package/src/math.ts +622 -0
  90. package/src/node/index.ts +17 -0
  91. package/src/node/playtest-run.ts +114 -18
  92. package/src/node/polish.ts +15 -4
  93. package/src/node/render.ts +291 -0
  94. package/src/node/run.ts +91 -6
  95. package/src/p2.ts +19 -1
  96. package/src/playtest.ts +57 -4
  97. package/src/runtime.ts +15 -3
  98. package/src/targets.ts +28 -0
  99. package/src/trace.ts +169 -0
  100. package/src/ui-kit/huds.ts +49 -45
  101. package/src/ui-kit/menus.ts +12 -12
  102. package/src/ui-kit/settings.ts +2 -2
  103. package/src/ui-kit/store.ts +18 -18
  104. package/src/ui-kit/story.ts +6 -4
  105. package/src/ui-kit/util.ts +8 -8
  106. package/src/web/shell.ts +58 -0
  107. package/src/web/worker.ts +103 -2
  108. package/types/bindings.json +8945 -6456
  109. package/types/index.d.ts +15507 -11437
@@ -14,7 +14,7 @@ module math {
14
14
  # declarations follow, each quoted below
15
15
  ```
16
16
 
17
- <sub>`api.ogt` line 35</sub>
17
+ <sub>`api.ogt` line 36</sub>
18
18
 
19
19
  ## Contents
20
20
 
@@ -26,6 +26,2527 @@ module math {
26
26
  | [`Matrix4`](#type-Matrix4) | struct | A 4x4 matrix, as three.js Matrix4: sixteen elements in column-major order. The zero value is the identity. |
27
27
  | [`Color`](#type-Color) | struct | A linear RGB colour, as three.js Color with colour management on. Components are usually between 0 and 1; above 1 is HDR. |
28
28
  | [`Ray`](#type-Ray) | struct | A ray, as three.js Ray. |
29
+ | [`Box3`](#type-Box3) | struct | An axis-aligned box, as three.js Box3. A box whose min exceeds its max on an axis is empty (box3.empty() makes one: min +Infinity, max -Infinity). |
30
+ | [`Sphere`](#type-Sphere) | struct | A sphere, as three.js Sphere. A negative radius is empty. |
31
+ | [`Plane`](#type-Plane) | struct | A plane, as three.js Plane: the points p with dot(normal, p) + constant = 0; normal is unit length, and the positive side is where it points. |
32
+ | [`Frustum`](#type-Frustum) | struct | A view volume, as three.js Frustum: six planes whose normals point inwards (right, left, bottom, top, far, near, three.js's order). frustum.fromCamera and frustum.fromProjectionMatrix make one. |
33
+ | [`Vector3Math`](#type-Vector3Math) | interface | Pure functions over Vector3, as three.js Vector3's methods of the same names: each returns a new value and changes none of its arguments. The value `vec3`: `vec3.add(a, b)`. |
34
+ | [`Vector2Math`](#type-Vector2Math) | interface | Pure functions over Vector2, as three.js Vector2's methods of the same names, each returning a new value. The value `vec2`: `vec2.add(a, b)`. The same bits on every host. |
35
+ | [`QuaternionMath`](#type-QuaternionMath) | interface | Pure functions over Quaternion, as three.js Quaternion's methods, each returning a new value. The value `quat`: `quat.multiply(a, b)`. The same bits on every host (trigonometry from + - * / and sqrt). |
36
+ | [`Matrix4Math`](#type-Matrix4Math) | interface | Pure functions over Matrix4 (column-major elements, as three.js), each returning a new value. The value `mat4`: `mat4.multiply(a, b)`. |
37
+ | [`Box3Math`](#type-Box3Math) | interface | Pure functions over Box3, as three.js Box3's methods, each returning a new value. The value `box3`. |
38
+ | [`SphereMath`](#type-SphereMath) | interface | Pure functions over Sphere, as three.js Sphere's methods, each returning a new value. The value `sphere`. |
39
+ | [`PlaneMath`](#type-PlaneMath) | interface | Pure functions over Plane, as three.js Plane's methods, each returning a new value. The value `plane`. |
40
+ | [`FrustumMath`](#type-FrustumMath) | interface | Pure functions over Frustum, as three.js Frustum's methods. The value `frustum`: `frustum.intersectsBox(frustum.fromCamera(camera, 16 / 9), box)` culls as the renderer would. |
41
+ | [`RayMath`](#type-RayMath) | interface | Pure functions over Ray, as three.js Ray's methods. The value `ray`. Each intersection answers the nearest point at or after the origin, or null. |
42
+ | [`ColorMath`](#type-ColorMath) | interface | Pure functions over Color (linear RGB), as three.js Color's methods with colour management on: hex and HSL are sRGB, converted to and from linear as three.js does. The value `color`: `color.fromHex(0xff8800)`. The same bits on every host (no Math.pow). |
43
+ | [`vec3`](#value-vec3) | value | Vector3's pure functions: `vec3.add(a, b)`, `vec3.normalize(v)`, `vec3.applyQuaternion(v, q)`. |
44
+ | [`vec2`](#value-vec2) | value | Vector2's pure functions: `vec2.add(a, b)`, `vec2.rotateAround(v, c, angle)`. |
45
+ | [`quat`](#value-quat) | value | Quaternion's pure functions: `quat.multiply(a, b)`, `quat.slerp(a, b, t)`, `quat.fromEuler({ x, y, z })`. |
46
+ | [`mat4`](#value-mat4) | value | Matrix4's pure functions: `mat4.multiply(a, b)`, `mat4.invert(m)`, `mat4.transformPoint(m, p)`. |
47
+ | [`box3`](#value-box3) | value | Box3's pure functions: `box3.fromPoints(points)`, `box3.intersectsBox(a, b)`. |
48
+ | [`sphere`](#value-sphere) | value | Sphere's pure functions: `sphere.containsPoint(s, p)`. |
49
+ | [`plane`](#value-plane) | value | Plane's pure functions: `plane.distanceToPoint(pl, p)`. |
50
+ | [`frustum`](#value-frustum) | value | Frustum's pure functions: `frustum.fromCamera(camera, aspect)`, `frustum.intersectsBox(f, box)`. |
51
+ | [`ray`](#value-ray) | value | Ray's pure functions: `ray.intersectBox(r, box)`, `ray.intersectTriangle(r, a, b, c)`. |
52
+ | [`color`](#value-color) | value | Color's pure functions: `color.fromHex(0xff8800)`, `color.toHex(c)`, `color.fromHsl(h, s, l)`. |
53
+
54
+ ## Values
55
+
56
+ Provided by the TypeScript runtime: no binding symbol.
57
+
58
+ <a id="value-vec3"></a>
59
+
60
+ ### `vec3`
61
+
62
+ Vector3's pure functions: `vec3.add(a, b)`, `vec3.normalize(v)`, `vec3.applyQuaternion(v, q)`.
63
+
64
+ ```ts
65
+ const vec3: Vector3Math
66
+ ```
67
+
68
+ ```ogt
69
+ value vec3 Vector3Math "Vector3's pure functions: `vec3.add(a, b)`, `vec3.normalize(v)`, `vec3.applyQuaternion(v, q)`."
70
+ ```
71
+
72
+ <sub>`api.ogt` line 646</sub>
73
+
74
+ <a id="value-vec2"></a>
75
+
76
+ ### `vec2`
77
+
78
+ Vector2's pure functions: `vec2.add(a, b)`, `vec2.rotateAround(v, c, angle)`.
79
+
80
+ ```ts
81
+ const vec2: Vector2Math
82
+ ```
83
+
84
+ ```ogt
85
+ value vec2 Vector2Math "Vector2's pure functions: `vec2.add(a, b)`, `vec2.rotateAround(v, c, angle)`."
86
+ ```
87
+
88
+ <sub>`api.ogt` line 647</sub>
89
+
90
+ <a id="value-quat"></a>
91
+
92
+ ### `quat`
93
+
94
+ Quaternion's pure functions: `quat.multiply(a, b)`, `quat.slerp(a, b, t)`, `quat.fromEuler({ x, y, z })`.
95
+
96
+ ```ts
97
+ const quat: QuaternionMath
98
+ ```
99
+
100
+ ```ogt
101
+ value quat QuaternionMath "Quaternion's pure functions: `quat.multiply(a, b)`, `quat.slerp(a, b, t)`, `quat.fromEuler({ x, y, z })`."
102
+ ```
103
+
104
+ <sub>`api.ogt` line 648</sub>
105
+
106
+ <a id="value-mat4"></a>
107
+
108
+ ### `mat4`
109
+
110
+ Matrix4's pure functions: `mat4.multiply(a, b)`, `mat4.invert(m)`, `mat4.transformPoint(m, p)`.
111
+
112
+ ```ts
113
+ const mat4: Matrix4Math
114
+ ```
115
+
116
+ ```ogt
117
+ value mat4 Matrix4Math "Matrix4's pure functions: `mat4.multiply(a, b)`, `mat4.invert(m)`, `mat4.transformPoint(m, p)`."
118
+ ```
119
+
120
+ <sub>`api.ogt` line 649</sub>
121
+
122
+ <a id="value-box3"></a>
123
+
124
+ ### `box3`
125
+
126
+ Box3's pure functions: `box3.fromPoints(points)`, `box3.intersectsBox(a, b)`.
127
+
128
+ ```ts
129
+ const box3: Box3Math
130
+ ```
131
+
132
+ ```ogt
133
+ value box3 Box3Math "Box3's pure functions: `box3.fromPoints(points)`, `box3.intersectsBox(a, b)`."
134
+ ```
135
+
136
+ <sub>`api.ogt` line 650</sub>
137
+
138
+ <a id="value-sphere"></a>
139
+
140
+ ### `sphere`
141
+
142
+ Sphere's pure functions: `sphere.containsPoint(s, p)`.
143
+
144
+ ```ts
145
+ const sphere: SphereMath
146
+ ```
147
+
148
+ ```ogt
149
+ value sphere SphereMath "Sphere's pure functions: `sphere.containsPoint(s, p)`."
150
+ ```
151
+
152
+ <sub>`api.ogt` line 651</sub>
153
+
154
+ <a id="value-plane"></a>
155
+
156
+ ### `plane`
157
+
158
+ Plane's pure functions: `plane.distanceToPoint(pl, p)`.
159
+
160
+ ```ts
161
+ const plane: PlaneMath
162
+ ```
163
+
164
+ ```ogt
165
+ value plane PlaneMath "Plane's pure functions: `plane.distanceToPoint(pl, p)`."
166
+ ```
167
+
168
+ <sub>`api.ogt` line 652</sub>
169
+
170
+ <a id="value-frustum"></a>
171
+
172
+ ### `frustum`
173
+
174
+ Frustum's pure functions: `frustum.fromCamera(camera, aspect)`, `frustum.intersectsBox(f, box)`.
175
+
176
+ ```ts
177
+ const frustum: FrustumMath
178
+ ```
179
+
180
+ ```ogt
181
+ value frustum FrustumMath "Frustum's pure functions: `frustum.fromCamera(camera, aspect)`, `frustum.intersectsBox(f, box)`."
182
+ ```
183
+
184
+ <sub>`api.ogt` line 653</sub>
185
+
186
+ <a id="value-ray"></a>
187
+
188
+ ### `ray`
189
+
190
+ Ray's pure functions: `ray.intersectBox(r, box)`, `ray.intersectTriangle(r, a, b, c)`.
191
+
192
+ ```ts
193
+ const ray: RayMath
194
+ ```
195
+
196
+ ```ogt
197
+ value ray RayMath "Ray's pure functions: `ray.intersectBox(r, box)`, `ray.intersectTriangle(r, a, b, c)`."
198
+ ```
199
+
200
+ <sub>`api.ogt` line 654</sub>
201
+
202
+ <a id="value-color"></a>
203
+
204
+ ### `color`
205
+
206
+ Color's pure functions: `color.fromHex(0xff8800)`, `color.toHex(c)`, `color.fromHsl(h, s, l)`.
207
+
208
+ ```ts
209
+ const color: ColorMath
210
+ ```
211
+
212
+ ```ogt
213
+ value color ColorMath "Color's pure functions: `color.fromHex(0xff8800)`, `color.toHex(c)`, `color.fromHsl(h, s, l)`."
214
+ ```
215
+
216
+ <sub>`api.ogt` line 655</sub>
217
+
218
+ ## Interfaces
219
+
220
+ <a id="type-Vector3Math"></a>
221
+
222
+ ### `Vector3Math` (interface)
223
+
224
+ Pure functions over Vector3, as three.js Vector3's methods of the same names: each returns a new value and changes none of its arguments. The value `vec3`: `vec3.add(a, b)`.
225
+
226
+ No member reads Math.sin, Math.pow or the clock: results are the same bits on every host, so a system may store them in world state.
227
+
228
+ ```ogt
229
+ interface Vector3Math {
230
+ doc "Pure functions over Vector3, as three.js Vector3's methods of the same names: each returns a new value and changes none of its arguments. The value `vec3`: `vec3.add(a, b)`."
231
+ doc "No member reads Math.sin, Math.pow or the clock: results are the same bits on every host, so a system may store them in world state."
232
+ # members follow, each quoted below
233
+ ```
234
+
235
+ <sub>`api.ogt` line 111</sub>
236
+
237
+ <a id="member-Vector3Math-add"></a>
238
+
239
+ #### `Vector3Math.add`
240
+
241
+ a + b, as three.js Vector3.addVectors.
242
+
243
+ ```ts
244
+ Vector3Math.add(a: Vector3, b: Vector3): Vector3
245
+ ```
246
+
247
+ | Parameter | Type | Optional | Doc |
248
+ |---|---|---|---|
249
+ | `a` | `Vector3` | no | The first vector. |
250
+ | `b` | `Vector3` | no | The second vector. |
251
+
252
+ **Returns** `Vector3`.
253
+
254
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
255
+
256
+ ```ogt
257
+ fn add {
258
+ doc "a + b, as three.js Vector3.addVectors."
259
+ host false
260
+ param a Vector3 "The first vector."
261
+ param b Vector3 "The second vector."
262
+ returns Vector3
263
+ }
264
+ ```
265
+
266
+ <sub>`api.ogt` line 114</sub>
267
+
268
+ <a id="member-Vector3Math-sub"></a>
269
+
270
+ #### `Vector3Math.sub`
271
+
272
+ a - b, as three.js Vector3.subVectors.
273
+
274
+ ```ts
275
+ Vector3Math.sub(a: Vector3, b: Vector3): Vector3
276
+ ```
277
+
278
+ | Parameter | Type | Optional | Doc |
279
+ |---|---|---|---|
280
+ | `a` | `Vector3` | no | The vector subtracted from. |
281
+ | `b` | `Vector3` | no | The vector subtracted. |
282
+
283
+ **Returns** `Vector3`.
284
+
285
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
286
+
287
+ ```ogt
288
+ fn sub {
289
+ doc "a - b, as three.js Vector3.subVectors."
290
+ host false
291
+ param a Vector3 "The vector subtracted from."
292
+ param b Vector3 "The vector subtracted."
293
+ returns Vector3
294
+ }
295
+ ```
296
+
297
+ <sub>`api.ogt` line 121</sub>
298
+
299
+ <a id="member-Vector3Math-scale"></a>
300
+
301
+ #### `Vector3Math.scale`
302
+
303
+ v * s, as three.js Vector3.multiplyScalar.
304
+
305
+ ```ts
306
+ Vector3Math.scale(v: Vector3, s: number): Vector3
307
+ ```
308
+
309
+ | Parameter | Type | Optional | Doc |
310
+ |---|---|---|---|
311
+ | `v` | `Vector3` | no | The vector. |
312
+ | `s` | `number` | no | The factor. |
313
+
314
+ **Returns** `Vector3`.
315
+
316
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
317
+
318
+ ```ogt
319
+ fn scale {
320
+ doc "v * s, as three.js Vector3.multiplyScalar."
321
+ host false
322
+ param v Vector3 "The vector."
323
+ param s f32 "The factor."
324
+ returns Vector3
325
+ }
326
+ ```
327
+
328
+ <sub>`api.ogt` line 128</sub>
329
+
330
+ <a id="member-Vector3Math-dot"></a>
331
+
332
+ #### `Vector3Math.dot`
333
+
334
+ The dot product, as three.js Vector3.dot.
335
+
336
+ ```ts
337
+ Vector3Math.dot(a: Vector3, b: Vector3): number
338
+ ```
339
+
340
+ | Parameter | Type | Optional | Doc |
341
+ |---|---|---|---|
342
+ | `a` | `Vector3` | no | The first vector. |
343
+ | `b` | `Vector3` | no | The second vector. |
344
+
345
+ **Returns** `number`.
346
+
347
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
348
+
349
+ ```ogt
350
+ fn dot {
351
+ doc "The dot product, as three.js Vector3.dot."
352
+ host false
353
+ param a Vector3 "The first vector."
354
+ param b Vector3 "The second vector."
355
+ returns f32
356
+ }
357
+ ```
358
+
359
+ <sub>`api.ogt` line 135</sub>
360
+
361
+ <a id="member-Vector3Math-cross"></a>
362
+
363
+ #### `Vector3Math.cross`
364
+
365
+ The cross product a x b (right-handed), as three.js Vector3.crossVectors.
366
+
367
+ ```ts
368
+ Vector3Math.cross(a: Vector3, b: Vector3): Vector3
369
+ ```
370
+
371
+ | Parameter | Type | Optional | Doc |
372
+ |---|---|---|---|
373
+ | `a` | `Vector3` | no | The first vector. |
374
+ | `b` | `Vector3` | no | The second vector. |
375
+
376
+ **Returns** `Vector3`.
377
+
378
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
379
+
380
+ ```ogt
381
+ fn cross {
382
+ doc "The cross product a x b (right-handed), as three.js Vector3.crossVectors."
383
+ host false
384
+ param a Vector3 "The first vector."
385
+ param b Vector3 "The second vector."
386
+ returns Vector3
387
+ }
388
+ ```
389
+
390
+ <sub>`api.ogt` line 142</sub>
391
+
392
+ <a id="member-Vector3Math-length"></a>
393
+
394
+ #### `Vector3Math.length`
395
+
396
+ The Euclidean length, as three.js Vector3.length.
397
+
398
+ ```ts
399
+ Vector3Math.length(v: Vector3): number
400
+ ```
401
+
402
+ | Parameter | Type | Optional | Doc |
403
+ |---|---|---|---|
404
+ | `v` | `Vector3` | no | The vector. |
405
+
406
+ **Returns** `number`.
407
+
408
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
409
+
410
+ ```ogt
411
+ fn length {
412
+ doc "The Euclidean length, as three.js Vector3.length."
413
+ host false
414
+ param v Vector3 "The vector."
415
+ returns f32
416
+ }
417
+ ```
418
+
419
+ <sub>`api.ogt` line 149</sub>
420
+
421
+ <a id="member-Vector3Math-normalize"></a>
422
+
423
+ #### `Vector3Math.normalize`
424
+
425
+ The unit vector along v, as three.js Vector3.normalize; the zero vector stays zero.
426
+
427
+ ```ts
428
+ Vector3Math.normalize(v: Vector3): Vector3
429
+ ```
430
+
431
+ | Parameter | Type | Optional | Doc |
432
+ |---|---|---|---|
433
+ | `v` | `Vector3` | no | The vector. |
434
+
435
+ **Returns** `Vector3`.
436
+
437
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
438
+
439
+ ```ogt
440
+ fn normalize {
441
+ doc "The unit vector along v, as three.js Vector3.normalize; the zero vector stays zero."
442
+ host false
443
+ param v Vector3 "The vector."
444
+ returns Vector3
445
+ }
446
+ ```
447
+
448
+ <sub>`api.ogt` line 155</sub>
449
+
450
+ <a id="member-Vector3Math-lerp"></a>
451
+
452
+ #### `Vector3Math.lerp`
453
+
454
+ a + (b - a) * t, as three.js Vector3.lerpVectors.
455
+
456
+ ```ts
457
+ Vector3Math.lerp(a: Vector3, b: Vector3, t: number): Vector3
458
+ ```
459
+
460
+ | Parameter | Type | Optional | Doc |
461
+ |---|---|---|---|
462
+ | `a` | `Vector3` | no | The value at t = 0. |
463
+ | `b` | `Vector3` | no | The value at t = 1. |
464
+ | `t` | `number` | no | The fraction (not clamped). |
465
+
466
+ **Returns** `Vector3`.
467
+
468
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
469
+
470
+ ```ogt
471
+ fn lerp {
472
+ doc "a + (b - a) * t, as three.js Vector3.lerpVectors."
473
+ host false
474
+ param a Vector3 "The value at t = 0."
475
+ param b Vector3 "The value at t = 1."
476
+ param t f32 "The fraction (not clamped)."
477
+ returns Vector3
478
+ }
479
+ ```
480
+
481
+ <sub>`api.ogt` line 161</sub>
482
+
483
+ <a id="member-Vector3Math-distance"></a>
484
+
485
+ #### `Vector3Math.distance`
486
+
487
+ The distance between two points, as three.js Vector3.distanceTo.
488
+
489
+ ```ts
490
+ Vector3Math.distance(a: Vector3, b: Vector3): number
491
+ ```
492
+
493
+ | Parameter | Type | Optional | Doc |
494
+ |---|---|---|---|
495
+ | `a` | `Vector3` | no | The first point. |
496
+ | `b` | `Vector3` | no | The second point. |
497
+
498
+ **Returns** `number`.
499
+
500
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
501
+
502
+ ```ogt
503
+ fn distance {
504
+ doc "The distance between two points, as three.js Vector3.distanceTo."
505
+ host false
506
+ param a Vector3 "The first point."
507
+ param b Vector3 "The second point."
508
+ returns f32
509
+ }
510
+ ```
511
+
512
+ <sub>`api.ogt` line 169</sub>
513
+
514
+ <a id="member-Vector3Math-applyQuaternion"></a>
515
+
516
+ #### `Vector3Math.applyQuaternion`
517
+
518
+ v rotated by q, as three.js Vector3.applyQuaternion.
519
+
520
+ ```ts
521
+ Vector3Math.applyQuaternion(v: Vector3, q: Quaternion): Vector3
522
+ ```
523
+
524
+ | Parameter | Type | Optional | Doc |
525
+ |---|---|---|---|
526
+ | `v` | `Vector3` | no | The vector. |
527
+ | `q` | `Quaternion` | no | The unit quaternion. |
528
+
529
+ **Returns** `Vector3`.
530
+
531
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
532
+
533
+ ```ogt
534
+ fn applyQuaternion {
535
+ doc "v rotated by q, as three.js Vector3.applyQuaternion."
536
+ host false
537
+ param v Vector3 "The vector."
538
+ param q Quaternion "The unit quaternion."
539
+ returns Vector3
540
+ }
541
+ ```
542
+
543
+ <sub>`api.ogt` line 176</sub>
544
+
545
+ <a id="type-Vector2Math"></a>
546
+
547
+ ### `Vector2Math` (interface)
548
+
549
+ Pure functions over Vector2, as three.js Vector2's methods of the same names, each returning a new value. The value `vec2`: `vec2.add(a, b)`. The same bits on every host.
550
+
551
+ ```ogt
552
+ interface Vector2Math {
553
+ doc "Pure functions over Vector2, as three.js Vector2's methods of the same names, each returning a new value. The value `vec2`: `vec2.add(a, b)`. The same bits on every host."
554
+ # members follow, each quoted below
555
+ ```
556
+
557
+ <sub>`api.ogt` line 185</sub>
558
+
559
+ <a id="member-Vector2Math-add"></a>
560
+
561
+ #### `Vector2Math.add`
562
+
563
+ a + b, as three.js Vector2.addVectors.
564
+
565
+ ```ts
566
+ Vector2Math.add(a: Vector2, b: Vector2): Vector2
567
+ ```
568
+
569
+ | Parameter | Type | Optional | Doc |
570
+ |---|---|---|---|
571
+ | `a` | `Vector2` | no | The first vector. |
572
+ | `b` | `Vector2` | no | The second vector. |
573
+
574
+ **Returns** `Vector2`.
575
+
576
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
577
+
578
+ ```ogt
579
+ fn add {
580
+ doc "a + b, as three.js Vector2.addVectors."
581
+ host false
582
+ param a Vector2 "The first vector."
583
+ param b Vector2 "The second vector."
584
+ returns Vector2
585
+ }
586
+ ```
587
+
588
+ <sub>`api.ogt` line 187</sub>
589
+
590
+ <a id="member-Vector2Math-sub"></a>
591
+
592
+ #### `Vector2Math.sub`
593
+
594
+ a - b, as three.js Vector2.subVectors.
595
+
596
+ ```ts
597
+ Vector2Math.sub(a: Vector2, b: Vector2): Vector2
598
+ ```
599
+
600
+ | Parameter | Type | Optional | Doc |
601
+ |---|---|---|---|
602
+ | `a` | `Vector2` | no | The vector subtracted from. |
603
+ | `b` | `Vector2` | no | The vector subtracted. |
604
+
605
+ **Returns** `Vector2`.
606
+
607
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
608
+
609
+ ```ogt
610
+ fn sub {
611
+ doc "a - b, as three.js Vector2.subVectors."
612
+ host false
613
+ param a Vector2 "The vector subtracted from."
614
+ param b Vector2 "The vector subtracted."
615
+ returns Vector2
616
+ }
617
+ ```
618
+
619
+ <sub>`api.ogt` line 194</sub>
620
+
621
+ <a id="member-Vector2Math-scale"></a>
622
+
623
+ #### `Vector2Math.scale`
624
+
625
+ v * s, as three.js Vector2.multiplyScalar.
626
+
627
+ ```ts
628
+ Vector2Math.scale(v: Vector2, s: number): Vector2
629
+ ```
630
+
631
+ | Parameter | Type | Optional | Doc |
632
+ |---|---|---|---|
633
+ | `v` | `Vector2` | no | The vector. |
634
+ | `s` | `number` | no | The factor. |
635
+
636
+ **Returns** `Vector2`.
637
+
638
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
639
+
640
+ ```ogt
641
+ fn scale {
642
+ doc "v * s, as three.js Vector2.multiplyScalar."
643
+ host false
644
+ param v Vector2 "The vector."
645
+ param s f32 "The factor."
646
+ returns Vector2
647
+ }
648
+ ```
649
+
650
+ <sub>`api.ogt` line 201</sub>
651
+
652
+ <a id="member-Vector2Math-dot"></a>
653
+
654
+ #### `Vector2Math.dot`
655
+
656
+ The dot product, as three.js Vector2.dot.
657
+
658
+ ```ts
659
+ Vector2Math.dot(a: Vector2, b: Vector2): number
660
+ ```
661
+
662
+ | Parameter | Type | Optional | Doc |
663
+ |---|---|---|---|
664
+ | `a` | `Vector2` | no | The first vector. |
665
+ | `b` | `Vector2` | no | The second vector. |
666
+
667
+ **Returns** `number`.
668
+
669
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
670
+
671
+ ```ogt
672
+ fn dot {
673
+ doc "The dot product, as three.js Vector2.dot."
674
+ host false
675
+ param a Vector2 "The first vector."
676
+ param b Vector2 "The second vector."
677
+ returns f32
678
+ }
679
+ ```
680
+
681
+ <sub>`api.ogt` line 208</sub>
682
+
683
+ <a id="member-Vector2Math-cross"></a>
684
+
685
+ #### `Vector2Math.cross`
686
+
687
+ The 2D cross product a.x * b.y - a.y * b.x (the z of the 3D cross product), as three.js Vector2.cross: positive when b is counter-clockwise of a.
688
+
689
+ ```ts
690
+ Vector2Math.cross(a: Vector2, b: Vector2): number
691
+ ```
692
+
693
+ | Parameter | Type | Optional | Doc |
694
+ |---|---|---|---|
695
+ | `a` | `Vector2` | no | The first vector. |
696
+ | `b` | `Vector2` | no | The second vector. |
697
+
698
+ **Returns** `number`.
699
+
700
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
701
+
702
+ ```ogt
703
+ fn cross {
704
+ doc "The 2D cross product a.x * b.y - a.y * b.x (the z of the 3D cross product), as three.js Vector2.cross: positive when b is counter-clockwise of a."
705
+ host false
706
+ param a Vector2 "The first vector."
707
+ param b Vector2 "The second vector."
708
+ returns f32
709
+ }
710
+ ```
711
+
712
+ <sub>`api.ogt` line 215</sub>
713
+
714
+ <a id="member-Vector2Math-length"></a>
715
+
716
+ #### `Vector2Math.length`
717
+
718
+ The Euclidean length, as three.js Vector2.length.
719
+
720
+ ```ts
721
+ Vector2Math.length(v: Vector2): number
722
+ ```
723
+
724
+ | Parameter | Type | Optional | Doc |
725
+ |---|---|---|---|
726
+ | `v` | `Vector2` | no | The vector. |
727
+
728
+ **Returns** `number`.
729
+
730
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
731
+
732
+ ```ogt
733
+ fn length {
734
+ doc "The Euclidean length, as three.js Vector2.length."
735
+ host false
736
+ param v Vector2 "The vector."
737
+ returns f32
738
+ }
739
+ ```
740
+
741
+ <sub>`api.ogt` line 222</sub>
742
+
743
+ <a id="member-Vector2Math-normalize"></a>
744
+
745
+ #### `Vector2Math.normalize`
746
+
747
+ The unit vector along v, as three.js Vector2.normalize; the zero vector stays zero.
748
+
749
+ ```ts
750
+ Vector2Math.normalize(v: Vector2): Vector2
751
+ ```
752
+
753
+ | Parameter | Type | Optional | Doc |
754
+ |---|---|---|---|
755
+ | `v` | `Vector2` | no | The vector. |
756
+
757
+ **Returns** `Vector2`.
758
+
759
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
760
+
761
+ ```ogt
762
+ fn normalize {
763
+ doc "The unit vector along v, as three.js Vector2.normalize; the zero vector stays zero."
764
+ host false
765
+ param v Vector2 "The vector."
766
+ returns Vector2
767
+ }
768
+ ```
769
+
770
+ <sub>`api.ogt` line 228</sub>
771
+
772
+ <a id="member-Vector2Math-lerp"></a>
773
+
774
+ #### `Vector2Math.lerp`
775
+
776
+ a + (b - a) * t, as three.js Vector2.lerpVectors.
777
+
778
+ ```ts
779
+ Vector2Math.lerp(a: Vector2, b: Vector2, t: number): Vector2
780
+ ```
781
+
782
+ | Parameter | Type | Optional | Doc |
783
+ |---|---|---|---|
784
+ | `a` | `Vector2` | no | The value at t = 0. |
785
+ | `b` | `Vector2` | no | The value at t = 1. |
786
+ | `t` | `number` | no | The fraction (not clamped). |
787
+
788
+ **Returns** `Vector2`.
789
+
790
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
791
+
792
+ ```ogt
793
+ fn lerp {
794
+ doc "a + (b - a) * t, as three.js Vector2.lerpVectors."
795
+ host false
796
+ param a Vector2 "The value at t = 0."
797
+ param b Vector2 "The value at t = 1."
798
+ param t f32 "The fraction (not clamped)."
799
+ returns Vector2
800
+ }
801
+ ```
802
+
803
+ <sub>`api.ogt` line 234</sub>
804
+
805
+ <a id="member-Vector2Math-distance"></a>
806
+
807
+ #### `Vector2Math.distance`
808
+
809
+ The distance between two points, as three.js Vector2.distanceTo.
810
+
811
+ ```ts
812
+ Vector2Math.distance(a: Vector2, b: Vector2): number
813
+ ```
814
+
815
+ | Parameter | Type | Optional | Doc |
816
+ |---|---|---|---|
817
+ | `a` | `Vector2` | no | The first point. |
818
+ | `b` | `Vector2` | no | The second point. |
819
+
820
+ **Returns** `number`.
821
+
822
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
823
+
824
+ ```ogt
825
+ fn distance {
826
+ doc "The distance between two points, as three.js Vector2.distanceTo."
827
+ host false
828
+ param a Vector2 "The first point."
829
+ param b Vector2 "The second point."
830
+ returns f32
831
+ }
832
+ ```
833
+
834
+ <sub>`api.ogt` line 242</sub>
835
+
836
+ <a id="member-Vector2Math-rotateAround"></a>
837
+
838
+ #### `Vector2Math.rotateAround`
839
+
840
+ v rotated counter-clockwise by angle about center, as three.js Vector2.rotateAround (the 2D form of applyQuaternion).
841
+
842
+ ```ts
843
+ Vector2Math.rotateAround(v: Vector2, center: Vector2, angle: number): Vector2
844
+ ```
845
+
846
+ | Parameter | Type | Optional | Doc |
847
+ |---|---|---|---|
848
+ | `v` | `Vector2` | no | The point. |
849
+ | `center` | `Vector2` | no | The pivot. |
850
+ | `angle` | `number` | no | The angle in radians, counter-clockwise. |
851
+
852
+ **Returns** `Vector2`.
853
+
854
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
855
+
856
+ ```ogt
857
+ fn rotateAround {
858
+ doc "v rotated counter-clockwise by angle about center, as three.js Vector2.rotateAround (the 2D form of applyQuaternion)."
859
+ host false
860
+ param v Vector2 "The point."
861
+ param center Vector2 "The pivot."
862
+ param angle f32 "The angle in radians, counter-clockwise."
863
+ returns Vector2
864
+ }
865
+ ```
866
+
867
+ <sub>`api.ogt` line 249</sub>
868
+
869
+ <a id="type-QuaternionMath"></a>
870
+
871
+ ### `QuaternionMath` (interface)
872
+
873
+ Pure functions over Quaternion, as three.js Quaternion's methods, each returning a new value. The value `quat`: `quat.multiply(a, b)`. The same bits on every host (trigonometry from + - * / and sqrt).
874
+
875
+ ```ogt
876
+ interface QuaternionMath {
877
+ doc "Pure functions over Quaternion, as three.js Quaternion's methods, each returning a new value. The value `quat`: `quat.multiply(a, b)`. The same bits on every host (trigonometry from + - * / and sqrt)."
878
+ # members follow, each quoted below
879
+ ```
880
+
881
+ <sub>`api.ogt` line 259</sub>
882
+
883
+ <a id="member-QuaternionMath-multiply"></a>
884
+
885
+ #### `QuaternionMath.multiply`
886
+
887
+ a * b: b's rotation, then a's, as three.js Quaternion.multiplyQuaternions.
888
+
889
+ ```ts
890
+ QuaternionMath.multiply(a: Quaternion, b: Quaternion): Quaternion
891
+ ```
892
+
893
+ | Parameter | Type | Optional | Doc |
894
+ |---|---|---|---|
895
+ | `a` | `Quaternion` | no | The rotation applied second. |
896
+ | `b` | `Quaternion` | no | The rotation applied first. |
897
+
898
+ **Returns** `Quaternion`.
899
+
900
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
901
+
902
+ ```ogt
903
+ fn multiply {
904
+ doc "a * b: b's rotation, then a's, as three.js Quaternion.multiplyQuaternions."
905
+ host false
906
+ param a Quaternion "The rotation applied second."
907
+ param b Quaternion "The rotation applied first."
908
+ returns Quaternion
909
+ }
910
+ ```
911
+
912
+ <sub>`api.ogt` line 261</sub>
913
+
914
+ <a id="member-QuaternionMath-slerp"></a>
915
+
916
+ #### `QuaternionMath.slerp`
917
+
918
+ The spherical interpolation from a to b by t along the shorter arc, as three.js Quaternion.slerpQuaternions.
919
+
920
+ ```ts
921
+ QuaternionMath.slerp(a: Quaternion, b: Quaternion, t: number): Quaternion
922
+ ```
923
+
924
+ | Parameter | Type | Optional | Doc |
925
+ |---|---|---|---|
926
+ | `a` | `Quaternion` | no | The value at t = 0. |
927
+ | `b` | `Quaternion` | no | The value at t = 1. |
928
+ | `t` | `number` | no | The fraction, 0 to 1. |
929
+
930
+ **Returns** `Quaternion`.
931
+
932
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
933
+
934
+ ```ogt
935
+ fn slerp {
936
+ doc "The spherical interpolation from a to b by t along the shorter arc, as three.js Quaternion.slerpQuaternions."
937
+ host false
938
+ param a Quaternion "The value at t = 0."
939
+ param b Quaternion "The value at t = 1."
940
+ param t f32 "The fraction, 0 to 1."
941
+ returns Quaternion
942
+ }
943
+ ```
944
+
945
+ <sub>`api.ogt` line 268</sub>
946
+
947
+ <a id="member-QuaternionMath-fromEuler"></a>
948
+
949
+ #### `QuaternionMath.fromEuler`
950
+
951
+ The rotation of Euler angles, as three.js Quaternion.setFromEuler: the x, y and z of `angles` in radians, applied in `order` (three.js Euler.order, intrinsic: "XYZ" turns about x, then the turned y, then the turned z).
952
+
953
+ ```ts
954
+ QuaternionMath.fromEuler(angles: Vector3, order?: string): Quaternion
955
+ ```
956
+
957
+ | Parameter | Type | Optional | Doc |
958
+ |---|---|---|---|
959
+ | `angles` | `Vector3` | no | The angles about x, y and z, in radians. |
960
+ | `order` | `string` | yes | "XYZ", "YXZ", "ZXY", "ZYX", "YZX" or "XZY". Default `"XYZ"`. |
961
+
962
+ **Returns** `Quaternion`.
963
+
964
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
965
+
966
+ ```ogt
967
+ fn fromEuler {
968
+ doc "The rotation of Euler angles, as three.js Quaternion.setFromEuler: the x, y and z of `angles` in radians, applied in `order` (three.js Euler.order, intrinsic: \"XYZ\" turns about x, then the turned y, then the turned z)."
969
+ host false
970
+ param angles Vector3 "The angles about x, y and z, in radians."
971
+ param order String "\"XYZ\", \"YXZ\", \"ZXY\", \"ZYX\", \"YZX\" or \"XZY\"." {
972
+ default "XYZ"
973
+ }
974
+ returns Quaternion
975
+ }
976
+ ```
977
+
978
+ <sub>`api.ogt` line 276</sub>
979
+
980
+ <a id="member-QuaternionMath-invert"></a>
981
+
982
+ #### `QuaternionMath.invert`
983
+
984
+ The inverse rotation (the conjugate of a unit quaternion), as three.js Quaternion.invert.
985
+
986
+ ```ts
987
+ QuaternionMath.invert(q: Quaternion): Quaternion
988
+ ```
989
+
990
+ | Parameter | Type | Optional | Doc |
991
+ |---|---|---|---|
992
+ | `q` | `Quaternion` | no | The rotation. |
993
+
994
+ **Returns** `Quaternion`.
995
+
996
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
997
+
998
+ ```ogt
999
+ fn invert {
1000
+ doc "The inverse rotation (the conjugate of a unit quaternion), as three.js Quaternion.invert."
1001
+ host false
1002
+ param q Quaternion "The rotation."
1003
+ returns Quaternion
1004
+ }
1005
+ ```
1006
+
1007
+ <sub>`api.ogt` line 285</sub>
1008
+
1009
+ <a id="member-QuaternionMath-rotate"></a>
1010
+
1011
+ #### `QuaternionMath.rotate`
1012
+
1013
+ The vector v turned by q: vec3.applyQuaternion(v, q), from the rotation's side.
1014
+
1015
+ ```ts
1016
+ QuaternionMath.rotate(q: Quaternion, v: Vector3): Vector3
1017
+ ```
1018
+
1019
+ | Parameter | Type | Optional | Doc |
1020
+ |---|---|---|---|
1021
+ | `q` | `Quaternion` | no | The rotation. |
1022
+ | `v` | `Vector3` | no | The vector. |
1023
+
1024
+ **Returns** `Vector3`.
1025
+
1026
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1027
+
1028
+ ```ogt
1029
+ fn rotate {
1030
+ doc "The vector v turned by q: vec3.applyQuaternion(v, q), from the rotation's side."
1031
+ host false
1032
+ param q Quaternion "The rotation."
1033
+ param v Vector3 "The vector."
1034
+ returns Vector3
1035
+ }
1036
+ ```
1037
+
1038
+ <sub>`api.ogt` line 291</sub>
1039
+
1040
+ <a id="type-Matrix4Math"></a>
1041
+
1042
+ ### `Matrix4Math` (interface)
1043
+
1044
+ Pure functions over Matrix4 (column-major elements, as three.js), each returning a new value. The value `mat4`: `mat4.multiply(a, b)`.
1045
+
1046
+ ```ogt
1047
+ interface Matrix4Math {
1048
+ doc "Pure functions over Matrix4 (column-major elements, as three.js), each returning a new value. The value `mat4`: `mat4.multiply(a, b)`."
1049
+ # members follow, each quoted below
1050
+ ```
1051
+
1052
+ <sub>`api.ogt` line 300</sub>
1053
+
1054
+ <a id="member-Matrix4Math-multiply"></a>
1055
+
1056
+ #### `Matrix4Math.multiply`
1057
+
1058
+ a * b: b's transform, then a's, as three.js Matrix4.multiplyMatrices.
1059
+
1060
+ ```ts
1061
+ Matrix4Math.multiply(a: Matrix4, b: Matrix4): Matrix4
1062
+ ```
1063
+
1064
+ | Parameter | Type | Optional | Doc |
1065
+ |---|---|---|---|
1066
+ | `a` | `Matrix4` | no | The transform applied second. |
1067
+ | `b` | `Matrix4` | no | The transform applied first. |
1068
+
1069
+ **Returns** `Matrix4`.
1070
+
1071
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1072
+
1073
+ ```ogt
1074
+ fn multiply {
1075
+ doc "a * b: b's transform, then a's, as three.js Matrix4.multiplyMatrices."
1076
+ host false
1077
+ param a Matrix4 "The transform applied second."
1078
+ param b Matrix4 "The transform applied first."
1079
+ returns Matrix4
1080
+ }
1081
+ ```
1082
+
1083
+ <sub>`api.ogt` line 302</sub>
1084
+
1085
+ <a id="member-Matrix4Math-invert"></a>
1086
+
1087
+ #### `Matrix4Math.invert`
1088
+
1089
+ The inverse, as three.js Matrix4.invert; a singular matrix inverts to all zeros, as three.js.
1090
+
1091
+ ```ts
1092
+ Matrix4Math.invert(m: Matrix4): Matrix4
1093
+ ```
1094
+
1095
+ | Parameter | Type | Optional | Doc |
1096
+ |---|---|---|---|
1097
+ | `m` | `Matrix4` | no | The matrix. |
1098
+
1099
+ **Returns** `Matrix4`.
1100
+
1101
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1102
+
1103
+ ```ogt
1104
+ fn invert {
1105
+ doc "The inverse, as three.js Matrix4.invert; a singular matrix inverts to all zeros, as three.js."
1106
+ host false
1107
+ param m Matrix4 "The matrix."
1108
+ returns Matrix4
1109
+ }
1110
+ ```
1111
+
1112
+ <sub>`api.ogt` line 309</sub>
1113
+
1114
+ <a id="member-Matrix4Math-transformPoint"></a>
1115
+
1116
+ #### `Matrix4Math.transformPoint`
1117
+
1118
+ The point p transformed by m with the perspective divide, as three.js Vector3.applyMatrix4.
1119
+
1120
+ ```ts
1121
+ Matrix4Math.transformPoint(m: Matrix4, p: Vector3): Vector3
1122
+ ```
1123
+
1124
+ | Parameter | Type | Optional | Doc |
1125
+ |---|---|---|---|
1126
+ | `m` | `Matrix4` | no | The transform. |
1127
+ | `p` | `Vector3` | no | The point. |
1128
+
1129
+ **Returns** `Vector3`.
1130
+
1131
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1132
+
1133
+ ```ogt
1134
+ fn transformPoint {
1135
+ doc "The point p transformed by m with the perspective divide, as three.js Vector3.applyMatrix4."
1136
+ host false
1137
+ param m Matrix4 "The transform."
1138
+ param p Vector3 "The point."
1139
+ returns Vector3
1140
+ }
1141
+ ```
1142
+
1143
+ <sub>`api.ogt` line 315</sub>
1144
+
1145
+ <a id="member-Matrix4Math-transformDirection"></a>
1146
+
1147
+ #### `Matrix4Math.transformDirection`
1148
+
1149
+ The direction d turned by m's upper 3x3 and normalised, as three.js Vector3.transformDirection (translation ignored).
1150
+
1151
+ ```ts
1152
+ Matrix4Math.transformDirection(m: Matrix4, d: Vector3): Vector3
1153
+ ```
1154
+
1155
+ | Parameter | Type | Optional | Doc |
1156
+ |---|---|---|---|
1157
+ | `m` | `Matrix4` | no | The transform. |
1158
+ | `d` | `Vector3` | no | The direction. |
1159
+
1160
+ **Returns** `Vector3`.
1161
+
1162
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1163
+
1164
+ ```ogt
1165
+ fn transformDirection {
1166
+ doc "The direction d turned by m's upper 3x3 and normalised, as three.js Vector3.transformDirection (translation ignored)."
1167
+ host false
1168
+ param m Matrix4 "The transform."
1169
+ param d Vector3 "The direction."
1170
+ returns Vector3
1171
+ }
1172
+ ```
1173
+
1174
+ <sub>`api.ogt` line 322</sub>
1175
+
1176
+ <a id="member-Matrix4Math-compose"></a>
1177
+
1178
+ #### `Matrix4Math.compose`
1179
+
1180
+ The transform of a position, a rotation and a scale, as three.js Matrix4.compose: what og.Transform's fields make.
1181
+
1182
+ ```ts
1183
+ Matrix4Math.compose(position: Vector3, quaternion: Quaternion, scale: Vector3): Matrix4
1184
+ ```
1185
+
1186
+ | Parameter | Type | Optional | Doc |
1187
+ |---|---|---|---|
1188
+ | `position` | `Vector3` | no | The translation. |
1189
+ | `quaternion` | `Quaternion` | no | The rotation. |
1190
+ | `scale` | `Vector3` | no | The scale. |
1191
+
1192
+ **Returns** `Matrix4`.
1193
+
1194
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1195
+
1196
+ ```ogt
1197
+ fn compose {
1198
+ doc "The transform of a position, a rotation and a scale, as three.js Matrix4.compose: what og.Transform's fields make."
1199
+ host false
1200
+ param position Vector3 "The translation."
1201
+ param quaternion Quaternion "The rotation."
1202
+ param scale Vector3 "The scale."
1203
+ returns Matrix4
1204
+ }
1205
+ ```
1206
+
1207
+ <sub>`api.ogt` line 329</sub>
1208
+
1209
+ <a id="type-Box3Math"></a>
1210
+
1211
+ ### `Box3Math` (interface)
1212
+
1213
+ Pure functions over Box3, as three.js Box3's methods, each returning a new value. The value `box3`.
1214
+
1215
+ ```ogt
1216
+ interface Box3Math {
1217
+ doc "Pure functions over Box3, as three.js Box3's methods, each returning a new value. The value `box3`."
1218
+ # members follow, each quoted below
1219
+ ```
1220
+
1221
+ <sub>`api.ogt` line 339</sub>
1222
+
1223
+ <a id="member-Box3Math-empty"></a>
1224
+
1225
+ #### `Box3Math.empty`
1226
+
1227
+ The empty box (min +Infinity, max -Infinity), as new three.js Box3(): expandByPoint and union grow it.
1228
+
1229
+ ```ts
1230
+ Box3Math.empty(): Box3
1231
+ ```
1232
+
1233
+ **Returns** `Box3`.
1234
+
1235
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1236
+
1237
+ ```ogt
1238
+ fn empty {
1239
+ doc "The empty box (min +Infinity, max -Infinity), as new three.js Box3(): expandByPoint and union grow it."
1240
+ host false
1241
+ returns Box3
1242
+ }
1243
+ ```
1244
+
1245
+ <sub>`api.ogt` line 341</sub>
1246
+
1247
+ <a id="member-Box3Math-fromPoints"></a>
1248
+
1249
+ #### `Box3Math.fromPoints`
1250
+
1251
+ The smallest box holding every point, as three.js Box3.setFromPoints; no points is the empty box.
1252
+
1253
+ ```ts
1254
+ Box3Math.fromPoints(points: readonly Vector3[]): Box3
1255
+ ```
1256
+
1257
+ | Parameter | Type | Optional | Doc |
1258
+ |---|---|---|---|
1259
+ | `points` | `readonly Vector3[]` | no | The points. |
1260
+
1261
+ **Returns** `Box3`.
1262
+
1263
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1264
+
1265
+ ```ogt
1266
+ fn fromPoints {
1267
+ doc "The smallest box holding every point, as three.js Box3.setFromPoints; no points is the empty box."
1268
+ host false
1269
+ param points List.Vector3 "The points."
1270
+ returns Box3
1271
+ }
1272
+ ```
1273
+
1274
+ <sub>`api.ogt` line 346</sub>
1275
+
1276
+ <a id="member-Box3Math-isEmpty"></a>
1277
+
1278
+ #### `Box3Math.isEmpty`
1279
+
1280
+ Whether the box holds no point (min above max on some axis), as three.js Box3.isEmpty.
1281
+
1282
+ ```ts
1283
+ Box3Math.isEmpty(box: Box3): boolean
1284
+ ```
1285
+
1286
+ | Parameter | Type | Optional | Doc |
1287
+ |---|---|---|---|
1288
+ | `box` | `Box3` | no | The box. |
1289
+
1290
+ **Returns** `boolean`.
1291
+
1292
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1293
+
1294
+ ```ogt
1295
+ fn isEmpty {
1296
+ doc "Whether the box holds no point (min above max on some axis), as three.js Box3.isEmpty."
1297
+ host false
1298
+ param box Box3 "The box."
1299
+ returns bool
1300
+ }
1301
+ ```
1302
+
1303
+ <sub>`api.ogt` line 352</sub>
1304
+
1305
+ <a id="member-Box3Math-containsPoint"></a>
1306
+
1307
+ #### `Box3Math.containsPoint`
1308
+
1309
+ Whether p is inside or on the box, as three.js Box3.containsPoint.
1310
+
1311
+ ```ts
1312
+ Box3Math.containsPoint(box: Box3, p: Vector3): boolean
1313
+ ```
1314
+
1315
+ | Parameter | Type | Optional | Doc |
1316
+ |---|---|---|---|
1317
+ | `box` | `Box3` | no | The box. |
1318
+ | `p` | `Vector3` | no | The point. |
1319
+
1320
+ **Returns** `boolean`.
1321
+
1322
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1323
+
1324
+ ```ogt
1325
+ fn containsPoint {
1326
+ doc "Whether p is inside or on the box, as three.js Box3.containsPoint."
1327
+ host false
1328
+ param box Box3 "The box."
1329
+ param p Vector3 "The point."
1330
+ returns bool
1331
+ }
1332
+ ```
1333
+
1334
+ <sub>`api.ogt` line 358</sub>
1335
+
1336
+ <a id="member-Box3Math-containsBox"></a>
1337
+
1338
+ #### `Box3Math.containsBox`
1339
+
1340
+ Whether other lies wholly inside box, as three.js Box3.containsBox.
1341
+
1342
+ ```ts
1343
+ Box3Math.containsBox(box: Box3, other: Box3): boolean
1344
+ ```
1345
+
1346
+ | Parameter | Type | Optional | Doc |
1347
+ |---|---|---|---|
1348
+ | `box` | `Box3` | no | The outer box. |
1349
+ | `other` | `Box3` | no | The inner box. |
1350
+
1351
+ **Returns** `boolean`.
1352
+
1353
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1354
+
1355
+ ```ogt
1356
+ fn containsBox {
1357
+ doc "Whether other lies wholly inside box, as three.js Box3.containsBox."
1358
+ host false
1359
+ param box Box3 "The outer box."
1360
+ param other Box3 "The inner box."
1361
+ returns bool
1362
+ }
1363
+ ```
1364
+
1365
+ <sub>`api.ogt` line 365</sub>
1366
+
1367
+ <a id="member-Box3Math-intersectsBox"></a>
1368
+
1369
+ #### `Box3Math.intersectsBox`
1370
+
1371
+ Whether two boxes overlap or touch, as three.js Box3.intersectsBox.
1372
+
1373
+ ```ts
1374
+ Box3Math.intersectsBox(a: Box3, b: Box3): boolean
1375
+ ```
1376
+
1377
+ | Parameter | Type | Optional | Doc |
1378
+ |---|---|---|---|
1379
+ | `a` | `Box3` | no | The first box. |
1380
+ | `b` | `Box3` | no | The second box. |
1381
+
1382
+ **Returns** `boolean`.
1383
+
1384
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1385
+
1386
+ ```ogt
1387
+ fn intersectsBox {
1388
+ doc "Whether two boxes overlap or touch, as three.js Box3.intersectsBox."
1389
+ host false
1390
+ param a Box3 "The first box."
1391
+ param b Box3 "The second box."
1392
+ returns bool
1393
+ }
1394
+ ```
1395
+
1396
+ <sub>`api.ogt` line 372</sub>
1397
+
1398
+ <a id="member-Box3Math-intersectsSphere"></a>
1399
+
1400
+ #### `Box3Math.intersectsSphere`
1401
+
1402
+ Whether the box and the sphere overlap, as three.js Box3.intersectsSphere.
1403
+
1404
+ ```ts
1405
+ Box3Math.intersectsSphere(box: Box3, sphere: Sphere): boolean
1406
+ ```
1407
+
1408
+ | Parameter | Type | Optional | Doc |
1409
+ |---|---|---|---|
1410
+ | `box` | `Box3` | no | The box. |
1411
+ | `sphere` | `Sphere` | no | The sphere. |
1412
+
1413
+ **Returns** `boolean`.
1414
+
1415
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1416
+
1417
+ ```ogt
1418
+ fn intersectsSphere {
1419
+ doc "Whether the box and the sphere overlap, as three.js Box3.intersectsSphere."
1420
+ host false
1421
+ param box Box3 "The box."
1422
+ param sphere Sphere "The sphere."
1423
+ returns bool
1424
+ }
1425
+ ```
1426
+
1427
+ <sub>`api.ogt` line 379</sub>
1428
+
1429
+ <a id="member-Box3Math-expandByPoint"></a>
1430
+
1431
+ #### `Box3Math.expandByPoint`
1432
+
1433
+ The box grown to hold p, as three.js Box3.expandByPoint.
1434
+
1435
+ ```ts
1436
+ Box3Math.expandByPoint(box: Box3, p: Vector3): Box3
1437
+ ```
1438
+
1439
+ | Parameter | Type | Optional | Doc |
1440
+ |---|---|---|---|
1441
+ | `box` | `Box3` | no | The box. |
1442
+ | `p` | `Vector3` | no | The point. |
1443
+
1444
+ **Returns** `Box3`.
1445
+
1446
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1447
+
1448
+ ```ogt
1449
+ fn expandByPoint {
1450
+ doc "The box grown to hold p, as three.js Box3.expandByPoint."
1451
+ host false
1452
+ param box Box3 "The box."
1453
+ param p Vector3 "The point."
1454
+ returns Box3
1455
+ }
1456
+ ```
1457
+
1458
+ <sub>`api.ogt` line 386</sub>
1459
+
1460
+ <a id="member-Box3Math-union"></a>
1461
+
1462
+ #### `Box3Math.union`
1463
+
1464
+ The smallest box holding both, as three.js Box3.union.
1465
+
1466
+ ```ts
1467
+ Box3Math.union(a: Box3, b: Box3): Box3
1468
+ ```
1469
+
1470
+ | Parameter | Type | Optional | Doc |
1471
+ |---|---|---|---|
1472
+ | `a` | `Box3` | no | The first box. |
1473
+ | `b` | `Box3` | no | The second box. |
1474
+
1475
+ **Returns** `Box3`.
1476
+
1477
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1478
+
1479
+ ```ogt
1480
+ fn union {
1481
+ doc "The smallest box holding both, as three.js Box3.union."
1482
+ host false
1483
+ param a Box3 "The first box."
1484
+ param b Box3 "The second box."
1485
+ returns Box3
1486
+ }
1487
+ ```
1488
+
1489
+ <sub>`api.ogt` line 393</sub>
1490
+
1491
+ <a id="member-Box3Math-getCenter"></a>
1492
+
1493
+ #### `Box3Math.getCenter`
1494
+
1495
+ The centre, as three.js Box3.getCenter; the empty box's is the origin.
1496
+
1497
+ ```ts
1498
+ Box3Math.getCenter(box: Box3): Vector3
1499
+ ```
1500
+
1501
+ | Parameter | Type | Optional | Doc |
1502
+ |---|---|---|---|
1503
+ | `box` | `Box3` | no | The box. |
1504
+
1505
+ **Returns** `Vector3`.
1506
+
1507
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1508
+
1509
+ ```ogt
1510
+ fn getCenter {
1511
+ doc "The centre, as three.js Box3.getCenter; the empty box's is the origin."
1512
+ host false
1513
+ param box Box3 "The box."
1514
+ returns Vector3
1515
+ }
1516
+ ```
1517
+
1518
+ <sub>`api.ogt` line 400</sub>
1519
+
1520
+ <a id="member-Box3Math-getSize"></a>
1521
+
1522
+ #### `Box3Math.getSize`
1523
+
1524
+ The size along each axis, as three.js Box3.getSize; the empty box's is zero.
1525
+
1526
+ ```ts
1527
+ Box3Math.getSize(box: Box3): Vector3
1528
+ ```
1529
+
1530
+ | Parameter | Type | Optional | Doc |
1531
+ |---|---|---|---|
1532
+ | `box` | `Box3` | no | The box. |
1533
+
1534
+ **Returns** `Vector3`.
1535
+
1536
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1537
+
1538
+ ```ogt
1539
+ fn getSize {
1540
+ doc "The size along each axis, as three.js Box3.getSize; the empty box's is zero."
1541
+ host false
1542
+ param box Box3 "The box."
1543
+ returns Vector3
1544
+ }
1545
+ ```
1546
+
1547
+ <sub>`api.ogt` line 406</sub>
1548
+
1549
+ <a id="member-Box3Math-applyMatrix4"></a>
1550
+
1551
+ #### `Box3Math.applyMatrix4`
1552
+
1553
+ The box holding the eight corners transformed by m, as three.js Box3.applyMatrix4.
1554
+
1555
+ ```ts
1556
+ Box3Math.applyMatrix4(box: Box3, m: Matrix4): Box3
1557
+ ```
1558
+
1559
+ | Parameter | Type | Optional | Doc |
1560
+ |---|---|---|---|
1561
+ | `box` | `Box3` | no | The box. |
1562
+ | `m` | `Matrix4` | no | The transform. |
1563
+
1564
+ **Returns** `Box3`.
1565
+
1566
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1567
+
1568
+ ```ogt
1569
+ fn applyMatrix4 {
1570
+ doc "The box holding the eight corners transformed by m, as three.js Box3.applyMatrix4."
1571
+ host false
1572
+ param box Box3 "The box."
1573
+ param m Matrix4 "The transform."
1574
+ returns Box3
1575
+ }
1576
+ ```
1577
+
1578
+ <sub>`api.ogt` line 412</sub>
1579
+
1580
+ <a id="type-SphereMath"></a>
1581
+
1582
+ ### `SphereMath` (interface)
1583
+
1584
+ Pure functions over Sphere, as three.js Sphere's methods, each returning a new value. The value `sphere`.
1585
+
1586
+ ```ogt
1587
+ interface SphereMath {
1588
+ doc "Pure functions over Sphere, as three.js Sphere's methods, each returning a new value. The value `sphere`."
1589
+ # members follow, each quoted below
1590
+ ```
1591
+
1592
+ <sub>`api.ogt` line 421</sub>
1593
+
1594
+ <a id="member-SphereMath-fromPoints"></a>
1595
+
1596
+ #### `SphereMath.fromPoints`
1597
+
1598
+ A sphere around the points, as three.js Sphere.setFromPoints: centred on their bounding box's centre, with the radius of the farthest point.
1599
+
1600
+ ```ts
1601
+ SphereMath.fromPoints(points: readonly Vector3[]): Sphere
1602
+ ```
1603
+
1604
+ | Parameter | Type | Optional | Doc |
1605
+ |---|---|---|---|
1606
+ | `points` | `readonly Vector3[]` | no | The points. |
1607
+
1608
+ **Returns** `Sphere`.
1609
+
1610
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1611
+
1612
+ ```ogt
1613
+ fn fromPoints {
1614
+ doc "A sphere around the points, as three.js Sphere.setFromPoints: centred on their bounding box's centre, with the radius of the farthest point."
1615
+ host false
1616
+ param points List.Vector3 "The points."
1617
+ returns Sphere
1618
+ }
1619
+ ```
1620
+
1621
+ <sub>`api.ogt` line 423</sub>
1622
+
1623
+ <a id="member-SphereMath-containsPoint"></a>
1624
+
1625
+ #### `SphereMath.containsPoint`
1626
+
1627
+ Whether p is inside or on the sphere, as three.js Sphere.containsPoint.
1628
+
1629
+ ```ts
1630
+ SphereMath.containsPoint(sphere: Sphere, p: Vector3): boolean
1631
+ ```
1632
+
1633
+ | Parameter | Type | Optional | Doc |
1634
+ |---|---|---|---|
1635
+ | `sphere` | `Sphere` | no | The sphere. |
1636
+ | `p` | `Vector3` | no | The point. |
1637
+
1638
+ **Returns** `boolean`.
1639
+
1640
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1641
+
1642
+ ```ogt
1643
+ fn containsPoint {
1644
+ doc "Whether p is inside or on the sphere, as three.js Sphere.containsPoint."
1645
+ host false
1646
+ param sphere Sphere "The sphere."
1647
+ param p Vector3 "The point."
1648
+ returns bool
1649
+ }
1650
+ ```
1651
+
1652
+ <sub>`api.ogt` line 429</sub>
1653
+
1654
+ <a id="member-SphereMath-distanceToPoint"></a>
1655
+
1656
+ #### `SphereMath.distanceToPoint`
1657
+
1658
+ The distance from the surface to p, negative inside, as three.js Sphere.distanceToPoint.
1659
+
1660
+ ```ts
1661
+ SphereMath.distanceToPoint(sphere: Sphere, p: Vector3): number
1662
+ ```
1663
+
1664
+ | Parameter | Type | Optional | Doc |
1665
+ |---|---|---|---|
1666
+ | `sphere` | `Sphere` | no | The sphere. |
1667
+ | `p` | `Vector3` | no | The point. |
1668
+
1669
+ **Returns** `number`.
1670
+
1671
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1672
+
1673
+ ```ogt
1674
+ fn distanceToPoint {
1675
+ doc "The distance from the surface to p, negative inside, as three.js Sphere.distanceToPoint."
1676
+ host false
1677
+ param sphere Sphere "The sphere."
1678
+ param p Vector3 "The point."
1679
+ returns f32
1680
+ }
1681
+ ```
1682
+
1683
+ <sub>`api.ogt` line 436</sub>
1684
+
1685
+ <a id="member-SphereMath-intersectsSphere"></a>
1686
+
1687
+ #### `SphereMath.intersectsSphere`
1688
+
1689
+ Whether two spheres overlap or touch, as three.js Sphere.intersectsSphere.
1690
+
1691
+ ```ts
1692
+ SphereMath.intersectsSphere(a: Sphere, b: Sphere): boolean
1693
+ ```
1694
+
1695
+ | Parameter | Type | Optional | Doc |
1696
+ |---|---|---|---|
1697
+ | `a` | `Sphere` | no | The first sphere. |
1698
+ | `b` | `Sphere` | no | The second sphere. |
1699
+
1700
+ **Returns** `boolean`.
1701
+
1702
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1703
+
1704
+ ```ogt
1705
+ fn intersectsSphere {
1706
+ doc "Whether two spheres overlap or touch, as three.js Sphere.intersectsSphere."
1707
+ host false
1708
+ param a Sphere "The first sphere."
1709
+ param b Sphere "The second sphere."
1710
+ returns bool
1711
+ }
1712
+ ```
1713
+
1714
+ <sub>`api.ogt` line 443</sub>
1715
+
1716
+ <a id="member-SphereMath-intersectsBox"></a>
1717
+
1718
+ #### `SphereMath.intersectsBox`
1719
+
1720
+ Whether the sphere and the box overlap, as three.js Sphere.intersectsBox.
1721
+
1722
+ ```ts
1723
+ SphereMath.intersectsBox(sphere: Sphere, box: Box3): boolean
1724
+ ```
1725
+
1726
+ | Parameter | Type | Optional | Doc |
1727
+ |---|---|---|---|
1728
+ | `sphere` | `Sphere` | no | The sphere. |
1729
+ | `box` | `Box3` | no | The box. |
1730
+
1731
+ **Returns** `boolean`.
1732
+
1733
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1734
+
1735
+ ```ogt
1736
+ fn intersectsBox {
1737
+ doc "Whether the sphere and the box overlap, as three.js Sphere.intersectsBox."
1738
+ host false
1739
+ param sphere Sphere "The sphere."
1740
+ param box Box3 "The box."
1741
+ returns bool
1742
+ }
1743
+ ```
1744
+
1745
+ <sub>`api.ogt` line 450</sub>
1746
+
1747
+ <a id="member-SphereMath-getBoundingBox"></a>
1748
+
1749
+ #### `SphereMath.getBoundingBox`
1750
+
1751
+ The box around the sphere, as three.js Sphere.getBoundingBox.
1752
+
1753
+ ```ts
1754
+ SphereMath.getBoundingBox(sphere: Sphere): Box3
1755
+ ```
1756
+
1757
+ | Parameter | Type | Optional | Doc |
1758
+ |---|---|---|---|
1759
+ | `sphere` | `Sphere` | no | The sphere. |
1760
+
1761
+ **Returns** `Box3`.
1762
+
1763
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1764
+
1765
+ ```ogt
1766
+ fn getBoundingBox {
1767
+ doc "The box around the sphere, as three.js Sphere.getBoundingBox."
1768
+ host false
1769
+ param sphere Sphere "The sphere."
1770
+ returns Box3
1771
+ }
1772
+ ```
1773
+
1774
+ <sub>`api.ogt` line 457</sub>
1775
+
1776
+ <a id="member-SphereMath-applyMatrix4"></a>
1777
+
1778
+ #### `SphereMath.applyMatrix4`
1779
+
1780
+ The sphere transformed by m (its radius by m's largest axis scale), as three.js Sphere.applyMatrix4.
1781
+
1782
+ ```ts
1783
+ SphereMath.applyMatrix4(sphere: Sphere, m: Matrix4): Sphere
1784
+ ```
1785
+
1786
+ | Parameter | Type | Optional | Doc |
1787
+ |---|---|---|---|
1788
+ | `sphere` | `Sphere` | no | The sphere. |
1789
+ | `m` | `Matrix4` | no | The transform. |
1790
+
1791
+ **Returns** `Sphere`.
1792
+
1793
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1794
+
1795
+ ```ogt
1796
+ fn applyMatrix4 {
1797
+ doc "The sphere transformed by m (its radius by m's largest axis scale), as three.js Sphere.applyMatrix4."
1798
+ host false
1799
+ param sphere Sphere "The sphere."
1800
+ param m Matrix4 "The transform."
1801
+ returns Sphere
1802
+ }
1803
+ ```
1804
+
1805
+ <sub>`api.ogt` line 463</sub>
1806
+
1807
+ <a id="type-PlaneMath"></a>
1808
+
1809
+ ### `PlaneMath` (interface)
1810
+
1811
+ Pure functions over Plane, as three.js Plane's methods, each returning a new value. The value `plane`.
1812
+
1813
+ ```ogt
1814
+ interface PlaneMath {
1815
+ doc "Pure functions over Plane, as three.js Plane's methods, each returning a new value. The value `plane`."
1816
+ # members follow, each quoted below
1817
+ ```
1818
+
1819
+ <sub>`api.ogt` line 472</sub>
1820
+
1821
+ <a id="member-PlaneMath-fromNormalAndCoplanarPoint"></a>
1822
+
1823
+ #### `PlaneMath.fromNormalAndCoplanarPoint`
1824
+
1825
+ The plane through p with the normal n (normalised), as three.js Plane.setFromNormalAndCoplanarPoint.
1826
+
1827
+ ```ts
1828
+ PlaneMath.fromNormalAndCoplanarPoint(n: Vector3, p: Vector3): Plane
1829
+ ```
1830
+
1831
+ | Parameter | Type | Optional | Doc |
1832
+ |---|---|---|---|
1833
+ | `n` | `Vector3` | no | The normal. |
1834
+ | `p` | `Vector3` | no | A point on the plane. |
1835
+
1836
+ **Returns** `Plane`.
1837
+
1838
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1839
+
1840
+ ```ogt
1841
+ fn fromNormalAndCoplanarPoint {
1842
+ doc "The plane through p with the normal n (normalised), as three.js Plane.setFromNormalAndCoplanarPoint."
1843
+ host false
1844
+ param n Vector3 "The normal."
1845
+ param p Vector3 "A point on the plane."
1846
+ returns Plane
1847
+ }
1848
+ ```
1849
+
1850
+ <sub>`api.ogt` line 474</sub>
1851
+
1852
+ <a id="member-PlaneMath-fromCoplanarPoints"></a>
1853
+
1854
+ #### `PlaneMath.fromCoplanarPoints`
1855
+
1856
+ The plane through a, b and c, its normal (b - a) x (c - a) normalised (counter-clockwise points face you), as three.js Plane.setFromCoplanarPoints.
1857
+
1858
+ ```ts
1859
+ PlaneMath.fromCoplanarPoints(a: Vector3, b: Vector3, c: Vector3): Plane
1860
+ ```
1861
+
1862
+ | Parameter | Type | Optional | Doc |
1863
+ |---|---|---|---|
1864
+ | `a` | `Vector3` | no | The first point. |
1865
+ | `b` | `Vector3` | no | The second point. |
1866
+ | `c` | `Vector3` | no | The third point. |
1867
+
1868
+ **Returns** `Plane`.
1869
+
1870
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1871
+
1872
+ ```ogt
1873
+ fn fromCoplanarPoints {
1874
+ doc "The plane through a, b and c, its normal (b - a) x (c - a) normalised (counter-clockwise points face you), as three.js Plane.setFromCoplanarPoints."
1875
+ host false
1876
+ param a Vector3 "The first point."
1877
+ param b Vector3 "The second point."
1878
+ param c Vector3 "The third point."
1879
+ returns Plane
1880
+ }
1881
+ ```
1882
+
1883
+ <sub>`api.ogt` line 481</sub>
1884
+
1885
+ <a id="member-PlaneMath-normalize"></a>
1886
+
1887
+ #### `PlaneMath.normalize`
1888
+
1889
+ The same plane with a unit normal, as three.js Plane.normalize.
1890
+
1891
+ ```ts
1892
+ PlaneMath.normalize(plane: Plane): Plane
1893
+ ```
1894
+
1895
+ | Parameter | Type | Optional | Doc |
1896
+ |---|---|---|---|
1897
+ | `plane` | `Plane` | no | The plane. |
1898
+
1899
+ **Returns** `Plane`.
1900
+
1901
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1902
+
1903
+ ```ogt
1904
+ fn normalize {
1905
+ doc "The same plane with a unit normal, as three.js Plane.normalize."
1906
+ host false
1907
+ param plane Plane "The plane."
1908
+ returns Plane
1909
+ }
1910
+ ```
1911
+
1912
+ <sub>`api.ogt` line 489</sub>
1913
+
1914
+ <a id="member-PlaneMath-distanceToPoint"></a>
1915
+
1916
+ #### `PlaneMath.distanceToPoint`
1917
+
1918
+ The signed distance from the plane to p, positive on the normal's side, as three.js Plane.distanceToPoint.
1919
+
1920
+ ```ts
1921
+ PlaneMath.distanceToPoint(plane: Plane, p: Vector3): number
1922
+ ```
1923
+
1924
+ | Parameter | Type | Optional | Doc |
1925
+ |---|---|---|---|
1926
+ | `plane` | `Plane` | no | The plane. |
1927
+ | `p` | `Vector3` | no | The point. |
1928
+
1929
+ **Returns** `number`.
1930
+
1931
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1932
+
1933
+ ```ogt
1934
+ fn distanceToPoint {
1935
+ doc "The signed distance from the plane to p, positive on the normal's side, as three.js Plane.distanceToPoint."
1936
+ host false
1937
+ param plane Plane "The plane."
1938
+ param p Vector3 "The point."
1939
+ returns f32
1940
+ }
1941
+ ```
1942
+
1943
+ <sub>`api.ogt` line 495</sub>
1944
+
1945
+ <a id="member-PlaneMath-projectPoint"></a>
1946
+
1947
+ #### `PlaneMath.projectPoint`
1948
+
1949
+ The point of the plane nearest p, as three.js Plane.projectPoint.
1950
+
1951
+ ```ts
1952
+ PlaneMath.projectPoint(plane: Plane, p: Vector3): Vector3
1953
+ ```
1954
+
1955
+ | Parameter | Type | Optional | Doc |
1956
+ |---|---|---|---|
1957
+ | `plane` | `Plane` | no | The plane. |
1958
+ | `p` | `Vector3` | no | The point. |
1959
+
1960
+ **Returns** `Vector3`.
1961
+
1962
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1963
+
1964
+ ```ogt
1965
+ fn projectPoint {
1966
+ doc "The point of the plane nearest p, as three.js Plane.projectPoint."
1967
+ host false
1968
+ param plane Plane "The plane."
1969
+ param p Vector3 "The point."
1970
+ returns Vector3
1971
+ }
1972
+ ```
1973
+
1974
+ <sub>`api.ogt` line 502</sub>
1975
+
1976
+ <a id="member-PlaneMath-intersectsBox"></a>
1977
+
1978
+ #### `PlaneMath.intersectsBox`
1979
+
1980
+ Whether the plane passes through the box, as three.js Plane.intersectsBox.
1981
+
1982
+ ```ts
1983
+ PlaneMath.intersectsBox(plane: Plane, box: Box3): boolean
1984
+ ```
1985
+
1986
+ | Parameter | Type | Optional | Doc |
1987
+ |---|---|---|---|
1988
+ | `plane` | `Plane` | no | The plane. |
1989
+ | `box` | `Box3` | no | The box. |
1990
+
1991
+ **Returns** `boolean`.
1992
+
1993
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
1994
+
1995
+ ```ogt
1996
+ fn intersectsBox {
1997
+ doc "Whether the plane passes through the box, as three.js Plane.intersectsBox."
1998
+ host false
1999
+ param plane Plane "The plane."
2000
+ param box Box3 "The box."
2001
+ returns bool
2002
+ }
2003
+ ```
2004
+
2005
+ <sub>`api.ogt` line 509</sub>
2006
+
2007
+ <a id="member-PlaneMath-intersectsSphere"></a>
2008
+
2009
+ #### `PlaneMath.intersectsSphere`
2010
+
2011
+ Whether the plane passes through the sphere, as three.js Plane.intersectsSphere.
2012
+
2013
+ ```ts
2014
+ PlaneMath.intersectsSphere(plane: Plane, sphere: Sphere): boolean
2015
+ ```
2016
+
2017
+ | Parameter | Type | Optional | Doc |
2018
+ |---|---|---|---|
2019
+ | `plane` | `Plane` | no | The plane. |
2020
+ | `sphere` | `Sphere` | no | The sphere. |
2021
+
2022
+ **Returns** `boolean`.
2023
+
2024
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2025
+
2026
+ ```ogt
2027
+ fn intersectsSphere {
2028
+ doc "Whether the plane passes through the sphere, as three.js Plane.intersectsSphere."
2029
+ host false
2030
+ param plane Plane "The plane."
2031
+ param sphere Sphere "The sphere."
2032
+ returns bool
2033
+ }
2034
+ ```
2035
+
2036
+ <sub>`api.ogt` line 516</sub>
2037
+
2038
+ <a id="type-FrustumMath"></a>
2039
+
2040
+ ### `FrustumMath` (interface)
2041
+
2042
+ Pure functions over Frustum, as three.js Frustum's methods. The value `frustum`: `frustum.intersectsBox(frustum.fromCamera(camera, 16 / 9), box)` culls as the renderer would.
2043
+
2044
+ ```ogt
2045
+ interface FrustumMath {
2046
+ doc "Pure functions over Frustum, as three.js Frustum's methods. The value `frustum`: `frustum.intersectsBox(frustum.fromCamera(camera, 16 / 9), box)` culls as the renderer would."
2047
+ # members follow, each quoted below
2048
+ ```
2049
+
2050
+ <sub>`api.ogt` line 525</sub>
2051
+
2052
+ <a id="member-FrustumMath-fromProjectionMatrix"></a>
2053
+
2054
+ #### `FrustumMath.fromProjectionMatrix`
2055
+
2056
+ The frustum of a view-projection matrix (projection * inverse camera world), as three.js Frustum.setFromProjectionMatrix (WebGL clip space, z from -1 to 1).
2057
+
2058
+ ```ts
2059
+ FrustumMath.fromProjectionMatrix(m: Matrix4): Frustum
2060
+ ```
2061
+
2062
+ | Parameter | Type | Optional | Doc |
2063
+ |---|---|---|---|
2064
+ | `m` | `Matrix4` | no | The view-projection matrix. |
2065
+
2066
+ **Returns** `Frustum`.
2067
+
2068
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2069
+
2070
+ ```ogt
2071
+ fn fromProjectionMatrix {
2072
+ doc "The frustum of a view-projection matrix (projection * inverse camera world), as three.js Frustum.setFromProjectionMatrix (WebGL clip space, z from -1 to 1)."
2073
+ host false
2074
+ param m Matrix4 "The view-projection matrix."
2075
+ returns Frustum
2076
+ }
2077
+ ```
2078
+
2079
+ <sub>`api.ogt` line 527</sub>
2080
+
2081
+ <a id="member-FrustumMath-fromCamera"></a>
2082
+
2083
+ #### `FrustumMath.fromCamera`
2084
+
2085
+ The frustum og.Camera sees at an aspect ratio (width over height): its perspective projection (fov, near, far, zoom) or orthographic one (height, zoom), from its position and quaternion; shake, punch and kick, which are visual only, are left out.
2086
+
2087
+ ```ts
2088
+ FrustumMath.fromCamera(camera: Camera, aspect: number): Frustum
2089
+ ```
2090
+
2091
+ | Parameter | Type | Optional | Doc |
2092
+ |---|---|---|---|
2093
+ | `camera` | `Camera` | no | The og.Camera resource's value (world.resource(og.Camera)). |
2094
+ | `aspect` | `number` | no | The view's width over its height. |
2095
+
2096
+ **Returns** `Frustum`.
2097
+
2098
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2099
+
2100
+ ```ogt
2101
+ fn fromCamera {
2102
+ doc "The frustum og.Camera sees at an aspect ratio (width over height): its perspective projection (fov, near, far, zoom) or orthographic one (height, zoom), from its position and quaternion; shake, punch and kick, which are visual only, are left out."
2103
+ host false
2104
+ param camera Camera "The og.Camera resource's value (world.resource(og.Camera))."
2105
+ param aspect f32 "The view's width over its height."
2106
+ returns Frustum
2107
+ }
2108
+ ```
2109
+
2110
+ <sub>`api.ogt` line 533</sub>
2111
+
2112
+ <a id="member-FrustumMath-containsPoint"></a>
2113
+
2114
+ #### `FrustumMath.containsPoint`
2115
+
2116
+ Whether p is inside the frustum, as three.js Frustum.containsPoint.
2117
+
2118
+ ```ts
2119
+ FrustumMath.containsPoint(frustum: Frustum, p: Vector3): boolean
2120
+ ```
2121
+
2122
+ | Parameter | Type | Optional | Doc |
2123
+ |---|---|---|---|
2124
+ | `frustum` | `Frustum` | no | The frustum. |
2125
+ | `p` | `Vector3` | no | The point. |
2126
+
2127
+ **Returns** `boolean`.
2128
+
2129
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2130
+
2131
+ ```ogt
2132
+ fn containsPoint {
2133
+ doc "Whether p is inside the frustum, as three.js Frustum.containsPoint."
2134
+ host false
2135
+ param frustum Frustum "The frustum."
2136
+ param p Vector3 "The point."
2137
+ returns bool
2138
+ }
2139
+ ```
2140
+
2141
+ <sub>`api.ogt` line 540</sub>
2142
+
2143
+ <a id="member-FrustumMath-intersectsBox"></a>
2144
+
2145
+ #### `FrustumMath.intersectsBox`
2146
+
2147
+ Whether the box is at least partly inside, as three.js Frustum.intersectsBox (conservative near the corners, as three.js).
2148
+
2149
+ ```ts
2150
+ FrustumMath.intersectsBox(frustum: Frustum, box: Box3): boolean
2151
+ ```
2152
+
2153
+ | Parameter | Type | Optional | Doc |
2154
+ |---|---|---|---|
2155
+ | `frustum` | `Frustum` | no | The frustum. |
2156
+ | `box` | `Box3` | no | The box. |
2157
+
2158
+ **Returns** `boolean`.
2159
+
2160
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2161
+
2162
+ ```ogt
2163
+ fn intersectsBox {
2164
+ doc "Whether the box is at least partly inside, as three.js Frustum.intersectsBox (conservative near the corners, as three.js)."
2165
+ host false
2166
+ param frustum Frustum "The frustum."
2167
+ param box Box3 "The box."
2168
+ returns bool
2169
+ }
2170
+ ```
2171
+
2172
+ <sub>`api.ogt` line 547</sub>
2173
+
2174
+ <a id="member-FrustumMath-intersectsSphere"></a>
2175
+
2176
+ #### `FrustumMath.intersectsSphere`
2177
+
2178
+ Whether the sphere is at least partly inside, as three.js Frustum.intersectsSphere.
2179
+
2180
+ ```ts
2181
+ FrustumMath.intersectsSphere(frustum: Frustum, sphere: Sphere): boolean
2182
+ ```
2183
+
2184
+ | Parameter | Type | Optional | Doc |
2185
+ |---|---|---|---|
2186
+ | `frustum` | `Frustum` | no | The frustum. |
2187
+ | `sphere` | `Sphere` | no | The sphere. |
2188
+
2189
+ **Returns** `boolean`.
2190
+
2191
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2192
+
2193
+ ```ogt
2194
+ fn intersectsSphere {
2195
+ doc "Whether the sphere is at least partly inside, as three.js Frustum.intersectsSphere."
2196
+ host false
2197
+ param frustum Frustum "The frustum."
2198
+ param sphere Sphere "The sphere."
2199
+ returns bool
2200
+ }
2201
+ ```
2202
+
2203
+ <sub>`api.ogt` line 554</sub>
2204
+
2205
+ <a id="type-RayMath"></a>
2206
+
2207
+ ### `RayMath` (interface)
2208
+
2209
+ Pure functions over Ray, as three.js Ray's methods. The value `ray`. Each intersection answers the nearest point at or after the origin, or null.
2210
+
2211
+ ```ogt
2212
+ interface RayMath {
2213
+ doc "Pure functions over Ray, as three.js Ray's methods. The value `ray`. Each intersection answers the nearest point at or after the origin, or null."
2214
+ # members follow, each quoted below
2215
+ ```
2216
+
2217
+ <sub>`api.ogt` line 563</sub>
2218
+
2219
+ <a id="member-RayMath-at"></a>
2220
+
2221
+ #### `RayMath.at`
2222
+
2223
+ The point t along the ray, as three.js Ray.at.
2224
+
2225
+ ```ts
2226
+ RayMath.at(ray: Ray, t: number): Vector3
2227
+ ```
2228
+
2229
+ | Parameter | Type | Optional | Doc |
2230
+ |---|---|---|---|
2231
+ | `ray` | `Ray` | no | The ray. |
2232
+ | `t` | `number` | no | The distance along the direction, in metres. |
2233
+
2234
+ **Returns** `Vector3`.
2235
+
2236
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2237
+
2238
+ ```ogt
2239
+ fn at {
2240
+ doc "The point t along the ray, as three.js Ray.at."
2241
+ host false
2242
+ param ray Ray "The ray."
2243
+ param t f32 "The distance along the direction, in metres."
2244
+ returns Vector3
2245
+ }
2246
+ ```
2247
+
2248
+ <sub>`api.ogt` line 565</sub>
2249
+
2250
+ <a id="member-RayMath-distanceToPoint"></a>
2251
+
2252
+ #### `RayMath.distanceToPoint`
2253
+
2254
+ The distance from p to the nearest point of the ray, as three.js Ray.distanceToPoint.
2255
+
2256
+ ```ts
2257
+ RayMath.distanceToPoint(ray: Ray, p: Vector3): number
2258
+ ```
2259
+
2260
+ | Parameter | Type | Optional | Doc |
2261
+ |---|---|---|---|
2262
+ | `ray` | `Ray` | no | The ray. |
2263
+ | `p` | `Vector3` | no | The point. |
2264
+
2265
+ **Returns** `number`.
2266
+
2267
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2268
+
2269
+ ```ogt
2270
+ fn distanceToPoint {
2271
+ doc "The distance from p to the nearest point of the ray, as three.js Ray.distanceToPoint."
2272
+ host false
2273
+ param ray Ray "The ray."
2274
+ param p Vector3 "The point."
2275
+ returns f32
2276
+ }
2277
+ ```
2278
+
2279
+ <sub>`api.ogt` line 572</sub>
2280
+
2281
+ <a id="member-RayMath-intersectBox"></a>
2282
+
2283
+ #### `RayMath.intersectBox`
2284
+
2285
+ Where the ray enters the box (where it leaves, when it starts inside), as three.js Ray.intersectBox.
2286
+
2287
+ ```ts
2288
+ RayMath.intersectBox(ray: Ray, box: Box3): Vector3 | null
2289
+ ```
2290
+
2291
+ | Parameter | Type | Optional | Doc |
2292
+ |---|---|---|---|
2293
+ | `ray` | `Ray` | no | The ray. |
2294
+ | `box` | `Box3` | no | The box. |
2295
+
2296
+ **Returns** `Vector3 | null`.
2297
+
2298
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2299
+
2300
+ ```ogt
2301
+ fn intersectBox {
2302
+ doc "Where the ray enters the box (where it leaves, when it starts inside), as three.js Ray.intersectBox."
2303
+ host false
2304
+ param ray Ray "The ray."
2305
+ param box Box3 "The box."
2306
+ returns Option.Vector3
2307
+ }
2308
+ ```
2309
+
2310
+ <sub>`api.ogt` line 579</sub>
2311
+
2312
+ <a id="member-RayMath-intersectSphere"></a>
2313
+
2314
+ #### `RayMath.intersectSphere`
2315
+
2316
+ Where the ray meets the sphere (where it leaves, when it starts inside), as three.js Ray.intersectSphere.
2317
+
2318
+ ```ts
2319
+ RayMath.intersectSphere(ray: Ray, sphere: Sphere): Vector3 | null
2320
+ ```
2321
+
2322
+ | Parameter | Type | Optional | Doc |
2323
+ |---|---|---|---|
2324
+ | `ray` | `Ray` | no | The ray. |
2325
+ | `sphere` | `Sphere` | no | The sphere. |
2326
+
2327
+ **Returns** `Vector3 | null`.
2328
+
2329
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2330
+
2331
+ ```ogt
2332
+ fn intersectSphere {
2333
+ doc "Where the ray meets the sphere (where it leaves, when it starts inside), as three.js Ray.intersectSphere."
2334
+ host false
2335
+ param ray Ray "The ray."
2336
+ param sphere Sphere "The sphere."
2337
+ returns Option.Vector3
2338
+ }
2339
+ ```
2340
+
2341
+ <sub>`api.ogt` line 586</sub>
2342
+
2343
+ <a id="member-RayMath-intersectPlane"></a>
2344
+
2345
+ #### `RayMath.intersectPlane`
2346
+
2347
+ Where the ray meets the plane (its origin when it lies in the plane), as three.js Ray.intersectPlane; null when parallel or pointing away.
2348
+
2349
+ ```ts
2350
+ RayMath.intersectPlane(ray: Ray, plane: Plane): Vector3 | null
2351
+ ```
2352
+
2353
+ | Parameter | Type | Optional | Doc |
2354
+ |---|---|---|---|
2355
+ | `ray` | `Ray` | no | The ray. |
2356
+ | `plane` | `Plane` | no | The plane. |
2357
+
2358
+ **Returns** `Vector3 | null`.
2359
+
2360
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2361
+
2362
+ ```ogt
2363
+ fn intersectPlane {
2364
+ doc "Where the ray meets the plane (its origin when it lies in the plane), as three.js Ray.intersectPlane; null when parallel or pointing away."
2365
+ host false
2366
+ param ray Ray "The ray."
2367
+ param plane Plane "The plane."
2368
+ returns Option.Vector3
2369
+ }
2370
+ ```
2371
+
2372
+ <sub>`api.ogt` line 593</sub>
2373
+
2374
+ <a id="member-RayMath-intersectTriangle"></a>
2375
+
2376
+ #### `RayMath.intersectTriangle`
2377
+
2378
+ Where the ray meets the triangle a, b, c, as three.js Ray.intersectTriangle; with backfaceCulling a triangle facing away (clockwise from the origin) is missed.
2379
+
2380
+ ```ts
2381
+ RayMath.intersectTriangle(ray: Ray, a: Vector3, b: Vector3, c: Vector3, backfaceCulling?: boolean): Vector3 | null
2382
+ ```
2383
+
2384
+ | Parameter | Type | Optional | Doc |
2385
+ |---|---|---|---|
2386
+ | `ray` | `Ray` | no | The ray. |
2387
+ | `a` | `Vector3` | no | The first corner. |
2388
+ | `b` | `Vector3` | no | The second corner. |
2389
+ | `c` | `Vector3` | no | The third corner. |
2390
+ | `backfaceCulling` | `boolean` | yes | Miss triangles facing away. Default `false`. |
2391
+
2392
+ **Returns** `Vector3 | null`.
2393
+
2394
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2395
+
2396
+ ```ogt
2397
+ fn intersectTriangle {
2398
+ doc "Where the ray meets the triangle a, b, c, as three.js Ray.intersectTriangle; with backfaceCulling a triangle facing away (clockwise from the origin) is missed."
2399
+ host false
2400
+ param ray Ray "The ray."
2401
+ param a Vector3 "The first corner."
2402
+ param b Vector3 "The second corner."
2403
+ param c Vector3 "The third corner."
2404
+ param backfaceCulling bool "Miss triangles facing away." {
2405
+ default false
2406
+ }
2407
+ returns Option.Vector3
2408
+ }
2409
+ ```
2410
+
2411
+ <sub>`api.ogt` line 600</sub>
2412
+
2413
+ <a id="type-ColorMath"></a>
2414
+
2415
+ ### `ColorMath` (interface)
2416
+
2417
+ Pure functions over Color (linear RGB), as three.js Color's methods with colour management on: hex and HSL are sRGB, converted to and from linear as three.js does. The value `color`: `color.fromHex(0xff8800)`. The same bits on every host (no Math.pow).
2418
+
2419
+ ```ogt
2420
+ interface ColorMath {
2421
+ doc "Pure functions over Color (linear RGB), as three.js Color's methods with colour management on: hex and HSL are sRGB, converted to and from linear as three.js does. The value `color`: `color.fromHex(0xff8800)`. The same bits on every host (no Math.pow)."
2422
+ # members follow, each quoted below
2423
+ ```
2424
+
2425
+ <sub>`api.ogt` line 614</sub>
2426
+
2427
+ <a id="member-ColorMath-fromHex"></a>
2428
+
2429
+ #### `ColorMath.fromHex`
2430
+
2431
+ The linear colour of an sRGB hex number, as new three.js Color(0xrrggbb).
2432
+
2433
+ ```ts
2434
+ ColorMath.fromHex(hex: number): Color
2435
+ ```
2436
+
2437
+ | Parameter | Type | Optional | Doc |
2438
+ |---|---|---|---|
2439
+ | `hex` | `number` | no | 0xrrggbb, sRGB. |
2440
+
2441
+ **Returns** `Color`.
2442
+
2443
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2444
+
2445
+ ```ogt
2446
+ fn fromHex {
2447
+ doc "The linear colour of an sRGB hex number, as new three.js Color(0xrrggbb)."
2448
+ host false
2449
+ param hex u32 "0xrrggbb, sRGB."
2450
+ returns Color
2451
+ }
2452
+ ```
2453
+
2454
+ <sub>`api.ogt` line 616</sub>
2455
+
2456
+ <a id="member-ColorMath-toHex"></a>
2457
+
2458
+ #### `ColorMath.toHex`
2459
+
2460
+ The sRGB hex number of a linear colour, each channel clamped to 0..1 and rounded, as three.js Color.getHex.
2461
+
2462
+ ```ts
2463
+ ColorMath.toHex(c: Color): number
2464
+ ```
2465
+
2466
+ | Parameter | Type | Optional | Doc |
2467
+ |---|---|---|---|
2468
+ | `c` | `Color` | no | The colour. |
2469
+
2470
+ **Returns** `number`.
2471
+
2472
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2473
+
2474
+ ```ogt
2475
+ fn toHex {
2476
+ doc "The sRGB hex number of a linear colour, each channel clamped to 0..1 and rounded, as three.js Color.getHex."
2477
+ host false
2478
+ param c Color "The colour."
2479
+ returns u32
2480
+ }
2481
+ ```
2482
+
2483
+ <sub>`api.ogt` line 622</sub>
2484
+
2485
+ <a id="member-ColorMath-lerp"></a>
2486
+
2487
+ #### `ColorMath.lerp`
2488
+
2489
+ a + (b - a) * t in linear RGB, as three.js Color.lerpColors.
2490
+
2491
+ ```ts
2492
+ ColorMath.lerp(a: Color, b: Color, t: number): Color
2493
+ ```
2494
+
2495
+ | Parameter | Type | Optional | Doc |
2496
+ |---|---|---|---|
2497
+ | `a` | `Color` | no | The value at t = 0. |
2498
+ | `b` | `Color` | no | The value at t = 1. |
2499
+ | `t` | `number` | no | The fraction. |
2500
+
2501
+ **Returns** `Color`.
2502
+
2503
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2504
+
2505
+ ```ogt
2506
+ fn lerp {
2507
+ doc "a + (b - a) * t in linear RGB, as three.js Color.lerpColors."
2508
+ host false
2509
+ param a Color "The value at t = 0."
2510
+ param b Color "The value at t = 1."
2511
+ param t f32 "The fraction."
2512
+ returns Color
2513
+ }
2514
+ ```
2515
+
2516
+ <sub>`api.ogt` line 628</sub>
2517
+
2518
+ <a id="member-ColorMath-fromHsl"></a>
2519
+
2520
+ #### `ColorMath.fromHsl`
2521
+
2522
+ The linear colour of sRGB hue, saturation and lightness, as three.js Color.setHSL (hue wraps, saturation and lightness clamp to 0..1).
2523
+
2524
+ ```ts
2525
+ ColorMath.fromHsl(h: number, s: number, l: number): Color
2526
+ ```
2527
+
2528
+ | Parameter | Type | Optional | Doc |
2529
+ |---|---|---|---|
2530
+ | `h` | `number` | no | The hue, 0 to 1 around the wheel (0 red, 1/3 green, 2/3 blue). |
2531
+ | `s` | `number` | no | The saturation, 0 to 1. |
2532
+ | `l` | `number` | no | The lightness, 0 to 1. |
2533
+
2534
+ **Returns** `Color`.
2535
+
2536
+ Implemented by the TypeScript runtime over the members of this module: no binding symbol.
2537
+
2538
+ ```ogt
2539
+ fn fromHsl {
2540
+ doc "The linear colour of sRGB hue, saturation and lightness, as three.js Color.setHSL (hue wraps, saturation and lightness clamp to 0..1)."
2541
+ host false
2542
+ param h f32 "The hue, 0 to 1 around the wheel (0 red, 1/3 green, 2/3 blue)."
2543
+ param s f32 "The saturation, 0 to 1."
2544
+ param l f32 "The lightness, 0 to 1."
2545
+ returns Color
2546
+ }
2547
+ ```
2548
+
2549
+ <sub>`api.ogt` line 636</sub>
29
2550
 
30
2551
  ## Types
31
2552
 
@@ -48,7 +2569,7 @@ struct Vector2 {
48
2569
  }
49
2570
  ```
50
2571
 
51
- <sub>`api.ogt` line 40</sub>
2572
+ <sub>`api.ogt` line 41</sub>
52
2573
 
53
2574
  <a id="type-Vector3"></a>
54
2575
 
@@ -71,7 +2592,7 @@ struct Vector3 {
71
2592
  }
72
2593
  ```
73
2594
 
74
- <sub>`api.ogt` line 46</sub>
2595
+ <sub>`api.ogt` line 47</sub>
75
2596
 
76
2597
  <a id="type-Quaternion"></a>
77
2598
 
@@ -98,7 +2619,7 @@ struct Quaternion {
98
2619
  }
99
2620
  ```
100
2621
 
101
- <sub>`api.ogt` line 53</sub>
2622
+ <sub>`api.ogt` line 54</sub>
102
2623
 
103
2624
  <a id="type-Matrix4"></a>
104
2625
 
@@ -119,7 +2640,7 @@ struct Matrix4 {
119
2640
  }
120
2641
  ```
121
2642
 
122
- <sub>`api.ogt` line 63</sub>
2643
+ <sub>`api.ogt` line 64</sub>
123
2644
 
124
2645
  <a id="type-Color"></a>
125
2646
 
@@ -142,7 +2663,7 @@ struct Color {
142
2663
  }
143
2664
  ```
144
2665
 
145
- <sub>`api.ogt` line 70</sub>
2666
+ <sub>`api.ogt` line 71</sub>
146
2667
 
147
2668
  <a id="type-Ray"></a>
148
2669
 
@@ -163,4 +2684,90 @@ struct Ray {
163
2684
  }
164
2685
  ```
165
2686
 
166
- <sub>`api.ogt` line 77</sub>
2687
+ <sub>`api.ogt` line 78</sub>
2688
+
2689
+ <a id="type-Box3"></a>
2690
+
2691
+ ### `Box3` (struct)
2692
+
2693
+ An axis-aligned box, as three.js Box3. A box whose min exceeds its max on an axis is empty (box3.empty() makes one: min +Infinity, max -Infinity).
2694
+
2695
+ | Field | Type | Default | Range | Unit | Notes | Doc |
2696
+ |---|---|---|---|---|---|---|
2697
+ | `min` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | — | — | The lower corner. |
2698
+ | `max` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | — | — | The upper corner. |
2699
+
2700
+ ```ogt
2701
+ struct Box3 {
2702
+ doc "An axis-aligned box, as three.js Box3. A box whose min exceeds its max on an axis is empty (box3.empty() makes one: min +Infinity, max -Infinity)."
2703
+ field min Vector3 "The lower corner."
2704
+ field max Vector3 "The upper corner."
2705
+ }
2706
+ ```
2707
+
2708
+ <sub>`api.ogt` line 84</sub>
2709
+
2710
+ <a id="type-Sphere"></a>
2711
+
2712
+ ### `Sphere` (struct)
2713
+
2714
+ A sphere, as three.js Sphere. A negative radius is empty.
2715
+
2716
+ | Field | Type | Default | Range | Unit | Notes | Doc |
2717
+ |---|---|---|---|---|---|---|
2718
+ | `center` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | — | — | The centre. |
2719
+ | `radius` | `number` | `0` | — | `m` | — | The radius. |
2720
+
2721
+ ```ogt
2722
+ struct Sphere {
2723
+ doc "A sphere, as three.js Sphere. A negative radius is empty."
2724
+ field center Vector3 "The centre."
2725
+ field radius f32 "The radius." {
2726
+ unit m
2727
+ }
2728
+ }
2729
+ ```
2730
+
2731
+ <sub>`api.ogt` line 90</sub>
2732
+
2733
+ <a id="type-Plane"></a>
2734
+
2735
+ ### `Plane` (struct)
2736
+
2737
+ A plane, as three.js Plane: the points p with dot(normal, p) + constant = 0; normal is unit length, and the positive side is where it points.
2738
+
2739
+ | Field | Type | Default | Range | Unit | Notes | Doc |
2740
+ |---|---|---|---|---|---|---|
2741
+ | `normal` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | — | — | The unit normal. |
2742
+ | `constant` | `number` | `0` | — | `m` | — | The signed distance from the origin to the plane, negated along the normal (three.js Plane.constant). |
2743
+
2744
+ ```ogt
2745
+ struct Plane {
2746
+ doc "A plane, as three.js Plane: the points p with dot(normal, p) + constant = 0; normal is unit length, and the positive side is where it points."
2747
+ field normal Vector3 "The unit normal."
2748
+ field constant f32 "The signed distance from the origin to the plane, negated along the normal (three.js Plane.constant)." {
2749
+ unit m
2750
+ }
2751
+ }
2752
+ ```
2753
+
2754
+ <sub>`api.ogt` line 98</sub>
2755
+
2756
+ <a id="type-Frustum"></a>
2757
+
2758
+ ### `Frustum` (struct)
2759
+
2760
+ A view volume, as three.js Frustum: six planes whose normals point inwards (right, left, bottom, top, far, near, three.js's order). frustum.fromCamera and frustum.fromProjectionMatrix make one.
2761
+
2762
+ | Field | Type | Default | Range | Unit | Notes | Doc |
2763
+ |---|---|---|---|---|---|---|
2764
+ | `planes` | `readonly Plane[]` | `[]` | — | — | — | The six planes, normals inwards. |
2765
+
2766
+ ```ogt
2767
+ struct Frustum {
2768
+ doc "A view volume, as three.js Frustum: six planes whose normals point inwards (right, left, bottom, top, far, near, three.js's order). frustum.fromCamera and frustum.fromProjectionMatrix make one."
2769
+ field planes List.Plane "The six planes, normals inwards."
2770
+ }
2771
+ ```
2772
+
2773
+ <sub>`api.ogt` line 106</sub>