@vertexvis/geometry 0.24.5-canary.6 → 1.0.0-testing.1
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/dist/angle.d.ts +35 -35
- package/dist/boundingBox.d.ts +49 -49
- package/dist/boundingSphere.d.ts +14 -14
- package/dist/bundle.cjs.js +2148 -2148
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +2148 -2148
- package/dist/bundle.esm.js.map +1 -1
- package/dist/cdn/bundle.esm.js +2149 -2183
- package/dist/cdn/bundle.esm.js.map +1 -1
- package/dist/cdn/bundle.esm.min.js +1 -15
- package/dist/cdn/bundle.esm.min.js.map +1 -1
- package/dist/dimensions.d.ts +94 -94
- package/dist/euler.d.ts +57 -57
- package/dist/index.d.ts +21 -21
- package/dist/line3.d.ts +48 -48
- package/dist/math.d.ts +20 -20
- package/dist/matrix.d.ts +73 -73
- package/dist/matrix2.d.ts +29 -29
- package/dist/matrix4.d.ts +285 -285
- package/dist/plane.d.ts +51 -51
- package/dist/point.d.ts +80 -80
- package/dist/quaternion.d.ts +65 -65
- package/dist/ray.d.ts +52 -52
- package/dist/rectangle.d.ts +125 -125
- package/dist/vector3.d.ts +226 -226
- package/dist/vector4.d.ts +23 -23
- package/package.json +10 -10
- package/dist/cdn/__tests__/angle.test.d.ts +0 -1
- package/dist/cdn/__tests__/boundingBox.test.d.ts +0 -1
- package/dist/cdn/__tests__/boundingSphere.test.d.ts +0 -1
- package/dist/cdn/__tests__/dimensions.test.d.ts +0 -1
- package/dist/cdn/__tests__/euler.test.d.ts +0 -1
- package/dist/cdn/__tests__/line3.test.d.ts +0 -1
- package/dist/cdn/__tests__/math.spec.d.ts +0 -1
- package/dist/cdn/__tests__/matrix.test.d.ts +0 -1
- package/dist/cdn/__tests__/matrix2.test.d.ts +0 -1
- package/dist/cdn/__tests__/matrix4.test.d.ts +0 -1
- package/dist/cdn/__tests__/plane.test.d.ts +0 -1
- package/dist/cdn/__tests__/point.test.d.ts +0 -1
- package/dist/cdn/__tests__/quaternion.test.d.ts +0 -1
- package/dist/cdn/__tests__/ray.test.d.ts +0 -1
- package/dist/cdn/__tests__/rectangle.test.d.ts +0 -1
- package/dist/cdn/__tests__/vector3.test.d.ts +0 -1
- package/dist/cdn/__tests__/vector4.test.d.ts +0 -1
- package/dist/cdn/angle.d.ts +0 -35
- package/dist/cdn/boundingBox.d.ts +0 -49
- package/dist/cdn/boundingSphere.d.ts +0 -14
- package/dist/cdn/dimensions.d.ts +0 -94
- package/dist/cdn/euler.d.ts +0 -57
- package/dist/cdn/index.d.ts +0 -21
- package/dist/cdn/line3.d.ts +0 -48
- package/dist/cdn/math.d.ts +0 -20
- package/dist/cdn/matrix.d.ts +0 -73
- package/dist/cdn/matrix2.d.ts +0 -29
- package/dist/cdn/matrix4.d.ts +0 -285
- package/dist/cdn/plane.d.ts +0 -51
- package/dist/cdn/point.d.ts +0 -80
- package/dist/cdn/quaternion.d.ts +0 -65
- package/dist/cdn/ray.d.ts +0 -52
- package/dist/cdn/rectangle.d.ts +0 -125
- package/dist/cdn/vector3.d.ts +0 -226
- package/dist/cdn/vector4.d.ts +0 -23
package/dist/plane.d.ts
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import * as Line3 from './line3';
|
|
2
|
-
import * as Vector3 from './vector3';
|
|
3
|
-
/**
|
|
4
|
-
* A two dimensional surface in 3D space that extends indefinitely. Represented
|
|
5
|
-
* as a direction normal and distance.
|
|
6
|
-
*/
|
|
7
|
-
export interface Plane {
|
|
8
|
-
normal: Vector3.Vector3;
|
|
9
|
-
constant: number;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new plane. Defaults to a normal of `[0,0,0]` and constant of `0`.
|
|
13
|
-
*
|
|
14
|
-
* @param values Values to assign to the plane.
|
|
15
|
-
* @returns A new plane.
|
|
16
|
-
*/
|
|
17
|
-
export declare function create(values?: Partial<Plane>): Plane;
|
|
18
|
-
/**
|
|
19
|
-
* Creates a plane from a normal and an arbitrary point on a plane.
|
|
20
|
-
*
|
|
21
|
-
* @param normal A normal.
|
|
22
|
-
* @param point A point on the plane.
|
|
23
|
-
* @returns A new plane.
|
|
24
|
-
*/
|
|
25
|
-
export declare function fromNormalAndCoplanarPoint(normal: Vector3.Vector3, point: Vector3.Vector3): Plane;
|
|
26
|
-
/**
|
|
27
|
-
* Returns the perpendicular distance from the plane to the given point.
|
|
28
|
-
*
|
|
29
|
-
* @param plane The plane.
|
|
30
|
-
* @param point The point to calculate distance from `plane`.
|
|
31
|
-
* @returns A distance.
|
|
32
|
-
*/
|
|
33
|
-
export declare function distanceToPoint(plane: Plane, point: Vector3.Vector3): number;
|
|
34
|
-
/**
|
|
35
|
-
* Returns the point where the line intersects with this plane. If the line does
|
|
36
|
-
* not intersect, then `undefined` is returned. If the line is on the plane,
|
|
37
|
-
* then the starting point of the line is returned.
|
|
38
|
-
*
|
|
39
|
-
* @param plane The plane to intersect.
|
|
40
|
-
* @param line The line to intersect.
|
|
41
|
-
* @returns An intersecting point on the plane and line.
|
|
42
|
-
*/
|
|
43
|
-
export declare function intersectLine(plane: Plane, line: Line3.Line3): Vector3.Vector3 | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Projects the given `point` onto the given `plane`.
|
|
46
|
-
*
|
|
47
|
-
* @param plane The plane to project onto.
|
|
48
|
-
* @param point The point to project.
|
|
49
|
-
* @returns The projected point.
|
|
50
|
-
*/
|
|
51
|
-
export declare function projectPoint(plane: Plane, point: Vector3.Vector3): Vector3.Vector3;
|
|
1
|
+
import * as Line3 from './line3';
|
|
2
|
+
import * as Vector3 from './vector3';
|
|
3
|
+
/**
|
|
4
|
+
* A two dimensional surface in 3D space that extends indefinitely. Represented
|
|
5
|
+
* as a direction normal and distance.
|
|
6
|
+
*/
|
|
7
|
+
export interface Plane {
|
|
8
|
+
normal: Vector3.Vector3;
|
|
9
|
+
constant: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new plane. Defaults to a normal of `[0,0,0]` and constant of `0`.
|
|
13
|
+
*
|
|
14
|
+
* @param values Values to assign to the plane.
|
|
15
|
+
* @returns A new plane.
|
|
16
|
+
*/
|
|
17
|
+
export declare function create(values?: Partial<Plane>): Plane;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a plane from a normal and an arbitrary point on a plane.
|
|
20
|
+
*
|
|
21
|
+
* @param normal A normal.
|
|
22
|
+
* @param point A point on the plane.
|
|
23
|
+
* @returns A new plane.
|
|
24
|
+
*/
|
|
25
|
+
export declare function fromNormalAndCoplanarPoint(normal: Vector3.Vector3, point: Vector3.Vector3): Plane;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the perpendicular distance from the plane to the given point.
|
|
28
|
+
*
|
|
29
|
+
* @param plane The plane.
|
|
30
|
+
* @param point The point to calculate distance from `plane`.
|
|
31
|
+
* @returns A distance.
|
|
32
|
+
*/
|
|
33
|
+
export declare function distanceToPoint(plane: Plane, point: Vector3.Vector3): number;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the point where the line intersects with this plane. If the line does
|
|
36
|
+
* not intersect, then `undefined` is returned. If the line is on the plane,
|
|
37
|
+
* then the starting point of the line is returned.
|
|
38
|
+
*
|
|
39
|
+
* @param plane The plane to intersect.
|
|
40
|
+
* @param line The line to intersect.
|
|
41
|
+
* @returns An intersecting point on the plane and line.
|
|
42
|
+
*/
|
|
43
|
+
export declare function intersectLine(plane: Plane, line: Line3.Line3): Vector3.Vector3 | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Projects the given `point` onto the given `plane`.
|
|
46
|
+
*
|
|
47
|
+
* @param plane The plane to project onto.
|
|
48
|
+
* @param point The point to project.
|
|
49
|
+
* @returns The projected point.
|
|
50
|
+
*/
|
|
51
|
+
export declare function projectPoint(plane: Plane, point: Vector3.Vector3): Vector3.Vector3;
|
package/dist/point.d.ts
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import * as Angle from './angle';
|
|
2
|
-
/**
|
|
3
|
-
* A `Point` represents a cartesian coordinate with a horizontal and vertical
|
|
4
|
-
* position or length.
|
|
5
|
-
*/
|
|
6
|
-
export interface Point {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Returns a new `Point` with the given horizontal and vertical position.
|
|
12
|
-
*/
|
|
13
|
-
export declare function create(x?: number, y?: number): Point;
|
|
14
|
-
/**
|
|
15
|
-
* Converts a polar coordinate (length and angle) into a Cartesian coordinate.
|
|
16
|
-
*/
|
|
17
|
-
export declare function polar(length: number, radians: Angle.Angle): Point;
|
|
18
|
-
/**
|
|
19
|
-
* Returns the distance between two points.
|
|
20
|
-
*/
|
|
21
|
-
export declare function distance(a: Point, b: Point): number;
|
|
22
|
-
/**
|
|
23
|
-
* Returns a new `Point` where `b` is subtracted from `a`.
|
|
24
|
-
*/
|
|
25
|
-
export declare function subtract(a: Point, b: Point): Point;
|
|
26
|
-
/**
|
|
27
|
-
* Returns a new `Point` where `b` is added to `a`.
|
|
28
|
-
*/
|
|
29
|
-
export declare function add(a: Point, b: Point): Point;
|
|
30
|
-
/**
|
|
31
|
-
* Returns `true` if the `x` and `y` positions of `a` and `b` are equal.
|
|
32
|
-
*/
|
|
33
|
-
export declare function isEqual(a: Point, b: Point): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Performs a linear interpolation between `a` and `b` and returns the result.
|
|
36
|
-
* The value of `t` is clamped between `[0, 1]`.
|
|
37
|
-
*
|
|
38
|
-
* @param a The start value.
|
|
39
|
-
* @param b The end value.
|
|
40
|
-
* @param t A value between 0 and 1.
|
|
41
|
-
* @returns A point between `a` and `b`.
|
|
42
|
-
*/
|
|
43
|
-
export declare function lerp(a: Point, b: Point, t: number): Point;
|
|
44
|
-
/**
|
|
45
|
-
* Returns a new `Point` where `x` and `y` are inverted.
|
|
46
|
-
*/
|
|
47
|
-
export declare function negate(pt: Point): Point;
|
|
48
|
-
/**
|
|
49
|
-
* Returns a new `Point` where `x` and `y` are multiplied by the given scale
|
|
50
|
-
* factors.
|
|
51
|
-
*/
|
|
52
|
-
export declare function scale(pt: Point, scaleX: number, scaleY: number): Point;
|
|
53
|
-
/**
|
|
54
|
-
* Returns a new `Point` where `x` and `y` are multiplied by the given scale
|
|
55
|
-
* factor.
|
|
56
|
-
*/
|
|
57
|
-
export declare function scaleProportional(pt: Point, scale: number): Point;
|
|
58
|
-
/**
|
|
59
|
-
* Returns the magnitude of a point.
|
|
60
|
-
*/
|
|
61
|
-
export declare function magnitude(pt: Point): number;
|
|
62
|
-
/**
|
|
63
|
-
* Transforms a vector into the corresponding normal (unit) vector.
|
|
64
|
-
*/
|
|
65
|
-
export declare function normalizeVector(pt: Point): Point;
|
|
66
|
-
/**
|
|
67
|
-
* Returns a new normal (unit) vector pointing between the two given points.
|
|
68
|
-
*/
|
|
69
|
-
export declare function normalDirectionVector(ptA: Point, ptB: Point): Point;
|
|
70
|
-
/**
|
|
71
|
-
* Returns a vector orthogonal to the vector between the two given points.
|
|
72
|
-
*/
|
|
73
|
-
export declare function orthogonalVector(ptA: Point, ptB: Point): Point;
|
|
74
|
-
/**
|
|
75
|
-
* Parses a JSON string representation of a Point and returns an object.
|
|
76
|
-
*
|
|
77
|
-
* @param json A JSON string, either in the form `[x,y]` or `{"x": 0, "y": 0}`
|
|
78
|
-
* @returns A parsed Point.
|
|
79
|
-
*/
|
|
80
|
-
export declare function fromJson(json: string): Point;
|
|
1
|
+
import * as Angle from './angle';
|
|
2
|
+
/**
|
|
3
|
+
* A `Point` represents a cartesian coordinate with a horizontal and vertical
|
|
4
|
+
* position or length.
|
|
5
|
+
*/
|
|
6
|
+
export interface Point {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Returns a new `Point` with the given horizontal and vertical position.
|
|
12
|
+
*/
|
|
13
|
+
export declare function create(x?: number, y?: number): Point;
|
|
14
|
+
/**
|
|
15
|
+
* Converts a polar coordinate (length and angle) into a Cartesian coordinate.
|
|
16
|
+
*/
|
|
17
|
+
export declare function polar(length: number, radians: Angle.Angle): Point;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the distance between two points.
|
|
20
|
+
*/
|
|
21
|
+
export declare function distance(a: Point, b: Point): number;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a new `Point` where `b` is subtracted from `a`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function subtract(a: Point, b: Point): Point;
|
|
26
|
+
/**
|
|
27
|
+
* Returns a new `Point` where `b` is added to `a`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function add(a: Point, b: Point): Point;
|
|
30
|
+
/**
|
|
31
|
+
* Returns `true` if the `x` and `y` positions of `a` and `b` are equal.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isEqual(a: Point, b: Point): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Performs a linear interpolation between `a` and `b` and returns the result.
|
|
36
|
+
* The value of `t` is clamped between `[0, 1]`.
|
|
37
|
+
*
|
|
38
|
+
* @param a The start value.
|
|
39
|
+
* @param b The end value.
|
|
40
|
+
* @param t A value between 0 and 1.
|
|
41
|
+
* @returns A point between `a` and `b`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function lerp(a: Point, b: Point, t: number): Point;
|
|
44
|
+
/**
|
|
45
|
+
* Returns a new `Point` where `x` and `y` are inverted.
|
|
46
|
+
*/
|
|
47
|
+
export declare function negate(pt: Point): Point;
|
|
48
|
+
/**
|
|
49
|
+
* Returns a new `Point` where `x` and `y` are multiplied by the given scale
|
|
50
|
+
* factors.
|
|
51
|
+
*/
|
|
52
|
+
export declare function scale(pt: Point, scaleX: number, scaleY: number): Point;
|
|
53
|
+
/**
|
|
54
|
+
* Returns a new `Point` where `x` and `y` are multiplied by the given scale
|
|
55
|
+
* factor.
|
|
56
|
+
*/
|
|
57
|
+
export declare function scaleProportional(pt: Point, scale: number): Point;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the magnitude of a point.
|
|
60
|
+
*/
|
|
61
|
+
export declare function magnitude(pt: Point): number;
|
|
62
|
+
/**
|
|
63
|
+
* Transforms a vector into the corresponding normal (unit) vector.
|
|
64
|
+
*/
|
|
65
|
+
export declare function normalizeVector(pt: Point): Point;
|
|
66
|
+
/**
|
|
67
|
+
* Returns a new normal (unit) vector pointing between the two given points.
|
|
68
|
+
*/
|
|
69
|
+
export declare function normalDirectionVector(ptA: Point, ptB: Point): Point;
|
|
70
|
+
/**
|
|
71
|
+
* Returns a vector orthogonal to the vector between the two given points.
|
|
72
|
+
*/
|
|
73
|
+
export declare function orthogonalVector(ptA: Point, ptB: Point): Point;
|
|
74
|
+
/**
|
|
75
|
+
* Parses a JSON string representation of a Point and returns an object.
|
|
76
|
+
*
|
|
77
|
+
* @param json A JSON string, either in the form `[x,y]` or `{"x": 0, "y": 0}`
|
|
78
|
+
* @returns A parsed Point.
|
|
79
|
+
*/
|
|
80
|
+
export declare function fromJson(json: string): Point;
|
package/dist/quaternion.d.ts
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import * as Euler from './euler';
|
|
2
|
-
import * as Matrix4 from './matrix4';
|
|
3
|
-
import * as Vector3 from './vector3';
|
|
4
|
-
/**
|
|
5
|
-
* A type that represents a
|
|
6
|
-
* [quaternion](http://en.wikipedia.org/wiki/Quaternion). Quaternions are used
|
|
7
|
-
* in 3D graphics to represent
|
|
8
|
-
* [rotations](https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation).
|
|
9
|
-
*/
|
|
10
|
-
export interface Quaternion {
|
|
11
|
-
x: number;
|
|
12
|
-
y: number;
|
|
13
|
-
z: number;
|
|
14
|
-
w: number;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* An array representation of a `Quaternion`.
|
|
18
|
-
*/
|
|
19
|
-
export
|
|
20
|
-
/**
|
|
21
|
-
* Returns a new quaternion. If `value` is undefined, then `{x: 0, y: 0, z: 0,
|
|
22
|
-
* w: 1}` is returned.
|
|
23
|
-
*/
|
|
24
|
-
export declare function create(value?: Partial<Quaternion>): Quaternion;
|
|
25
|
-
/**
|
|
26
|
-
* Parses a JSON string representation of a `Quaternion`.
|
|
27
|
-
*
|
|
28
|
-
* @param json A JSON string either in the form of `[x, y, z, w]` or `{"x": 0, "y": 0, "z": 0, "w": 0}`.
|
|
29
|
-
* @returns A parsed `Quaternion`.
|
|
30
|
-
*/
|
|
31
|
-
export declare function fromJson(json: string): Quaternion;
|
|
32
|
-
/**
|
|
33
|
-
* Returns a quaternion with that will have a magnitude of 1.
|
|
34
|
-
*/
|
|
35
|
-
export declare function normalize(q: Quaternion): Quaternion;
|
|
36
|
-
/**
|
|
37
|
-
* Returns the magnitude of the provided quaternion.
|
|
38
|
-
*/
|
|
39
|
-
export declare function magnitude(q: Quaternion): number;
|
|
40
|
-
/**
|
|
41
|
-
* Returns a quaternion where each component is multiplied by the `scalar`.
|
|
42
|
-
*/
|
|
43
|
-
export declare function scale(scalar: number, q: Quaternion): Quaternion;
|
|
44
|
-
/**
|
|
45
|
-
* Creates a `Quaternion` that is rotated the given radians around an axis.
|
|
46
|
-
*
|
|
47
|
-
* @param axis The axis to rotate around.
|
|
48
|
-
* @param radians The rotation, in radians.
|
|
49
|
-
* @returns A rotated quaternion.
|
|
50
|
-
*/
|
|
51
|
-
export declare function fromAxisAngle(axis: Vector3.Vector3, radians: number): Quaternion;
|
|
52
|
-
/**
|
|
53
|
-
* Returns a quaternion using the upper 3x3 of a pure rotation matrix
|
|
54
|
-
* (unscaled).
|
|
55
|
-
*/
|
|
56
|
-
export declare function fromMatrixRotation(matrix: Matrix4.Matrix4): Quaternion;
|
|
57
|
-
export declare function fromEuler(euler: Euler.Euler): Quaternion;
|
|
58
|
-
/**
|
|
59
|
-
* Multiplies `a` x `b` and returns a new quaternion with the result.
|
|
60
|
-
*/
|
|
61
|
-
export declare function multiply(a: Quaternion, b: Quaternion): Quaternion;
|
|
62
|
-
/**
|
|
63
|
-
* Type guard that checks if the given type is a Quaternion.
|
|
64
|
-
*/
|
|
65
|
-
export declare function isType(obj: unknown): obj is Quaternion;
|
|
1
|
+
import * as Euler from './euler';
|
|
2
|
+
import * as Matrix4 from './matrix4';
|
|
3
|
+
import * as Vector3 from './vector3';
|
|
4
|
+
/**
|
|
5
|
+
* A type that represents a
|
|
6
|
+
* [quaternion](http://en.wikipedia.org/wiki/Quaternion). Quaternions are used
|
|
7
|
+
* in 3D graphics to represent
|
|
8
|
+
* [rotations](https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation).
|
|
9
|
+
*/
|
|
10
|
+
export interface Quaternion {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
z: number;
|
|
14
|
+
w: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* An array representation of a `Quaternion`.
|
|
18
|
+
*/
|
|
19
|
+
export type QuaternionAsArray = [x: number, y: number, z: number, w: number];
|
|
20
|
+
/**
|
|
21
|
+
* Returns a new quaternion. If `value` is undefined, then `{x: 0, y: 0, z: 0,
|
|
22
|
+
* w: 1}` is returned.
|
|
23
|
+
*/
|
|
24
|
+
export declare function create(value?: Partial<Quaternion>): Quaternion;
|
|
25
|
+
/**
|
|
26
|
+
* Parses a JSON string representation of a `Quaternion`.
|
|
27
|
+
*
|
|
28
|
+
* @param json A JSON string either in the form of `[x, y, z, w]` or `{"x": 0, "y": 0, "z": 0, "w": 0}`.
|
|
29
|
+
* @returns A parsed `Quaternion`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function fromJson(json: string): Quaternion;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a quaternion with that will have a magnitude of 1.
|
|
34
|
+
*/
|
|
35
|
+
export declare function normalize(q: Quaternion): Quaternion;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the magnitude of the provided quaternion.
|
|
38
|
+
*/
|
|
39
|
+
export declare function magnitude(q: Quaternion): number;
|
|
40
|
+
/**
|
|
41
|
+
* Returns a quaternion where each component is multiplied by the `scalar`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function scale(scalar: number, q: Quaternion): Quaternion;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a `Quaternion` that is rotated the given radians around an axis.
|
|
46
|
+
*
|
|
47
|
+
* @param axis The axis to rotate around.
|
|
48
|
+
* @param radians The rotation, in radians.
|
|
49
|
+
* @returns A rotated quaternion.
|
|
50
|
+
*/
|
|
51
|
+
export declare function fromAxisAngle(axis: Vector3.Vector3, radians: number): Quaternion;
|
|
52
|
+
/**
|
|
53
|
+
* Returns a quaternion using the upper 3x3 of a pure rotation matrix
|
|
54
|
+
* (unscaled).
|
|
55
|
+
*/
|
|
56
|
+
export declare function fromMatrixRotation(matrix: Matrix4.Matrix4): Quaternion;
|
|
57
|
+
export declare function fromEuler(euler: Euler.Euler): Quaternion;
|
|
58
|
+
/**
|
|
59
|
+
* Multiplies `a` x `b` and returns a new quaternion with the result.
|
|
60
|
+
*/
|
|
61
|
+
export declare function multiply(a: Quaternion, b: Quaternion): Quaternion;
|
|
62
|
+
/**
|
|
63
|
+
* Type guard that checks if the given type is a Quaternion.
|
|
64
|
+
*/
|
|
65
|
+
export declare function isType(obj: unknown): obj is Quaternion;
|
package/dist/ray.d.ts
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import * as Plane from './plane';
|
|
2
|
-
import * as Vector3 from './vector3';
|
|
3
|
-
/**
|
|
4
|
-
* A `Ray` represents an infinite line starting at `origin` and going in
|
|
5
|
-
* `direction`.
|
|
6
|
-
*/
|
|
7
|
-
export interface Ray {
|
|
8
|
-
/**
|
|
9
|
-
* The origin point of the ray.
|
|
10
|
-
*/
|
|
11
|
-
origin: Vector3.Vector3;
|
|
12
|
-
/**
|
|
13
|
-
* A normal that describes the direction of the ray from origin.
|
|
14
|
-
*/
|
|
15
|
-
direction: Vector3.Vector3;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new ray with the given values, or using default values if none are
|
|
19
|
-
* provided. The direction defaults to `{x: 0, y: 0, z: -1}` if undefined.
|
|
20
|
-
*
|
|
21
|
-
* @param value The values of the ray.
|
|
22
|
-
* @returns A new ray.
|
|
23
|
-
*/
|
|
24
|
-
export declare function create(value?: Partial<Ray>): Ray;
|
|
25
|
-
/**
|
|
26
|
-
* Returns a point at the given distance along this ray.
|
|
27
|
-
*
|
|
28
|
-
* @param ray The ray to get the point on.
|
|
29
|
-
* @param distance A distance from origin along the ray's direction.
|
|
30
|
-
* @returns A point on the ray.
|
|
31
|
-
*/
|
|
32
|
-
export declare function at(ray: Ray, distance: number): Vector3.Vector3;
|
|
33
|
-
/**
|
|
34
|
-
* Computes the distance of the `ray`s origin to the given `plane`. Returns a
|
|
35
|
-
* distance of 0 if the ray is coplanar and returns `undefined` if the ray does
|
|
36
|
-
* not intersect with the plane.
|
|
37
|
-
*
|
|
38
|
-
* @param ray The ray to get the distance for.
|
|
39
|
-
* @param plane The plane to compute the distance to.
|
|
40
|
-
* @returns The distance to the plane, or `undefined` if it cannot be computed.
|
|
41
|
-
*/
|
|
42
|
-
export declare function distanceToPlane(ray: Ray, plane: Plane.Plane): number | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Computes the intersection point of the given `ray` to the given `plane`. If
|
|
45
|
-
* the ray does not intersect with the plane, then `undefined` is returned.
|
|
46
|
-
*
|
|
47
|
-
* @param ray The ray to intersect.
|
|
48
|
-
* @param plane The plane to intersect with.
|
|
49
|
-
* @returns The intersection point, or `undefined` if the ray does not
|
|
50
|
-
* intersect.
|
|
51
|
-
*/
|
|
52
|
-
export declare function intersectPlane(ray: Ray, plane: Plane.Plane): Vector3.Vector3 | undefined;
|
|
1
|
+
import * as Plane from './plane';
|
|
2
|
+
import * as Vector3 from './vector3';
|
|
3
|
+
/**
|
|
4
|
+
* A `Ray` represents an infinite line starting at `origin` and going in
|
|
5
|
+
* `direction`.
|
|
6
|
+
*/
|
|
7
|
+
export interface Ray {
|
|
8
|
+
/**
|
|
9
|
+
* The origin point of the ray.
|
|
10
|
+
*/
|
|
11
|
+
origin: Vector3.Vector3;
|
|
12
|
+
/**
|
|
13
|
+
* A normal that describes the direction of the ray from origin.
|
|
14
|
+
*/
|
|
15
|
+
direction: Vector3.Vector3;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new ray with the given values, or using default values if none are
|
|
19
|
+
* provided. The direction defaults to `{x: 0, y: 0, z: -1}` if undefined.
|
|
20
|
+
*
|
|
21
|
+
* @param value The values of the ray.
|
|
22
|
+
* @returns A new ray.
|
|
23
|
+
*/
|
|
24
|
+
export declare function create(value?: Partial<Ray>): Ray;
|
|
25
|
+
/**
|
|
26
|
+
* Returns a point at the given distance along this ray.
|
|
27
|
+
*
|
|
28
|
+
* @param ray The ray to get the point on.
|
|
29
|
+
* @param distance A distance from origin along the ray's direction.
|
|
30
|
+
* @returns A point on the ray.
|
|
31
|
+
*/
|
|
32
|
+
export declare function at(ray: Ray, distance: number): Vector3.Vector3;
|
|
33
|
+
/**
|
|
34
|
+
* Computes the distance of the `ray`s origin to the given `plane`. Returns a
|
|
35
|
+
* distance of 0 if the ray is coplanar and returns `undefined` if the ray does
|
|
36
|
+
* not intersect with the plane.
|
|
37
|
+
*
|
|
38
|
+
* @param ray The ray to get the distance for.
|
|
39
|
+
* @param plane The plane to compute the distance to.
|
|
40
|
+
* @returns The distance to the plane, or `undefined` if it cannot be computed.
|
|
41
|
+
*/
|
|
42
|
+
export declare function distanceToPlane(ray: Ray, plane: Plane.Plane): number | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Computes the intersection point of the given `ray` to the given `plane`. If
|
|
45
|
+
* the ray does not intersect with the plane, then `undefined` is returned.
|
|
46
|
+
*
|
|
47
|
+
* @param ray The ray to intersect.
|
|
48
|
+
* @param plane The plane to intersect with.
|
|
49
|
+
* @returns The intersection point, or `undefined` if the ray does not
|
|
50
|
+
* intersect.
|
|
51
|
+
*/
|
|
52
|
+
export declare function intersectPlane(ray: Ray, plane: Plane.Plane): Vector3.Vector3 | undefined;
|