@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
package/dist/vec3.d.ts
CHANGED
|
@@ -1,91 +1,181 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
* result is in the range (-π, π].
|
|
16
|
-
*/
|
|
17
|
-
export declare function vec3AngleTo(v1: Vec3, v2: Vec3, axis: Vec3): number;
|
|
18
|
-
/**
|
|
19
|
-
* Computes the angle in radians between two 3D vectors. The result is in the
|
|
20
|
-
* range [0, π].
|
|
1
|
+
import { type RandomFn } from "@ac-kit/core";
|
|
2
|
+
import type { ReadonlyQuaternion } from "@ac-kit/math-complex";
|
|
3
|
+
import type { Brand_ } from "./_brand.js";
|
|
4
|
+
import type { ReadonlyAffine3 } from "./affine3.js";
|
|
5
|
+
import type { ReadonlyMat3x3 } from "./mat3x3.js";
|
|
6
|
+
import type { ReadonlyMat4x4 } from "./mat4x4.js";
|
|
7
|
+
import type { ReadonlyVec2 } from "./vec2.js";
|
|
8
|
+
import type { ReadonlyVec4 } from "./vec4.js";
|
|
9
|
+
/**
|
|
10
|
+
* A point, a vector, a size or a direction of space, stored as `[x, y, z]`: a
|
|
11
|
+
* plain array of three binary64 numbers carrying a type-level brand, so an
|
|
12
|
+
* array literal, a `number[]`, a `Float64Array` or a value of another type with
|
|
13
|
+
* three numbers is rejected where a `Vec3` is expected. A buffer of them is a
|
|
14
|
+
* `Float64Array` of `count × 3` numbers, element `i` at `[3i, 3i + 3)`.
|
|
21
15
|
*
|
|
22
|
-
* @
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
30
|
-
export declare function vec3ApplyMat4(v: Vec3, m: Mat4x4): Vec3;
|
|
31
|
-
export declare function vec3ApplyQuaternion(v: Vec3, q: Quaternion): Vec3;
|
|
32
|
-
export declare function vec3Clamp(v: Vec3, min: Vec3, max: Vec3): Vec3;
|
|
33
|
-
export declare function vec3ClampLength(v: Vec3, minLength: number, maxLength: number): Vec3;
|
|
34
|
-
export declare function vec3ClampScalar(v: Vec3, min: number, max: number): Vec3;
|
|
35
|
-
export declare function vec3Cross(a: Vec3, b: Vec3): Vec3;
|
|
36
|
-
export declare function vec3DistanceTo(a: Vec3, b: Vec3, type?: DistanceType): number;
|
|
37
|
-
export declare function vec3DistanceToSq(a: Vec3, b: Vec3): number;
|
|
38
|
-
export declare function vec3Divide(a: Vec3, b: Vec3): Vec3;
|
|
39
|
-
export declare function vec3DivideScalar(v: Vec3, s: number): Vec3;
|
|
40
|
-
export declare function vec3Dot(a: Vec3, b: Vec3): number;
|
|
41
|
-
/** Exact component-wise equality. See {@link vec3IsClose} for a tolerant test. */
|
|
42
|
-
export declare function vec3Equals(a: Vec3, b: Vec3): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Component-wise approximate equality.
|
|
16
|
+
* Only {@link vec3Create}, {@link vec3Of}, {@link vec3Clone},
|
|
17
|
+
* {@link vec3FromArray} and the functions that write an `out` make one. They
|
|
18
|
+
* all start from an array of non-integer doubles, so every `Vec3` is
|
|
19
|
+
* `PACKED_DOUBLE_ELEMENTS` in V8 even when its components are whole numbers,
|
|
20
|
+
* and the hot loops that read it stay monomorphic. An array literal such as
|
|
21
|
+
* `[1, 2, 3]` is an array of small integers instead, and storing one into a
|
|
22
|
+
* shared `out` turns it into a generic array for good.
|
|
45
23
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
export
|
|
54
|
-
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
export declare function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
*
|
|
68
|
-
|
|
24
|
+
* Rules for callers who bypass the types (JavaScript, casts, `any`): never
|
|
25
|
+
* store anything but a number in a vector, not even briefly; no holes, no
|
|
26
|
+
* `push`, no change of `length`; do not make one with `structuredClone` or
|
|
27
|
+
* `[...float64Array]` (use {@link vec3Clone}, {@link vec3Load},
|
|
28
|
+
* {@link vec3FromArray}); and never pass a `Float64Array` or a hand-made array
|
|
29
|
+
* where a `Vec3` is expected, even once, even in a test.
|
|
30
|
+
*/
|
|
31
|
+
export type Vec3 = [x: number, y: number, z: number] & Brand_<"Vec3">;
|
|
32
|
+
/** A {@link Vec3} that is only read. */
|
|
33
|
+
export type ReadonlyVec3 = readonly [x: number, y: number, z: number] & Brand_<"Vec3">;
|
|
34
|
+
/**
|
|
35
|
+
* Writes the cross product `a × b` into `out`, in plain arithmetic: a vector
|
|
36
|
+
* perpendicular to both, of length `|a||b| sin θ`, right-handed (`x × y = z`).
|
|
37
|
+
* Where a component's two terms cancel use {@link vec3CrossPrecise}. `out` may
|
|
38
|
+
* be `a` or `b`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function vec3Cross(out: Vec3, a: ReadonlyVec3, b: ReadonlyVec3): Vec3;
|
|
41
|
+
/**
|
|
42
|
+
* {@link vec3Cross} with the rounding of every product recovered
|
|
43
|
+
* (`@ac-kit/math-scalar`'s `diffOfProducts`): each component within 1.5 ULP of
|
|
44
|
+
* the exact value however badly its terms cancel. About five times the cost.
|
|
45
|
+
* `out` may be `a` or `b`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function vec3CrossPrecise(out: Vec3, a: ReadonlyVec3, b: ReadonlyVec3): Vec3;
|
|
48
|
+
/**
|
|
49
|
+
* The signed angle from `a` to `b`, positive counter-clockwise when seen from
|
|
50
|
+
* the tip of `axis` (the right-hand rule about `axis`), in `(−π, π]`: `π` for
|
|
51
|
+
* opposite vectors. `axis` need not be a unit vector, and only its side of the
|
|
52
|
+
* plane of `a` and `b` matters. Computed from the compensated cross and dot
|
|
53
|
+
* products, so the angle of nearly parallel vectors keeps its digits. A zero
|
|
54
|
+
* vector gives `0`. Right while the product of the two lengths lies between
|
|
55
|
+
* about `1e−150` and `1e150`, which keeps the squares of the cross product in
|
|
56
|
+
* range (vectors of `1e100` give `Infinity` there and a wrong angle); an angle
|
|
57
|
+
* does not depend on the lengths, so beyond, normalise both vectors with
|
|
58
|
+
* {@link vec3NormalizeScaled} first.
|
|
59
|
+
*/
|
|
60
|
+
export declare function vec3AngleTo(a: ReadonlyVec3, b: ReadonlyVec3, axis: ReadonlyVec3): number;
|
|
61
|
+
/**
|
|
62
|
+
* The unsigned angle between two vectors, `atan2(|a × b|, a · b)`, in `[0, π]`,
|
|
63
|
+
* from the compensated cross and dot products. A zero vector gives `0`. Right
|
|
64
|
+
* while the product of the two lengths lies between about `1e−150` and `1e150`,
|
|
65
|
+
* which keeps the squares of the cross product in range (vectors of `1e100`
|
|
66
|
+
* give a wrong angle); an angle does not depend on the lengths, so beyond,
|
|
67
|
+
* normalise both vectors with {@link vec3NormalizeScaled} first.
|
|
68
|
+
*/
|
|
69
|
+
export declare function vec3AngleBetween(a: ReadonlyVec3, b: ReadonlyVec3): number;
|
|
70
|
+
/**
|
|
71
|
+
* Writes `[a.x, a.y, z]` into `out`: the plane vector lifted to space.
|
|
69
72
|
*
|
|
70
|
-
*
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
export declare function
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
*
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
73
|
+
* @param z The third component; defaults to `0`.
|
|
74
|
+
*/
|
|
75
|
+
export declare function vec3FromVec2(out: Vec3, a: ReadonlyVec2, z?: number): Vec3;
|
|
76
|
+
/**
|
|
77
|
+
* Writes `[x, y, z] / w` into `out`: the Cartesian point of a homogeneous
|
|
78
|
+
* vector, the perspective divide. A `w` of zero (a point at infinity) gives
|
|
79
|
+
* non-finite components, `±Infinity` or `NaN`, not an exception.
|
|
80
|
+
*/
|
|
81
|
+
export declare function vec3FromHomogeneous(out: Vec3, a: ReadonlyVec4): Vec3;
|
|
82
|
+
/**
|
|
83
|
+
* Writes `a` rotated by `angle` radians about the unit vector `axis`
|
|
84
|
+
* (Rodrigues' formula), counter-clockwise seen from the tip of `axis`, into
|
|
85
|
+
* `out`. `axis` is not normalised here: a vector that is not unit scales the
|
|
86
|
+
* result. `out` may be `a` or `axis`.
|
|
87
|
+
*/
|
|
88
|
+
export declare function vec3RotateAxisAngle(out: Vec3, a: ReadonlyVec3, axis: ReadonlyVec3, angle: number): Vec3;
|
|
89
|
+
/**
|
|
90
|
+
* Writes a unit vector perpendicular to `a` into `out`: `a` crossed with the
|
|
91
|
+
* axis of its smallest component, normalised at any magnitude. The result is
|
|
92
|
+
* not unique; this one is stable, so a continuous input gives it a few jumps
|
|
93
|
+
* only. The zero vector stays zero. `out` may be `a`.
|
|
94
|
+
*/
|
|
95
|
+
export declare function vec3Perpendicular(out: Vec3, a: ReadonlyVec3): Vec3;
|
|
96
|
+
/**
|
|
97
|
+
* Writes the tangent and the bitangent that complete the unit vector `normal`
|
|
98
|
+
* to a right-handed orthonormal basis (`tangent × bitangent = normal`), by
|
|
99
|
+
* Duff, Burgess, Christensen, Hery, Kensler, Liani and Villemin's branch-light
|
|
100
|
+
* construction ("Building an Orthonormal Basis, Revisited", 2017): no
|
|
101
|
+
* normalisation and no singularity, whatever the direction of `normal`.
|
|
102
|
+
* `normal` is not normalised here. The outputs may be `normal`.
|
|
103
|
+
*/
|
|
104
|
+
export declare function vec3OrthonormalBasis(outTangent: Vec3, outBitangent: Vec3, normal: ReadonlyVec3): void;
|
|
105
|
+
/**
|
|
106
|
+
* Writes `a` minus its component along `normal` into `out`: `a` flattened onto
|
|
107
|
+
* the plane through the origin whose normal is `normal`. `normal` need not be a
|
|
108
|
+
* unit vector; a zero `normal` gives `NaN`. Right when the largest component of
|
|
109
|
+
* `normal` lies between about `1e−150` and `1e150`, where its squared length
|
|
110
|
+
* stays in range: above about `1.3e154` the result is `a` unflattened, and
|
|
111
|
+
* below about `1.5e−154` it is not finite. Beyond, normalise `normal` with
|
|
112
|
+
* {@link vec3NormalizeScaled} first. `out` may be `a` or `normal`.
|
|
113
|
+
*/
|
|
114
|
+
export declare function vec3ProjectOntoPlane(out: Vec3, a: ReadonlyVec3, normal: ReadonlyVec3): Vec3;
|
|
115
|
+
/**
|
|
116
|
+
* Writes `m · a` into `out`, the matrix applied to the column vector. `out` may
|
|
117
|
+
* be `a`.
|
|
118
|
+
*/
|
|
119
|
+
export declare function vec3TransformMat3x3(out: Vec3, a: ReadonlyVec3, m: ReadonlyMat3x3): Vec3;
|
|
120
|
+
/**
|
|
121
|
+
* {@link vec3TransformMat3x3} with each component a compensated dot product, as
|
|
122
|
+
* accurate as one in doubled precision rounded once. `out` may be `a`.
|
|
123
|
+
*/
|
|
124
|
+
export declare function vec3TransformMat3x3Precise(out: Vec3, a: ReadonlyVec3, m: ReadonlyMat3x3): Vec3;
|
|
125
|
+
/**
|
|
126
|
+
* Writes the point `a` (as `[x, y, z, 1]`) transformed by `m` into `out`,
|
|
127
|
+
* divided by the resulting `w`, as gl-matrix and three.js do: for an affine
|
|
128
|
+
* matrix `w` is exactly `1` and nothing changes, for a projection this is the
|
|
129
|
+
* perspective divide. A `w` of zero gives non-finite components, not an
|
|
130
|
+
* exception. `out` may be `a`.
|
|
131
|
+
*/
|
|
132
|
+
export declare function vec3TransformMat4x4(out: Vec3, a: ReadonlyVec3, m: ReadonlyMat4x4): Vec3;
|
|
133
|
+
/**
|
|
134
|
+
* Writes the direction `a` transformed by the upper-left 3×3 part of `m`, with
|
|
135
|
+
* no translation and no divide, into `out`. `out` may be `a`.
|
|
136
|
+
*/
|
|
137
|
+
export declare function vec3TransformDirectionMat4x4(out: Vec3, a: ReadonlyVec3, m: ReadonlyMat4x4): Vec3;
|
|
138
|
+
/**
|
|
139
|
+
* Writes the point `a` transformed by the affine transform (the linear part
|
|
140
|
+
* applied, then the translation added) into `out`. `out` may be `a`.
|
|
141
|
+
*/
|
|
142
|
+
export declare function vec3TransformAffine3(out: Vec3, a: ReadonlyVec3, transform: ReadonlyAffine3): Vec3;
|
|
143
|
+
/**
|
|
144
|
+
* Writes the direction `a` transformed by the linear part of the affine
|
|
145
|
+
* transform, with no translation, into `out`. `out` may be `a`.
|
|
146
|
+
*/
|
|
147
|
+
export declare function vec3TransformDirectionAffine3(out: Vec3, a: ReadonlyVec3, transform: ReadonlyAffine3): Vec3;
|
|
148
|
+
/**
|
|
149
|
+
* Writes `a` rotated by the unit quaternion `q` into `out`: `q · a · q⁻¹` in 18
|
|
150
|
+
* multiplications, no matrix. `q` must be unit length; it is not normalised
|
|
151
|
+
* here. `out` may be `a`.
|
|
152
|
+
*/
|
|
153
|
+
export declare function vec3TransformQuaternion(out: Vec3, a: ReadonlyVec3, q: ReadonlyQuaternion): Vec3;
|
|
154
|
+
/**
|
|
155
|
+
* Writes the interpolation of `a` and `b` along the great circle into `out`:
|
|
156
|
+
* the direction turns at constant angular speed along the shorter arc, and the
|
|
157
|
+
* length is interpolated linearly. The inputs need not be unit vectors. For `t`
|
|
158
|
+
* in `[0, 1]` and nearly parallel directions (about 1.8° apart or less) the
|
|
159
|
+
* directions are interpolated linearly and normalised, which traces the same
|
|
160
|
+
* arc. The arc lies in the plane of the two vectors, however close to opposite
|
|
161
|
+
* they are (`(1, 0, 0)` to `(−1, 0, 10⁻⁹)` passes through `+z`); for exactly
|
|
162
|
+
* opposite directions, where every great circle is as short, it turns about the
|
|
163
|
+
* axis of {@link vec3Perpendicular} of `a`. The length is interpolated all the
|
|
164
|
+
* same, so `t = 0.5` of opposite vectors has the mean length, never the origin
|
|
165
|
+
* that a straight line between them would give. `t` outside `[0, 1]`
|
|
166
|
+
* extrapolates along the same circle at the same angular speed. A zero vector
|
|
167
|
+
* has no direction: the result is `NaN`. The axis is the cross product of the
|
|
168
|
+
* vectors themselves, accurately rounded, so a pair that is a rounding away
|
|
169
|
+
* from opposite still turns in its own plane; lengths are taken at any
|
|
170
|
+
* magnitude, so vectors of `1e±200` slerp as well. `out` may be `a` or `b`.
|
|
171
|
+
*/
|
|
172
|
+
export declare function vec3Slerp(out: Vec3, a: ReadonlyVec3, b: ReadonlyVec3, t: number): Vec3;
|
|
173
|
+
/**
|
|
174
|
+
* Writes a unit vector in a uniformly random direction (uniform on the sphere:
|
|
175
|
+
* `z` uniform in `[−1, 1]`, the azimuth uniform in `[0, 2π)`) into `out`.
|
|
176
|
+
*
|
|
177
|
+
* @param out The vector to fill.
|
|
178
|
+
* @param random A source of numbers in `[0, 1)`; defaults to `Math.random`.
|
|
179
|
+
*/
|
|
180
|
+
export declare function vec3Random(out: Vec3, random?: RandomFn): Vec3;
|
|
91
181
|
//# sourceMappingURL=vec3.d.ts.map
|
package/dist/vec3.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vec3.d.ts","sourceRoot":"","sources":["../src/vec3.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"vec3.d.ts","sourceRoot":"","sources":["../src/vec3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAqB,MAAM,cAAc,CAAC;AAChF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAS/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAM9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,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