@ac-kit/math-linear 0.2.1 → 0.4.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.
- package/CHANGELOG.md +337 -0
- package/README.md +232 -16
- package/dist/_brand.d.ts +14 -0
- package/dist/_brand.d.ts.map +1 -0
- package/dist/_brand.js +2 -0
- package/dist/_brand.js.map +1 -0
- package/dist/_invert.d.ts +214 -0
- package/dist/_invert.d.ts.map +1 -0
- package/dist/_invert.js +884 -0
- package/dist/_invert.js.map +1 -0
- package/dist/_slerp.d.ts +29 -0
- package/dist/_slerp.d.ts.map +1 -1
- package/dist/_slerp.js +103 -0
- package/dist/_slerp.js.map +1 -1
- package/dist/_strided-range.d.ts +23 -0
- package/dist/_strided-range.d.ts.map +1 -0
- package/dist/_strided-range.js +75 -0
- package/dist/_strided-range.js.map +1 -0
- package/dist/_trs.d.ts +38 -0
- package/dist/_trs.d.ts.map +1 -0
- package/dist/_trs.js +132 -0
- package/dist/_trs.js.map +1 -0
- package/dist/affine2-array.d.ts +53 -0
- package/dist/affine2-array.d.ts.map +1 -0
- package/dist/affine2-array.js +107 -0
- package/dist/affine2-array.js.map +1 -0
- package/dist/affine2-componentwise.d.ts +28 -0
- package/dist/affine2-componentwise.d.ts.map +1 -0
- package/dist/affine2-componentwise.js +66 -0
- package/dist/affine2-componentwise.js.map +1 -0
- package/dist/affine2.d.ts +156 -0
- package/dist/affine2.d.ts.map +1 -0
- package/dist/affine2.js +437 -0
- package/dist/affine2.js.map +1 -0
- package/dist/affine3-array.d.ts +53 -0
- package/dist/affine3-array.d.ts.map +1 -0
- package/dist/affine3-array.js +137 -0
- package/dist/affine3-array.js.map +1 -0
- package/dist/affine3-componentwise.d.ts +32 -0
- package/dist/affine3-componentwise.d.ts.map +1 -0
- package/dist/affine3-componentwise.js +100 -0
- package/dist/affine3-componentwise.js.map +1 -0
- package/dist/affine3.d.ts +205 -0
- package/dist/affine3.d.ts.map +1 -0
- package/dist/affine3.js +792 -0
- package/dist/affine3.js.map +1 -0
- package/dist/checked/index.d.ts +35 -0
- package/dist/checked/index.d.ts.map +1 -0
- package/dist/checked/index.js +58 -0
- package/dist/checked/index.js.map +1 -0
- package/dist/euler.d.ts +65 -0
- package/dist/euler.d.ts.map +1 -0
- package/dist/euler.js +217 -0
- package/dist/euler.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/dist/kl-activations.d.ts.map +1 -1
- package/dist/kl-activations.js +4 -3
- package/dist/kl-activations.js.map +1 -1
- package/dist/mat2x2-array.d.ts +36 -0
- package/dist/mat2x2-array.d.ts.map +1 -0
- package/dist/mat2x2-array.js +71 -0
- package/dist/mat2x2-array.js.map +1 -0
- package/dist/mat2x2-componentwise.d.ts +86 -0
- package/dist/mat2x2-componentwise.d.ts.map +1 -0
- package/dist/mat2x2-componentwise.js +199 -0
- package/dist/mat2x2-componentwise.js.map +1 -0
- package/dist/mat2x2.d.ts +79 -25
- package/dist/mat2x2.d.ts.map +1 -1
- package/dist/mat2x2.js +192 -93
- package/dist/mat2x2.js.map +1 -1
- package/dist/mat3x3-array.d.ts +36 -0
- package/dist/mat3x3-array.d.ts.map +1 -0
- package/dist/mat3x3-array.js +91 -0
- package/dist/mat3x3-array.js.map +1 -0
- package/dist/mat3x3-componentwise.d.ts +86 -0
- package/dist/mat3x3-componentwise.d.ts.map +1 -0
- package/dist/mat3x3-componentwise.js +299 -0
- package/dist/mat3x3-componentwise.js.map +1 -0
- package/dist/mat3x3.d.ts +153 -48
- package/dist/mat3x3.d.ts.map +1 -1
- package/dist/mat3x3.js +470 -192
- package/dist/mat3x3.js.map +1 -1
- package/dist/mat4x4-array.d.ts +46 -0
- package/dist/mat4x4-array.d.ts.map +1 -0
- package/dist/mat4x4-array.js +133 -0
- package/dist/mat4x4-array.js.map +1 -0
- package/dist/mat4x4-componentwise.d.ts +87 -0
- package/dist/mat4x4-componentwise.d.ts.map +1 -0
- package/dist/mat4x4-componentwise.js +434 -0
- package/dist/mat4x4-componentwise.js.map +1 -0
- package/dist/mat4x4.d.ts +221 -67
- package/dist/mat4x4.d.ts.map +1 -1
- package/dist/mat4x4.js +972 -334
- package/dist/mat4x4.js.map +1 -1
- package/dist/projection.d.ts +113 -0
- package/dist/projection.d.ts.map +1 -0
- package/dist/projection.js +418 -0
- package/dist/projection.js.map +1 -0
- package/dist/quaternion-array.d.ts +47 -0
- package/dist/quaternion-array.d.ts.map +1 -0
- package/dist/quaternion-array.js +86 -0
- package/dist/quaternion-array.js.map +1 -0
- package/dist/quaternion.d.ts +106 -22
- package/dist/quaternion.d.ts.map +1 -1
- package/dist/quaternion.js +253 -182
- package/dist/quaternion.js.map +1 -1
- package/dist/transform.d.ts +220 -0
- package/dist/transform.d.ts.map +1 -0
- package/dist/transform.js +412 -0
- package/dist/transform.js.map +1 -0
- package/dist/tridiagonal.d.ts +52 -0
- package/dist/tridiagonal.d.ts.map +1 -0
- package/dist/tridiagonal.js +90 -0
- package/dist/tridiagonal.js.map +1 -0
- package/dist/upload.d.ts +55 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/upload.js +129 -0
- package/dist/upload.js.map +1 -0
- package/dist/vec2-array-componentwise.d.ts +207 -0
- package/dist/vec2-array-componentwise.d.ts.map +1 -0
- package/dist/vec2-array-componentwise.js +472 -0
- package/dist/vec2-array-componentwise.js.map +1 -0
- package/dist/vec2-array.d.ts +53 -0
- package/dist/vec2-array.d.ts.map +1 -0
- package/dist/vec2-array.js +123 -0
- package/dist/vec2-array.js.map +1 -0
- package/dist/vec2-componentwise.d.ts +311 -0
- package/dist/vec2-componentwise.d.ts.map +1 -0
- package/dist/vec2-componentwise.js +542 -0
- package/dist/vec2-componentwise.js.map +1 -0
- package/dist/vec2.d.ts +97 -82
- package/dist/vec2.d.ts.map +1 -1
- package/dist/vec2.js +121 -216
- package/dist/vec2.js.map +1 -1
- package/dist/vec3-array-componentwise.d.ts +207 -0
- package/dist/vec3-array-componentwise.d.ts.map +1 -0
- package/dist/vec3-array-componentwise.js +510 -0
- package/dist/vec3-array-componentwise.js.map +1 -0
- package/dist/vec3-array.d.ts +102 -0
- package/dist/vec3-array.d.ts.map +1 -0
- package/dist/vec3-array.js +299 -0
- package/dist/vec3-array.js.map +1 -0
- package/dist/vec3-componentwise.d.ts +310 -0
- package/dist/vec3-componentwise.d.ts.map +1 -0
- package/dist/vec3-componentwise.js +594 -0
- package/dist/vec3-componentwise.js.map +1 -0
- package/dist/vec3.d.ts +177 -87
- package/dist/vec3.d.ts.map +1 -1
- package/dist/vec3.js +391 -272
- package/dist/vec3.js.map +1 -1
- package/dist/vec4-array-componentwise.d.ts +198 -0
- package/dist/vec4-array-componentwise.d.ts.map +1 -0
- package/dist/vec4-array-componentwise.js +521 -0
- package/dist/vec4-array-componentwise.js.map +1 -0
- package/dist/vec4-array.d.ts +12 -0
- package/dist/vec4-array.d.ts.map +1 -0
- package/dist/vec4-array.js +43 -0
- package/dist/vec4-array.js.map +1 -0
- package/dist/vec4-componentwise.d.ts +299 -0
- package/dist/vec4-componentwise.d.ts.map +1 -0
- package/dist/vec4-componentwise.js +637 -0
- package/dist/vec4-componentwise.js.map +1 -0
- package/dist/vec4.d.ts +59 -53
- package/dist/vec4.d.ts.map +1 -1
- package/dist/vec4.js +74 -249
- package/dist/vec4.js.map +1 -1
- package/dist/view-basis.d.ts +15 -0
- package/dist/view-basis.d.ts.map +1 -0
- package/dist/view-basis.js +29 -0
- package/dist/view-basis.js.map +1 -0
- package/dist/viewport.d.ts +114 -0
- package/dist/viewport.d.ts.map +1 -0
- package/dist/viewport.js +250 -0
- package/dist/viewport.js.map +1 -0
- package/package.json +19 -9
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { type IsCloseToOptions, type RoundOptions } from "@ac-kit/core";
|
|
2
|
+
import type { ReadonlyVec4, Vec4 } from "./vec4.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates the zero vector `[0, 0, 0, 0]`.
|
|
5
|
+
*
|
|
6
|
+
* Allocates; keep it out of hot loops.
|
|
7
|
+
*/
|
|
8
|
+
export declare function vec4Create(): Vec4;
|
|
9
|
+
/**
|
|
10
|
+
* Creates the vector `[x, y, z, w]`. Like every creator it starts from an array
|
|
11
|
+
* of doubles, so a vector made of whole numbers is still
|
|
12
|
+
* `PACKED_DOUBLE_ELEMENTS` in V8, where an array literal such as `[1, 2, 3]` is
|
|
13
|
+
* an array of small integers that a shared `out` would turn into a generic
|
|
14
|
+
* array for good.
|
|
15
|
+
*
|
|
16
|
+
* Allocates; keep it out of hot loops.
|
|
17
|
+
*/
|
|
18
|
+
export declare function vec4Of(x: number, y: number, z: number, w: number): Vec4;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a copy of `a`. Like every creator it starts from a clean array, so a
|
|
21
|
+
* clone of an array of small integers is an array of doubles.
|
|
22
|
+
*
|
|
23
|
+
* Allocates; keep it out of hot loops.
|
|
24
|
+
*/
|
|
25
|
+
export declare function vec4Clone(a: ReadonlyVec4): Vec4;
|
|
26
|
+
/**
|
|
27
|
+
* The checked way in from untyped data (JSON, messages, arrays of unknown
|
|
28
|
+
* origin): `source[offset … offset + 4)` copied into `out`, each element that
|
|
29
|
+
* is not a number written as `NaN`, an index below zero or at or past
|
|
30
|
+
* `source.length` too, so `out` never holds a non-number. Test the result with
|
|
31
|
+
* {@link vec4IsFinite} when `NaN` must not get through. A cold path: a
|
|
32
|
+
* `Float64Array` of vectors is read with {@link vec4Load}. O(1).
|
|
33
|
+
*
|
|
34
|
+
* `source` may be `out` itself: the 4 elements are read before the first write.
|
|
35
|
+
*
|
|
36
|
+
* @param out The vector to fill.
|
|
37
|
+
* @param source The array to read, of any length and any content.
|
|
38
|
+
* @param offset The index of the first component in `source`.
|
|
39
|
+
* @returns `out`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function vec4FromArray(out: Vec4, source: ArrayLike<number>, offset?: number): Vec4;
|
|
42
|
+
/** Writes the vector `[x, y, z, w]` into `out`. */
|
|
43
|
+
export declare function vec4Set(out: Vec4, x: number, y: number, z: number, w: number): Vec4;
|
|
44
|
+
/** Writes a copy of `a` into `out`. */
|
|
45
|
+
export declare function vec4Copy(out: Vec4, a: ReadonlyVec4): Vec4;
|
|
46
|
+
/** Writes the zero vector `[0, 0, 0, 0]` into `out`. */
|
|
47
|
+
export declare function vec4Zero(out: Vec4): Vec4;
|
|
48
|
+
/** Writes `a + b` into `out`. `out` may be `a` or `b`. */
|
|
49
|
+
export declare function vec4Add(out: Vec4, a: ReadonlyVec4, b: ReadonlyVec4): Vec4;
|
|
50
|
+
/** Writes `a − b` into `out`. `out` may be `a` or `b`. */
|
|
51
|
+
export declare function vec4Subtract(out: Vec4, a: ReadonlyVec4, b: ReadonlyVec4): Vec4;
|
|
52
|
+
/**
|
|
53
|
+
* Writes the component-wise product of `a` and `b` into `out`: not the dot
|
|
54
|
+
* product, and not a cross product. `out` may be `a` or `b`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function vec4Multiply(out: Vec4, a: ReadonlyVec4, b: ReadonlyVec4): Vec4;
|
|
57
|
+
/**
|
|
58
|
+
* Writes the component-wise quotient `a / b` into `out`. A zero component of
|
|
59
|
+
* `b` gives `±Infinity`, or `NaN` for `0 / 0`; nothing throws. `out` may be `a`
|
|
60
|
+
* or `b`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function vec4Divide(out: Vec4, a: ReadonlyVec4, b: ReadonlyVec4): Vec4;
|
|
63
|
+
/**
|
|
64
|
+
* Writes `a` with `scalar` added to every component into `out`. `out` may be
|
|
65
|
+
* `a`.
|
|
66
|
+
*/
|
|
67
|
+
export declare function vec4AddScalar(out: Vec4, a: ReadonlyVec4, scalar: number): Vec4;
|
|
68
|
+
/** Writes `a · scalar` into `out`. `out` may be `a`. */
|
|
69
|
+
export declare function vec4MultiplyScalar(out: Vec4, a: ReadonlyVec4, scalar: number): Vec4;
|
|
70
|
+
/**
|
|
71
|
+
* Writes `a / scalar` into `out`. A zero `scalar` gives `±Infinity` or `NaN`
|
|
72
|
+
* components, not an exception. `out` may be `a`.
|
|
73
|
+
*/
|
|
74
|
+
export declare function vec4DivideScalar(out: Vec4, a: ReadonlyVec4, scalar: number): Vec4;
|
|
75
|
+
/**
|
|
76
|
+
* Writes `a + b · scale` into `out`: two roundings per component, not a fused
|
|
77
|
+
* multiply-add. `out` may be `a` or `b`.
|
|
78
|
+
*/
|
|
79
|
+
export declare function vec4AddScaled(out: Vec4, a: ReadonlyVec4, b: ReadonlyVec4, scale: number): Vec4;
|
|
80
|
+
/** Writes `−a` into `out`. `out` may be `a`. */
|
|
81
|
+
export declare function vec4Negate(out: Vec4, a: ReadonlyVec4): Vec4;
|
|
82
|
+
/**
|
|
83
|
+
* Writes the absolute value of every component of `a` into `out`. `out` may be
|
|
84
|
+
* `a`.
|
|
85
|
+
*/
|
|
86
|
+
export declare function vec4Abs(out: Vec4, a: ReadonlyVec4): Vec4;
|
|
87
|
+
/**
|
|
88
|
+
* Writes `a` with every component rounded by `@ac-kit/core`'s `round` into
|
|
89
|
+
* `out`: `options` choose the method (round, floor, ceil, trunc) and the digits
|
|
90
|
+
* kept, and none rounds to whole numbers. `out` may be `a`.
|
|
91
|
+
*/
|
|
92
|
+
export declare function vec4Round(out: Vec4, a: ReadonlyVec4, options?: RoundOptions): Vec4;
|
|
93
|
+
/**
|
|
94
|
+
* Writes the component-wise minimum of `a` and `b` into `out`, as `Math.min`
|
|
95
|
+
* takes it: a `NaN` gives `NaN`, and `−0` is below `+0`. `out` may be `a` or
|
|
96
|
+
* `b`.
|
|
97
|
+
*/
|
|
98
|
+
export declare function vec4Min(out: Vec4, a: ReadonlyVec4, b: ReadonlyVec4): Vec4;
|
|
99
|
+
/**
|
|
100
|
+
* Writes the component-wise maximum of `a` and `b` into `out`, as `Math.max`
|
|
101
|
+
* takes it: a `NaN` gives `NaN`, and `+0` is above `−0`. `out` may be `a` or
|
|
102
|
+
* `b`.
|
|
103
|
+
*/
|
|
104
|
+
export declare function vec4Max(out: Vec4, a: ReadonlyVec4, b: ReadonlyVec4): Vec4;
|
|
105
|
+
/**
|
|
106
|
+
* Writes `a` limited component-wise to `[min, max]` into `out`. Where a `min`
|
|
107
|
+
* component is above its `max`, the `max` wins, and a `NaN` gives `NaN`:
|
|
108
|
+
* nothing throws, unlike `@ac-kit/core`'s `clamp`. `out` may be any of the
|
|
109
|
+
* arguments.
|
|
110
|
+
*/
|
|
111
|
+
export declare function vec4Clamp(out: Vec4, a: ReadonlyVec4, min: ReadonlyVec4, max: ReadonlyVec4): Vec4;
|
|
112
|
+
/**
|
|
113
|
+
* Writes `a` with every component limited to `[min, max]` into `out`. Where
|
|
114
|
+
* `min` is above `max` the `max` wins, and a `NaN` gives `NaN`: nothing throws,
|
|
115
|
+
* unlike `@ac-kit/core`'s `clamp`. `out` may be `a`.
|
|
116
|
+
*/
|
|
117
|
+
export declare function vec4ClampScalar(out: Vec4, a: ReadonlyVec4, min: number, max: number): Vec4;
|
|
118
|
+
/**
|
|
119
|
+
* Writes `a + (b − a)·t` into `out`, each component by `@ac-kit/math-scalar`'s
|
|
120
|
+
* `lerp`: exactly `a` at `t = 0`, and `b` at `t = 1` up to rounding when `a`
|
|
121
|
+
* and `b` differ greatly in magnitude. A `t` outside `[0, 1]` extrapolates.
|
|
122
|
+
* `out` may be `a` or `b`.
|
|
123
|
+
*/
|
|
124
|
+
export declare function vec4Lerp(out: Vec4, a: ReadonlyVec4, b: ReadonlyVec4, t: number): Vec4;
|
|
125
|
+
/**
|
|
126
|
+
* Exact component-wise equality: `−0` equals `+0`, and `NaN` equals nothing,
|
|
127
|
+
* itself included. See {@link vec4IsClose} for a tolerant test.
|
|
128
|
+
*/
|
|
129
|
+
export declare function vec4Equals(a: ReadonlyVec4, b: ReadonlyVec4): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Component-wise approximate equality, each pair compared by `@ac-kit/core`'s
|
|
132
|
+
* `isCloseTo` with `options`: none means exact.
|
|
133
|
+
*
|
|
134
|
+
* Not transitive, so it is not an equality in the sense a `Set` or `Map` needs,
|
|
135
|
+
* and never a basis for ordering — use {@link vec4Equals} there. The tolerance
|
|
136
|
+
* is required: a vector carries no units of its own, so only the caller knows
|
|
137
|
+
* what counts as close.
|
|
138
|
+
*/
|
|
139
|
+
export declare function vec4IsClose(a: ReadonlyVec4, b: ReadonlyVec4, options: IsCloseToOptions): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Whether every component is a finite number: the check to run after parsing
|
|
142
|
+
* untrusted data or before an upload, as operations never check. A component
|
|
143
|
+
* that is not a number at all (a vector built by a caller who bypassed the
|
|
144
|
+
* types) counts as not finite.
|
|
145
|
+
*/
|
|
146
|
+
export declare function vec4IsFinite(a: ReadonlyVec4): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Writes element `index` of `array`, the numbers at `[index·4, index·4 + 4)`,
|
|
149
|
+
* into `out`. Each component is written as `+array[i]`, so an index past the
|
|
150
|
+
* end of `array` gives `NaN`, never `undefined`: the vector stays clean
|
|
151
|
+
* whatever the caller does. Checking the index is the job of the checked
|
|
152
|
+
* layer.
|
|
153
|
+
*
|
|
154
|
+
* The vector is copied: it is never a view of `array`. O(1).
|
|
155
|
+
*/
|
|
156
|
+
export declare function vec4Load(out: Vec4, array: Float64Array, index: number): Vec4;
|
|
157
|
+
/**
|
|
158
|
+
* Writes `value` into `array` as element `index`, at `[index·4, index·4 + 4)`.
|
|
159
|
+
* An element past the end of `array` writes nothing, as a typed array drops an
|
|
160
|
+
* out-of-range write. O(1).
|
|
161
|
+
*/
|
|
162
|
+
export declare function vec4Store(array: Float64Array, index: number, value: ReadonlyVec4): void;
|
|
163
|
+
/**
|
|
164
|
+
* Like {@link vec4Load} for interleaved data: element `index` starts at `offset +
|
|
165
|
+
* index·stride`, both counted in numbers, and its 4 components follow one
|
|
166
|
+
* another. An index past the end gives `NaN` components. O(1).
|
|
167
|
+
*/
|
|
168
|
+
export declare function vec4LoadStrided(out: Vec4, array: Float64Array, offset: number, stride: number, index: number): Vec4;
|
|
169
|
+
/**
|
|
170
|
+
* Like {@link vec4Store} for interleaved data: element `index` starts at `offset +
|
|
171
|
+
* index·stride`, both counted in numbers. A component past the end of `array`
|
|
172
|
+
* writes nothing. O(1).
|
|
173
|
+
*/
|
|
174
|
+
export declare function vec4StoreStrided(array: Float64Array, offset: number, stride: number, index: number, value: ReadonlyVec4): void;
|
|
175
|
+
/**
|
|
176
|
+
* Narrows `value` to binary32 and writes its 4 components into `array` from
|
|
177
|
+
* element `offset` on, unrolled: the way to stage a vertex, instance or uniform
|
|
178
|
+
* value for the GPU, where `array.set` costs several times as much for one
|
|
179
|
+
* value. A component past the end of `array` writes nothing. O(1).
|
|
180
|
+
*/
|
|
181
|
+
export declare function vec4StoreFloat32(array: Float32Array, offset: number, value: ReadonlyVec4): void;
|
|
182
|
+
/**
|
|
183
|
+
* Whether every number of `array` is finite: the check for a buffer of vec4
|
|
184
|
+
* elements read from untrusted data or about to be uploaded. The length is not
|
|
185
|
+
* required to be a multiple of 4 (see `assertFiniteBuffer` for that). O(n).
|
|
186
|
+
*/
|
|
187
|
+
export declare function vec4ArrayIsFinite(array: Float64Array): boolean;
|
|
188
|
+
/**
|
|
189
|
+
* The inner product `Σ aᵢ·bᵢ`, in plain arithmetic: where the terms cancel its
|
|
190
|
+
* error can exceed the result, and {@link vec4DotPrecise} is the form to use
|
|
191
|
+
* there.
|
|
192
|
+
*/
|
|
193
|
+
export declare function vec4Dot(a: ReadonlyVec4, b: ReadonlyVec4): number;
|
|
194
|
+
/**
|
|
195
|
+
* The inner product with the rounding error of every product and every addition
|
|
196
|
+
* recovered and folded back in (Ogita–Rump–Oishi's compensated dot product,
|
|
197
|
+
* computed by `@ac-kit/math-scalar`'s `dotPrecise4`, which returns what
|
|
198
|
+
* `dotPrecise` does): as accurate as a dot product in doubled precision rounded
|
|
199
|
+
* once, so it survives the cancellation that leaves {@link vec4Dot} with none of
|
|
200
|
+
* its digits. A few times the cost of the plain form.
|
|
201
|
+
*/
|
|
202
|
+
export declare function vec4DotPrecise(a: ReadonlyVec4, b: ReadonlyVec4): number;
|
|
203
|
+
/**
|
|
204
|
+
* The length `√(Σ aᵢ²)`, right when the largest component lies between about
|
|
205
|
+
* `1e−150` and `1e150`. Beyond, the squares overflow (above about `1.3e154`),
|
|
206
|
+
* or underflow and lose their digits to the subnormal range (below about
|
|
207
|
+
* `1.5e−154`), and the result is `Infinity`, `0` or wrong: use
|
|
208
|
+
* {@link vec4LengthScaled}.
|
|
209
|
+
*/
|
|
210
|
+
export declare function vec4Length(a: ReadonlyVec4): number;
|
|
211
|
+
/**
|
|
212
|
+
* The squared length `Σ aᵢ²`, without the square root, right when the largest
|
|
213
|
+
* component lies between about `1e−150` and `1e150`: beyond, it overflows to
|
|
214
|
+
* `Infinity` or loses its digits to the subnormal range.
|
|
215
|
+
*/
|
|
216
|
+
export declare function vec4LengthSquared(a: ReadonlyVec4): number;
|
|
217
|
+
/**
|
|
218
|
+
* The length at any magnitude: every component is divided by the largest first,
|
|
219
|
+
* so the squares stay in range where {@link vec4Length} returns `0` or
|
|
220
|
+
* `Infinity` beyond about `1e±150`. Zero for the zero vector, `Infinity` for an
|
|
221
|
+
* infinite component, `NaN` for a `NaN` one. About three times the cost.
|
|
222
|
+
*/
|
|
223
|
+
export declare function vec4LengthScaled(a: ReadonlyVec4): number;
|
|
224
|
+
/** The Manhattan length `Σ |aᵢ|`: the distance along the axes. */
|
|
225
|
+
export declare function vec4LengthManhattan(a: ReadonlyVec4): number;
|
|
226
|
+
/** The Chebyshev length `max |aᵢ|`: the largest move along one axis. */
|
|
227
|
+
export declare function vec4LengthChebyshev(a: ReadonlyVec4): number;
|
|
228
|
+
/**
|
|
229
|
+
* The Euclidean distance `|a − b|`, right when the largest difference lies
|
|
230
|
+
* between about `1e−150` and `1e150`; beyond, the squares overflow or lose
|
|
231
|
+
* their digits as in {@link vec4Length}: take {@link vec4LengthScaled} of `a − b`
|
|
232
|
+
* (from {@link vec4Subtract}) instead.
|
|
233
|
+
*/
|
|
234
|
+
export declare function vec4Distance(a: ReadonlyVec4, b: ReadonlyVec4): number;
|
|
235
|
+
/**
|
|
236
|
+
* The squared distance `|a − b|²`, without the square root, right when the
|
|
237
|
+
* largest difference lies between about `1e−150` and `1e150`: beyond, it
|
|
238
|
+
* overflows to `Infinity` or loses its digits.
|
|
239
|
+
*/
|
|
240
|
+
export declare function vec4DistanceSquared(a: ReadonlyVec4, b: ReadonlyVec4): number;
|
|
241
|
+
/** The Manhattan distance `Σ |aᵢ − bᵢ|`: the distance along the axes. */
|
|
242
|
+
export declare function vec4DistanceManhattan(a: ReadonlyVec4, b: ReadonlyVec4): number;
|
|
243
|
+
/** The Chebyshev distance `max |aᵢ − bᵢ|`: the largest move along one axis. */
|
|
244
|
+
export declare function vec4DistanceChebyshev(a: ReadonlyVec4, b: ReadonlyVec4): number;
|
|
245
|
+
/**
|
|
246
|
+
* Writes `a / |a|` into `out`: the unit vector in the same direction, from one
|
|
247
|
+
* reciprocal of the length multiplied in. The zero vector stays zero, and a
|
|
248
|
+
* `NaN` component gives `NaN` throughout. Right when the largest component lies
|
|
249
|
+
* between about `1e−150` and `1e150`; beyond, the squared length overflows,
|
|
250
|
+
* underflows or loses its digits to the subnormal range, and the result is
|
|
251
|
+
* zeros or wrong: use {@link vec4NormalizeScaled}. `out` may be `a`.
|
|
252
|
+
*/
|
|
253
|
+
export declare function vec4Normalize(out: Vec4, a: ReadonlyVec4): Vec4;
|
|
254
|
+
/**
|
|
255
|
+
* Writes `a / |a|` into `out` at any magnitude, subnormal and near the largest
|
|
256
|
+
* binary64 included: the components are divided by the largest first, so the
|
|
257
|
+
* squares stay in range (see {@link vec4Normalize} for the plain form). The zero
|
|
258
|
+
* vector stays zero; `NaN` and infinite components give `NaN` throughout. About
|
|
259
|
+
* three times the cost. `out` may be `a`.
|
|
260
|
+
*/
|
|
261
|
+
export declare function vec4NormalizeScaled(out: Vec4, a: ReadonlyVec4): Vec4;
|
|
262
|
+
/**
|
|
263
|
+
* Writes `a` with its length limited to `[min, max]` into `out`, the direction
|
|
264
|
+
* kept. The zero vector stays zero whatever `min` is, a `min` above `max` gives
|
|
265
|
+
* `max`, and a `NaN` gives `NaN`. The length is that of {@link vec4Length}, so
|
|
266
|
+
* the result is right when the largest component lies between about `1e−150`
|
|
267
|
+
* and `1e150`. Beyond, a vector whose length overflows (components above about
|
|
268
|
+
* `1.3e154`) comes back as the zero vector instead of being limited to `max`,
|
|
269
|
+
* and one whose squares underflow (below about `1.5e−154`) comes back unchanged
|
|
270
|
+
* instead of being lengthened to `min`: limit {@link vec4LengthScaled} yourself
|
|
271
|
+
* and scale {@link vec4NormalizeScaled} by it. `out` may be `a`.
|
|
272
|
+
*/
|
|
273
|
+
export declare function vec4ClampLength(out: Vec4, a: ReadonlyVec4, min: number, max: number): Vec4;
|
|
274
|
+
/**
|
|
275
|
+
* Writes the projection of `a` onto the line along `onto`, `onto · (a·onto) /
|
|
276
|
+
* (onto·onto)`, into `out`. `onto` need not be a unit vector; a zero `onto`
|
|
277
|
+
* gives `NaN`. Right when the largest component of `onto` lies between about
|
|
278
|
+
* `1e−150` and `1e150`, where `onto·onto` stays in range: above about `1.3e154`
|
|
279
|
+
* it overflows and the projection is the zero vector, and below about
|
|
280
|
+
* `1.5e−154` it underflows and the result is not finite. Beyond, normalise
|
|
281
|
+
* `onto` with {@link vec4NormalizeScaled} first. `out` may be `a` or `onto`.
|
|
282
|
+
*/
|
|
283
|
+
export declare function vec4Project(out: Vec4, a: ReadonlyVec4, onto: ReadonlyVec4): Vec4;
|
|
284
|
+
/**
|
|
285
|
+
* Writes `a` minus its projection onto `onto` into `out`: the part of `a`
|
|
286
|
+
* perpendicular to `onto`. A zero `onto` gives `NaN`. Right when the largest
|
|
287
|
+
* component of `onto` lies between about `1e−150` and `1e150`, as for
|
|
288
|
+
* {@link vec4Project}: beyond, the result is `a` (the projection is zero) or not
|
|
289
|
+
* finite; normalise `onto` with {@link vec4NormalizeScaled} first. `out` may be
|
|
290
|
+
* `a` or `onto`.
|
|
291
|
+
*/
|
|
292
|
+
export declare function vec4Reject(out: Vec4, a: ReadonlyVec4, onto: ReadonlyVec4): Vec4;
|
|
293
|
+
/**
|
|
294
|
+
* Writes `a` mirrored across the plane whose normal is `normal`, `a −
|
|
295
|
+
* 2(a·normal)·normal`, into `out`. `normal` must be a unit vector: it is not
|
|
296
|
+
* normalised here. `out` may be `a` or `normal`.
|
|
297
|
+
*/
|
|
298
|
+
export declare function vec4Reflect(out: Vec4, a: ReadonlyVec4, normal: ReadonlyVec4): Vec4;
|
|
299
|
+
//# sourceMappingURL=vec4-componentwise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vec4-componentwise.d.ts","sourceRoot":"","sources":["../src/vec4-componentwise.ts"],"names":[],"mappings":"AAEA,OAAO,EAEN,KAAK,gBAAgB,EAGrB,KAAK,YAAY,EACjB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQpD;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAOjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAOvE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI,CAO/C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAC5B,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EACzB,MAAM,SAAI,GACR,IAAI,CAUN;AAED,mDAAmD;AACnD,wBAAgB,OAAO,CACtB,GAAG,EAAE,IAAI,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAA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