@vertexvis/geometry 0.24.5-canary.4 → 1.0.0-testing.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/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/dimensions.d.ts
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
import * as Point from './point';
|
|
2
|
-
import * as Rectangle from './rectangle';
|
|
3
|
-
/**
|
|
4
|
-
* `Dimensions` represent an object with a length of `width` and `height`.
|
|
5
|
-
*/
|
|
6
|
-
export interface Dimensions {
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Returns a `Dimensions` with the given width and height.
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
export declare const create: (width: number, height: number) => Dimensions;
|
|
15
|
-
/**
|
|
16
|
-
* Returns a `Dimensions` with the same width and height.
|
|
17
|
-
*/
|
|
18
|
-
export declare const square: (size: number) => Dimensions;
|
|
19
|
-
/**
|
|
20
|
-
* Returns `true` if two dimensions have the same width and height. Otherwise
|
|
21
|
-
* `false`.
|
|
22
|
-
*/
|
|
23
|
-
export declare const isEqual: (a: Dimensions, b: Dimensions) => boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Returns a scaled dimensions, where the width is scaled by `scaleX` and height
|
|
26
|
-
* is scaled by `scaleY`.
|
|
27
|
-
*/
|
|
28
|
-
export declare const scale: (scaleX: number, scaleY: number, dimensions: Dimensions) => Dimensions;
|
|
29
|
-
/**
|
|
30
|
-
* Returns a dimension where each length is scaled by `scaleFactor`.
|
|
31
|
-
*/
|
|
32
|
-
export declare const proportionalScale: (scaleFactor: number, dimensions: Dimensions) => Dimensions;
|
|
33
|
-
/**
|
|
34
|
-
* Returns a `Dimensions` where the lengths of `dimensions` are trimmed to fit
|
|
35
|
-
* into `to`.
|
|
36
|
-
*/
|
|
37
|
-
export declare const trim: (to: Dimensions, dimensions: Dimensions) => Dimensions;
|
|
38
|
-
/**
|
|
39
|
-
* Returns a `Dimensions` where the longest length of `dimensions` will be equal
|
|
40
|
-
* to the shortest length of `to`. The shortest length of `dimensions` will be
|
|
41
|
-
* proportionally scaled to match the aspect ratio of `dimensions`.
|
|
42
|
-
*
|
|
43
|
-
* @see #cropFit()
|
|
44
|
-
*/
|
|
45
|
-
export declare const containFit: (to: Dimensions, dimensions: Dimensions) => Dimensions;
|
|
46
|
-
/**
|
|
47
|
-
* Returns a `Dimensions` where the shortest length of `dimensions` will be
|
|
48
|
-
* equal to the longest length of `to`. The longest length of `dimensions` will
|
|
49
|
-
* be proportionally scaled to match the aspect ratio of `dimensions`.
|
|
50
|
-
*
|
|
51
|
-
* @see #containFit()
|
|
52
|
-
*/
|
|
53
|
-
export declare const cropFit: (to: Dimensions, dimensions: Dimensions) => Dimensions;
|
|
54
|
-
/**
|
|
55
|
-
* Returns a `Dimensions` where each side of `dimensions` will be reduced proportionally
|
|
56
|
-
* to have an area less than or equal to the provided `to` value. The returned
|
|
57
|
-
* dimensions will be centered within the original bounds of `dimensions`.
|
|
58
|
-
*
|
|
59
|
-
* @param to - the maximum area this dimensions can have
|
|
60
|
-
* @param dimensions - the dimensions to scale to fit the specified area
|
|
61
|
-
*/
|
|
62
|
-
export declare const scaleFit: (to: number, dimensions: Dimensions) => Dimensions;
|
|
63
|
-
/**
|
|
64
|
-
* Returns a `Dimensions` with each length rounded.
|
|
65
|
-
*/
|
|
66
|
-
export declare const round: (dimensions: Dimensions) => Dimensions;
|
|
67
|
-
/**
|
|
68
|
-
* Returns a `Dimensions` with each length rounded down.
|
|
69
|
-
*/
|
|
70
|
-
export declare const floor: (dimensions: Dimensions) => Dimensions;
|
|
71
|
-
/**
|
|
72
|
-
* Returns the center point of the given `dimensions`.
|
|
73
|
-
*/
|
|
74
|
-
export declare const center: (dimensions: Dimensions) => Point.Point;
|
|
75
|
-
/**
|
|
76
|
-
* Returns the aspect ratio of the given `dimensions`, as defined by width over
|
|
77
|
-
* height.
|
|
78
|
-
*/
|
|
79
|
-
export declare const aspectRatio: ({ width, height }: Dimensions) => number;
|
|
80
|
-
/**
|
|
81
|
-
* Returns the area of the given `dimensions`.
|
|
82
|
-
*/
|
|
83
|
-
export declare const area: ({ width, height }: Dimensions) => number;
|
|
84
|
-
/**
|
|
85
|
-
* Returns a `Dimensions` fitted to the provided aspect ratio.
|
|
86
|
-
*
|
|
87
|
-
* @param ratio - Aspect ratio to fit the provided Dimensions to
|
|
88
|
-
* @param dimensions - Dimensions to fit to the specified ratio
|
|
89
|
-
*/
|
|
90
|
-
export declare const fitToRatio: (ratio: number, dimensions: Dimensions) => Dimensions;
|
|
91
|
-
/**
|
|
92
|
-
* Converts a dimension to a rectangle, with an optional position.
|
|
93
|
-
*/
|
|
94
|
-
export declare function toRectangle(dimensions: Dimensions, position?: Point.Point): Rectangle.Rectangle;
|
|
1
|
+
import * as Point from './point';
|
|
2
|
+
import * as Rectangle from './rectangle';
|
|
3
|
+
/**
|
|
4
|
+
* `Dimensions` represent an object with a length of `width` and `height`.
|
|
5
|
+
*/
|
|
6
|
+
export interface Dimensions {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Returns a `Dimensions` with the given width and height.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export declare const create: (width: number, height: number) => Dimensions;
|
|
15
|
+
/**
|
|
16
|
+
* Returns a `Dimensions` with the same width and height.
|
|
17
|
+
*/
|
|
18
|
+
export declare const square: (size: number) => Dimensions;
|
|
19
|
+
/**
|
|
20
|
+
* Returns `true` if two dimensions have the same width and height. Otherwise
|
|
21
|
+
* `false`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const isEqual: (a: Dimensions, b: Dimensions) => boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Returns a scaled dimensions, where the width is scaled by `scaleX` and height
|
|
26
|
+
* is scaled by `scaleY`.
|
|
27
|
+
*/
|
|
28
|
+
export declare const scale: (scaleX: number, scaleY: number, dimensions: Dimensions) => Dimensions;
|
|
29
|
+
/**
|
|
30
|
+
* Returns a dimension where each length is scaled by `scaleFactor`.
|
|
31
|
+
*/
|
|
32
|
+
export declare const proportionalScale: (scaleFactor: number, dimensions: Dimensions) => Dimensions;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a `Dimensions` where the lengths of `dimensions` are trimmed to fit
|
|
35
|
+
* into `to`.
|
|
36
|
+
*/
|
|
37
|
+
export declare const trim: (to: Dimensions, dimensions: Dimensions) => Dimensions;
|
|
38
|
+
/**
|
|
39
|
+
* Returns a `Dimensions` where the longest length of `dimensions` will be equal
|
|
40
|
+
* to the shortest length of `to`. The shortest length of `dimensions` will be
|
|
41
|
+
* proportionally scaled to match the aspect ratio of `dimensions`.
|
|
42
|
+
*
|
|
43
|
+
* @see #cropFit()
|
|
44
|
+
*/
|
|
45
|
+
export declare const containFit: (to: Dimensions, dimensions: Dimensions) => Dimensions;
|
|
46
|
+
/**
|
|
47
|
+
* Returns a `Dimensions` where the shortest length of `dimensions` will be
|
|
48
|
+
* equal to the longest length of `to`. The longest length of `dimensions` will
|
|
49
|
+
* be proportionally scaled to match the aspect ratio of `dimensions`.
|
|
50
|
+
*
|
|
51
|
+
* @see #containFit()
|
|
52
|
+
*/
|
|
53
|
+
export declare const cropFit: (to: Dimensions, dimensions: Dimensions) => Dimensions;
|
|
54
|
+
/**
|
|
55
|
+
* Returns a `Dimensions` where each side of `dimensions` will be reduced proportionally
|
|
56
|
+
* to have an area less than or equal to the provided `to` value. The returned
|
|
57
|
+
* dimensions will be centered within the original bounds of `dimensions`.
|
|
58
|
+
*
|
|
59
|
+
* @param to - the maximum area this dimensions can have
|
|
60
|
+
* @param dimensions - the dimensions to scale to fit the specified area
|
|
61
|
+
*/
|
|
62
|
+
export declare const scaleFit: (to: number, dimensions: Dimensions) => Dimensions;
|
|
63
|
+
/**
|
|
64
|
+
* Returns a `Dimensions` with each length rounded.
|
|
65
|
+
*/
|
|
66
|
+
export declare const round: (dimensions: Dimensions) => Dimensions;
|
|
67
|
+
/**
|
|
68
|
+
* Returns a `Dimensions` with each length rounded down.
|
|
69
|
+
*/
|
|
70
|
+
export declare const floor: (dimensions: Dimensions) => Dimensions;
|
|
71
|
+
/**
|
|
72
|
+
* Returns the center point of the given `dimensions`.
|
|
73
|
+
*/
|
|
74
|
+
export declare const center: (dimensions: Dimensions) => Point.Point;
|
|
75
|
+
/**
|
|
76
|
+
* Returns the aspect ratio of the given `dimensions`, as defined by width over
|
|
77
|
+
* height.
|
|
78
|
+
*/
|
|
79
|
+
export declare const aspectRatio: ({ width, height }: Dimensions) => number;
|
|
80
|
+
/**
|
|
81
|
+
* Returns the area of the given `dimensions`.
|
|
82
|
+
*/
|
|
83
|
+
export declare const area: ({ width, height }: Dimensions) => number;
|
|
84
|
+
/**
|
|
85
|
+
* Returns a `Dimensions` fitted to the provided aspect ratio.
|
|
86
|
+
*
|
|
87
|
+
* @param ratio - Aspect ratio to fit the provided Dimensions to
|
|
88
|
+
* @param dimensions - Dimensions to fit to the specified ratio
|
|
89
|
+
*/
|
|
90
|
+
export declare const fitToRatio: (ratio: number, dimensions: Dimensions) => Dimensions;
|
|
91
|
+
/**
|
|
92
|
+
* Converts a dimension to a rectangle, with an optional position.
|
|
93
|
+
*/
|
|
94
|
+
export declare function toRectangle(dimensions: Dimensions, position?: Point.Point): Rectangle.Rectangle;
|
package/dist/euler.d.ts
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import * as Matrix4 from './matrix4';
|
|
2
|
-
/**
|
|
3
|
-
* A string representing the axis order of rotation.
|
|
4
|
-
*/
|
|
5
|
-
export
|
|
6
|
-
/**
|
|
7
|
-
* A type that represents [Euler Angles](http://en.wikipedia.org/wiki/Euler_angles).
|
|
8
|
-
*/
|
|
9
|
-
export interface Euler {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
z: number;
|
|
13
|
-
order: EulerOrder;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Creates a new set of Euler angles where each axis of rotation is defined by an angle,
|
|
17
|
-
* in radians. If no value is given, then `{x: 0, y: 0, z: 0, order: 'xyz'}` is
|
|
18
|
-
* returned.
|
|
19
|
-
*
|
|
20
|
-
* @param value The values to populate the Euler angles with.
|
|
21
|
-
* @returns A set of Euler angles.
|
|
22
|
-
*/
|
|
23
|
-
export declare function create(value?: Partial<Euler>): Euler;
|
|
24
|
-
/**
|
|
25
|
-
* Creates a new set of Euler angles where each axis of rotation is defined by an angle,
|
|
26
|
-
* in degrees. If no value is given, then `{x: 0, y: 0, z: 0, order: 'xyz'}` is
|
|
27
|
-
* returned.
|
|
28
|
-
*
|
|
29
|
-
* @param value The values to populate the Euler angles with.
|
|
30
|
-
* @returns A set of Euler angles.
|
|
31
|
-
*/
|
|
32
|
-
export declare function fromDegrees(value?: Partial<Euler>): Euler;
|
|
33
|
-
/**
|
|
34
|
-
* Creates a set of Euler angles from the rotation components of a 4x4 matrix. The
|
|
35
|
-
* rotation components are represented by the upper 3x3 of the matrix.
|
|
36
|
-
*
|
|
37
|
-
* Note that there are two solutions for the Euler angle of the 2nd applied
|
|
38
|
-
* rotation (i.e. y for xyz) because sin(theta) = sin(PI-theta).
|
|
39
|
-
* The returned angle will always be the solution between -PI/2 and PI/2.
|
|
40
|
-
*
|
|
41
|
-
* @param matrix A pure rotation matrix, unscaled.
|
|
42
|
-
* @param order The order that the rotations are applied.
|
|
43
|
-
*/
|
|
44
|
-
export declare function fromRotationMatrix(matrix: Matrix4.Matrix4, order?: EulerOrder): Euler;
|
|
45
|
-
/**
|
|
46
|
-
* Returns a set of Euler angles that was decoded from a JSON string. Supports either
|
|
47
|
-
* extracting values from an array `[x, y, z, order]` or object `{x, y, z,
|
|
48
|
-
* order}`.
|
|
49
|
-
*
|
|
50
|
-
* @param json A JSON object.
|
|
51
|
-
* @returns A set of Euler angles.
|
|
52
|
-
*/
|
|
53
|
-
export declare function fromJson(json: string): Euler;
|
|
54
|
-
/**
|
|
55
|
-
* Type guard that checks if the given type is a set of Euler angles.
|
|
56
|
-
*/
|
|
57
|
-
export declare function isType(obj: unknown): obj is Euler;
|
|
1
|
+
import * as Matrix4 from './matrix4';
|
|
2
|
+
/**
|
|
3
|
+
* A string representing the axis order of rotation.
|
|
4
|
+
*/
|
|
5
|
+
export type EulerOrder = 'xyz' | 'yzx' | 'zxy' | 'xzy' | 'yxz' | 'zyx';
|
|
6
|
+
/**
|
|
7
|
+
* A type that represents [Euler Angles](http://en.wikipedia.org/wiki/Euler_angles).
|
|
8
|
+
*/
|
|
9
|
+
export interface Euler {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
z: number;
|
|
13
|
+
order: EulerOrder;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new set of Euler angles where each axis of rotation is defined by an angle,
|
|
17
|
+
* in radians. If no value is given, then `{x: 0, y: 0, z: 0, order: 'xyz'}` is
|
|
18
|
+
* returned.
|
|
19
|
+
*
|
|
20
|
+
* @param value The values to populate the Euler angles with.
|
|
21
|
+
* @returns A set of Euler angles.
|
|
22
|
+
*/
|
|
23
|
+
export declare function create(value?: Partial<Euler>): Euler;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new set of Euler angles where each axis of rotation is defined by an angle,
|
|
26
|
+
* in degrees. If no value is given, then `{x: 0, y: 0, z: 0, order: 'xyz'}` is
|
|
27
|
+
* returned.
|
|
28
|
+
*
|
|
29
|
+
* @param value The values to populate the Euler angles with.
|
|
30
|
+
* @returns A set of Euler angles.
|
|
31
|
+
*/
|
|
32
|
+
export declare function fromDegrees(value?: Partial<Euler>): Euler;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a set of Euler angles from the rotation components of a 4x4 matrix. The
|
|
35
|
+
* rotation components are represented by the upper 3x3 of the matrix.
|
|
36
|
+
*
|
|
37
|
+
* Note that there are two solutions for the Euler angle of the 2nd applied
|
|
38
|
+
* rotation (i.e. y for xyz) because sin(theta) = sin(PI-theta).
|
|
39
|
+
* The returned angle will always be the solution between -PI/2 and PI/2.
|
|
40
|
+
*
|
|
41
|
+
* @param matrix A pure rotation matrix, unscaled.
|
|
42
|
+
* @param order The order that the rotations are applied.
|
|
43
|
+
*/
|
|
44
|
+
export declare function fromRotationMatrix(matrix: Matrix4.Matrix4, order?: EulerOrder): Euler;
|
|
45
|
+
/**
|
|
46
|
+
* Returns a set of Euler angles that was decoded from a JSON string. Supports either
|
|
47
|
+
* extracting values from an array `[x, y, z, order]` or object `{x, y, z,
|
|
48
|
+
* order}`.
|
|
49
|
+
*
|
|
50
|
+
* @param json A JSON object.
|
|
51
|
+
* @returns A set of Euler angles.
|
|
52
|
+
*/
|
|
53
|
+
export declare function fromJson(json: string): Euler;
|
|
54
|
+
/**
|
|
55
|
+
* Type guard that checks if the given type is a set of Euler angles.
|
|
56
|
+
*/
|
|
57
|
+
export declare function isType(obj: unknown): obj is Euler;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Geometry
|
|
3
|
-
*/
|
|
4
|
-
import * as Angle from './angle';
|
|
5
|
-
import * as BoundingBox from './boundingBox';
|
|
6
|
-
import * as BoundingSphere from './boundingSphere';
|
|
7
|
-
import * as Dimensions from './dimensions';
|
|
8
|
-
import * as Euler from './euler';
|
|
9
|
-
import * as Line3 from './line3';
|
|
10
|
-
import * as Matrix from './matrix';
|
|
11
|
-
import * as Matrix2 from './matrix2';
|
|
12
|
-
import * as Matrix4 from './matrix4';
|
|
13
|
-
import * as Plane from './plane';
|
|
14
|
-
import * as Point from './point';
|
|
15
|
-
import * as Quaternion from './quaternion';
|
|
16
|
-
import * as Ray from './ray';
|
|
17
|
-
import * as Rectangle from './rectangle';
|
|
18
|
-
import * as Vector3 from './vector3';
|
|
19
|
-
import * as Vector4 from './vector4';
|
|
20
|
-
export * from './math';
|
|
21
|
-
export { Angle, BoundingBox, BoundingSphere, Dimensions, Euler, Line3, Matrix, Matrix2, Matrix4, Plane, Point, Quaternion, Ray, Rectangle, Vector3, Vector4, };
|
|
1
|
+
/**
|
|
2
|
+
* @module Geometry
|
|
3
|
+
*/
|
|
4
|
+
import * as Angle from './angle';
|
|
5
|
+
import * as BoundingBox from './boundingBox';
|
|
6
|
+
import * as BoundingSphere from './boundingSphere';
|
|
7
|
+
import * as Dimensions from './dimensions';
|
|
8
|
+
import * as Euler from './euler';
|
|
9
|
+
import * as Line3 from './line3';
|
|
10
|
+
import * as Matrix from './matrix';
|
|
11
|
+
import * as Matrix2 from './matrix2';
|
|
12
|
+
import * as Matrix4 from './matrix4';
|
|
13
|
+
import * as Plane from './plane';
|
|
14
|
+
import * as Point from './point';
|
|
15
|
+
import * as Quaternion from './quaternion';
|
|
16
|
+
import * as Ray from './ray';
|
|
17
|
+
import * as Rectangle from './rectangle';
|
|
18
|
+
import * as Vector3 from './vector3';
|
|
19
|
+
import * as Vector4 from './vector4';
|
|
20
|
+
export * from './math';
|
|
21
|
+
export { Angle, BoundingBox, BoundingSphere, Dimensions, Euler, Line3, Matrix, Matrix2, Matrix4, Plane, Point, Quaternion, Ray, Rectangle, Vector3, Vector4, };
|
package/dist/line3.d.ts
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import * as Matrix4 from './matrix4';
|
|
2
|
-
import * as Vector3 from './vector3';
|
|
3
|
-
/**
|
|
4
|
-
* A `Line3` represents a line segment between a `start` and `end` point.
|
|
5
|
-
*/
|
|
6
|
-
export interface Line3 {
|
|
7
|
-
/**
|
|
8
|
-
* The start of the line segment.
|
|
9
|
-
*/
|
|
10
|
-
start: Vector3.Vector3;
|
|
11
|
-
/**
|
|
12
|
-
* The end of the line segment.
|
|
13
|
-
*/
|
|
14
|
-
end: Vector3.Vector3;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Creates a new `Line3`. If unspecified, the start and end values of the line
|
|
18
|
-
* will be at origin.
|
|
19
|
-
*
|
|
20
|
-
* @param values The values to assign to the line.
|
|
21
|
-
*/
|
|
22
|
-
export declare function create(values?: Partial<Line3>): Line3;
|
|
23
|
-
/**
|
|
24
|
-
* Returns the point that is halfway between start and end.
|
|
25
|
-
*/
|
|
26
|
-
export declare function center(line: Line3): Vector3.Vector3;
|
|
27
|
-
/**
|
|
28
|
-
* Returns a line where the start and end points are transformed with the given
|
|
29
|
-
* matrix.
|
|
30
|
-
*
|
|
31
|
-
* @param line The line to transform.
|
|
32
|
-
* @param matrix The matrix to apply.
|
|
33
|
-
* @returns A transformed line.
|
|
34
|
-
*/
|
|
35
|
-
export declare function transformMatrix(line: Line3, matrix: Matrix4.Matrix4): Line3;
|
|
36
|
-
/**
|
|
37
|
-
* Euclidean distance between the start and end points of the line.
|
|
38
|
-
*/
|
|
39
|
-
export declare function distance(line: Line3): number;
|
|
40
|
-
/**
|
|
41
|
-
* Returns the squared distance between a line's start and end point. If you're
|
|
42
|
-
* just comparing distances, this is slightly more efficient than `distanceTo`.
|
|
43
|
-
*/
|
|
44
|
-
export declare function distanceSquared(line: Line3): number;
|
|
45
|
-
/**
|
|
46
|
-
* Returns a vector describing the direction of the line from start to end.
|
|
47
|
-
*/
|
|
48
|
-
export declare function direction(line: Line3): Vector3.Vector3;
|
|
1
|
+
import * as Matrix4 from './matrix4';
|
|
2
|
+
import * as Vector3 from './vector3';
|
|
3
|
+
/**
|
|
4
|
+
* A `Line3` represents a line segment between a `start` and `end` point.
|
|
5
|
+
*/
|
|
6
|
+
export interface Line3 {
|
|
7
|
+
/**
|
|
8
|
+
* The start of the line segment.
|
|
9
|
+
*/
|
|
10
|
+
start: Vector3.Vector3;
|
|
11
|
+
/**
|
|
12
|
+
* The end of the line segment.
|
|
13
|
+
*/
|
|
14
|
+
end: Vector3.Vector3;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new `Line3`. If unspecified, the start and end values of the line
|
|
18
|
+
* will be at origin.
|
|
19
|
+
*
|
|
20
|
+
* @param values The values to assign to the line.
|
|
21
|
+
*/
|
|
22
|
+
export declare function create(values?: Partial<Line3>): Line3;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the point that is halfway between start and end.
|
|
25
|
+
*/
|
|
26
|
+
export declare function center(line: Line3): Vector3.Vector3;
|
|
27
|
+
/**
|
|
28
|
+
* Returns a line where the start and end points are transformed with the given
|
|
29
|
+
* matrix.
|
|
30
|
+
*
|
|
31
|
+
* @param line The line to transform.
|
|
32
|
+
* @param matrix The matrix to apply.
|
|
33
|
+
* @returns A transformed line.
|
|
34
|
+
*/
|
|
35
|
+
export declare function transformMatrix(line: Line3, matrix: Matrix4.Matrix4): Line3;
|
|
36
|
+
/**
|
|
37
|
+
* Euclidean distance between the start and end points of the line.
|
|
38
|
+
*/
|
|
39
|
+
export declare function distance(line: Line3): number;
|
|
40
|
+
/**
|
|
41
|
+
* Returns the squared distance between a line's start and end point. If you're
|
|
42
|
+
* just comparing distances, this is slightly more efficient than `distanceTo`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function distanceSquared(line: Line3): number;
|
|
45
|
+
/**
|
|
46
|
+
* Returns a vector describing the direction of the line from start to end.
|
|
47
|
+
*/
|
|
48
|
+
export declare function direction(line: Line3): Vector3.Vector3;
|
package/dist/math.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Clamps the given value between `min` and `max`.
|
|
3
|
-
*
|
|
4
|
-
* @param value The value to clamp.
|
|
5
|
-
* @param min The min possible value.
|
|
6
|
-
* @param max The max possible value.
|
|
7
|
-
* @returns `value` or a value clamped to `min` or `max`.
|
|
8
|
-
*/
|
|
9
|
-
export declare function clamp(value: number, min: number, max: number): number;
|
|
10
|
-
/**
|
|
11
|
-
* Linear interpolates a value between `a` and `b` by `t`. If `t` is 0, then the
|
|
12
|
-
* result will be `a`. If `t` is 1, then the result will be `b`. `t` will be
|
|
13
|
-
* clamped to a value between 0 and 1.
|
|
14
|
-
*
|
|
15
|
-
* @param a The start value.
|
|
16
|
-
* @param b The end value.
|
|
17
|
-
* @param t The interpolation value between 0 and 1.
|
|
18
|
-
* @returns The interpolated value between `a` and `b`.
|
|
19
|
-
*/
|
|
20
|
-
export declare function lerp(a: number, b: number, t: number): number;
|
|
1
|
+
/**
|
|
2
|
+
* Clamps the given value between `min` and `max`.
|
|
3
|
+
*
|
|
4
|
+
* @param value The value to clamp.
|
|
5
|
+
* @param min The min possible value.
|
|
6
|
+
* @param max The max possible value.
|
|
7
|
+
* @returns `value` or a value clamped to `min` or `max`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
10
|
+
/**
|
|
11
|
+
* Linear interpolates a value between `a` and `b` by `t`. If `t` is 0, then the
|
|
12
|
+
* result will be `a`. If `t` is 1, then the result will be `b`. `t` will be
|
|
13
|
+
* clamped to a value between 0 and 1.
|
|
14
|
+
*
|
|
15
|
+
* @param a The start value.
|
|
16
|
+
* @param b The end value.
|
|
17
|
+
* @param t The interpolation value between 0 and 1.
|
|
18
|
+
* @returns The interpolated value between `a` and `b`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function lerp(a: number, b: number, t: number): number;
|
package/dist/matrix.d.ts
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import * as Point from './point';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a 2D transformation matrix.
|
|
4
|
-
*
|
|
5
|
-
* The values of this matrix are meant to represent a 3x3 matrix where the
|
|
6
|
-
* contents are mapped as the following:
|
|
7
|
-
*
|
|
8
|
-
* ```
|
|
9
|
-
* a b tx
|
|
10
|
-
* c d ty
|
|
11
|
-
* u v w
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export interface Matrix {
|
|
15
|
-
/**
|
|
16
|
-
* Value that affects the positioning along the x axis when scaling or
|
|
17
|
-
* rotating.
|
|
18
|
-
*/
|
|
19
|
-
a: number;
|
|
20
|
-
/**
|
|
21
|
-
* Value that affects the positioning along the y axis when rotating or
|
|
22
|
-
* skewing.
|
|
23
|
-
*/
|
|
24
|
-
b: number;
|
|
25
|
-
/**
|
|
26
|
-
* Value that affects the positioning along the x axis when rotating or
|
|
27
|
-
* skewing.
|
|
28
|
-
*/
|
|
29
|
-
c: number;
|
|
30
|
-
/**
|
|
31
|
-
* Value that affects the positioning along the y axis when scaling or
|
|
32
|
-
* rotating.
|
|
33
|
-
*/
|
|
34
|
-
d: number;
|
|
35
|
-
/**
|
|
36
|
-
* The distance to translate along the x axis.
|
|
37
|
-
*/
|
|
38
|
-
tx: number;
|
|
39
|
-
/**
|
|
40
|
-
* The distance to translate along the y axis.
|
|
41
|
-
*/
|
|
42
|
-
ty: number;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Creates a new matrix. If arguments are undefined, returns an identity matrix.
|
|
46
|
-
*/
|
|
47
|
-
export declare const create: (a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number) => Matrix;
|
|
48
|
-
/**
|
|
49
|
-
* Returns an identity matrix.
|
|
50
|
-
*/
|
|
51
|
-
export declare const identity: () => Matrix;
|
|
52
|
-
/**
|
|
53
|
-
* Creates a matrix that is translated by the given `tx` and `ty` values.
|
|
54
|
-
*/
|
|
55
|
-
export declare const translation: (tx: number, ty: number) => Matrix;
|
|
56
|
-
/**
|
|
57
|
-
* Creates a matrix that is rotated by the given degrees.
|
|
58
|
-
*/
|
|
59
|
-
export declare const rotation: (degrees: number) => Matrix;
|
|
60
|
-
/**
|
|
61
|
-
* Rotates the given matrix by the given degrees.
|
|
62
|
-
*/
|
|
63
|
-
export declare const rotate: (degrees: number, matrix: Matrix) => Matrix;
|
|
64
|
-
/**
|
|
65
|
-
* Translates the given matrix along the horizontal and vertical axis by the
|
|
66
|
-
* given `dx` and `dy` delta values.
|
|
67
|
-
*/
|
|
68
|
-
export declare const translate: (dx: number, dy: number, matrix: Matrix) => Matrix;
|
|
69
|
-
/**
|
|
70
|
-
* Returns the result of applying a geometric transformation of a matrix on the
|
|
71
|
-
* given point.
|
|
72
|
-
*/
|
|
73
|
-
export declare const transformPoint: (matrix: Matrix, pt: Point.Point) => Point.Point;
|
|
1
|
+
import * as Point from './point';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a 2D transformation matrix.
|
|
4
|
+
*
|
|
5
|
+
* The values of this matrix are meant to represent a 3x3 matrix where the
|
|
6
|
+
* contents are mapped as the following:
|
|
7
|
+
*
|
|
8
|
+
* ```
|
|
9
|
+
* a b tx
|
|
10
|
+
* c d ty
|
|
11
|
+
* u v w
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export interface Matrix {
|
|
15
|
+
/**
|
|
16
|
+
* Value that affects the positioning along the x axis when scaling or
|
|
17
|
+
* rotating.
|
|
18
|
+
*/
|
|
19
|
+
a: number;
|
|
20
|
+
/**
|
|
21
|
+
* Value that affects the positioning along the y axis when rotating or
|
|
22
|
+
* skewing.
|
|
23
|
+
*/
|
|
24
|
+
b: number;
|
|
25
|
+
/**
|
|
26
|
+
* Value that affects the positioning along the x axis when rotating or
|
|
27
|
+
* skewing.
|
|
28
|
+
*/
|
|
29
|
+
c: number;
|
|
30
|
+
/**
|
|
31
|
+
* Value that affects the positioning along the y axis when scaling or
|
|
32
|
+
* rotating.
|
|
33
|
+
*/
|
|
34
|
+
d: number;
|
|
35
|
+
/**
|
|
36
|
+
* The distance to translate along the x axis.
|
|
37
|
+
*/
|
|
38
|
+
tx: number;
|
|
39
|
+
/**
|
|
40
|
+
* The distance to translate along the y axis.
|
|
41
|
+
*/
|
|
42
|
+
ty: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates a new matrix. If arguments are undefined, returns an identity matrix.
|
|
46
|
+
*/
|
|
47
|
+
export declare const create: (a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number) => Matrix;
|
|
48
|
+
/**
|
|
49
|
+
* Returns an identity matrix.
|
|
50
|
+
*/
|
|
51
|
+
export declare const identity: () => Matrix;
|
|
52
|
+
/**
|
|
53
|
+
* Creates a matrix that is translated by the given `tx` and `ty` values.
|
|
54
|
+
*/
|
|
55
|
+
export declare const translation: (tx: number, ty: number) => Matrix;
|
|
56
|
+
/**
|
|
57
|
+
* Creates a matrix that is rotated by the given degrees.
|
|
58
|
+
*/
|
|
59
|
+
export declare const rotation: (degrees: number) => Matrix;
|
|
60
|
+
/**
|
|
61
|
+
* Rotates the given matrix by the given degrees.
|
|
62
|
+
*/
|
|
63
|
+
export declare const rotate: (degrees: number, matrix: Matrix) => Matrix;
|
|
64
|
+
/**
|
|
65
|
+
* Translates the given matrix along the horizontal and vertical axis by the
|
|
66
|
+
* given `dx` and `dy` delta values.
|
|
67
|
+
*/
|
|
68
|
+
export declare const translate: (dx: number, dy: number, matrix: Matrix) => Matrix;
|
|
69
|
+
/**
|
|
70
|
+
* Returns the result of applying a geometric transformation of a matrix on the
|
|
71
|
+
* given point.
|
|
72
|
+
*/
|
|
73
|
+
export declare const transformPoint: (matrix: Matrix, pt: Point.Point) => Point.Point;
|