@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/rectangle.d.ts
CHANGED
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
import * as Dimensions from './dimensions';
|
|
2
|
-
import * as Point from './point';
|
|
3
|
-
/**
|
|
4
|
-
* A `Rectangle` is an object with position and size.
|
|
5
|
-
*/
|
|
6
|
-
export interface Rectangle {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Returns a new `Rectangle` with the given position and size.
|
|
14
|
-
*/
|
|
15
|
-
export declare function create(x: number, y: number, width: number, height: number): Rectangle;
|
|
16
|
-
/**
|
|
17
|
-
* Returns a new `Rectangle` at the origin point and given size.
|
|
18
|
-
*/
|
|
19
|
-
export declare function fromDimensions(dimensions: Dimensions.Dimensions): Rectangle;
|
|
20
|
-
/**
|
|
21
|
-
* Returns a new `Rectangle` with the given position and size.
|
|
22
|
-
*/
|
|
23
|
-
export declare function fromPointAndDimensions(point: Point.Point, dimensions: Dimensions.Dimensions): Rectangle;
|
|
24
|
-
/**
|
|
25
|
-
* Returns a new `Rectangle` with the given top-left and bottom-right positions.
|
|
26
|
-
* The returned rectangle will always returns a positive width and height.
|
|
27
|
-
*/
|
|
28
|
-
export declare function fromPoints(topLeftPt: Point.Point, bottomRightPt: Point.Point): Rectangle;
|
|
29
|
-
/**
|
|
30
|
-
* Returns a rectangle where the longest length of `rect` will be equal to the
|
|
31
|
-
* shortest length of `to`. The shortest length of `rect` will be proportionally
|
|
32
|
-
* scaled to match the aspect ratio of `rect`. The returned rectangle will be
|
|
33
|
-
* centered within `to`.
|
|
34
|
-
*
|
|
35
|
-
* @see {@link cropFit}
|
|
36
|
-
*/
|
|
37
|
-
export declare function containFit(to: Rectangle, rect: Rectangle): Rectangle;
|
|
38
|
-
/**
|
|
39
|
-
* Returns a rectangle where the shortest length of `rect` will be equal to the
|
|
40
|
-
* longest length of `to`. The longest length of `rect` will be proportionally
|
|
41
|
-
* scaled to match the aspect ratio of `rect`. The returned rectangle will be
|
|
42
|
-
* centered within `to`.
|
|
43
|
-
*
|
|
44
|
-
* @see {@link containFit}
|
|
45
|
-
*/
|
|
46
|
-
export declare function cropFit(to: Rectangle, rect: Rectangle): Rectangle;
|
|
47
|
-
/**
|
|
48
|
-
* Returns a rectangle where each side of `rect` will be reduced proportionally
|
|
49
|
-
* to have an area less than or equal to the provided `to` value. The returned
|
|
50
|
-
* rectangle will be centered within the original bounds of `rect`.
|
|
51
|
-
*
|
|
52
|
-
* @param to - the maximum area this rectangle can have
|
|
53
|
-
* @param rect - the rectangle to scale to fit the specified area
|
|
54
|
-
*/
|
|
55
|
-
export declare function scaleFit(to: number, rect: Rectangle): Rectangle;
|
|
56
|
-
/**
|
|
57
|
-
* Returns a rectangle where the position and dimensions are scaled by the given
|
|
58
|
-
* factors. If `scaleY` is omitted, then the position and dimensions are scaled
|
|
59
|
-
* uniformly by `scaleOrScaleX`.
|
|
60
|
-
*
|
|
61
|
-
* @param rect The rectangle to scale.
|
|
62
|
-
* @param scaleOrScaleX The uniform scale factor, or the horizontal scale
|
|
63
|
-
* factor.
|
|
64
|
-
* @param scaleY The vertical scale factor.
|
|
65
|
-
* @returns A scaled rectangle.
|
|
66
|
-
*/
|
|
67
|
-
export declare function scale(rect: Rectangle, scaleOrScaleX: number, scaleY?: number): Rectangle;
|
|
68
|
-
/**
|
|
69
|
-
* Returns true if two rectangles are equal in position and size.
|
|
70
|
-
*/
|
|
71
|
-
export declare function isEqual(a: Rectangle, b: Rectangle): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Returns a rectangle that has its position shifted by a given offset. The
|
|
74
|
-
* size of the rectangle is unchanged.
|
|
75
|
-
*/
|
|
76
|
-
export declare function offset(delta: Point.Point, rect: Rectangle): Rectangle;
|
|
77
|
-
/**
|
|
78
|
-
* Returns the area of the rectangle.
|
|
79
|
-
*/
|
|
80
|
-
export declare function area(rect: Rectangle): number;
|
|
81
|
-
/**
|
|
82
|
-
* Returns the center point of the rectangle.
|
|
83
|
-
*/
|
|
84
|
-
export declare function center(rect: Rectangle): Point.Point;
|
|
85
|
-
/**
|
|
86
|
-
* Returns the top-left position of the rectangle, as a point.
|
|
87
|
-
*/
|
|
88
|
-
export declare function topLeft(rect: Rectangle): Point.Point;
|
|
89
|
-
/**
|
|
90
|
-
* Returns the bottom-right position of the rectangle, as a point.
|
|
91
|
-
*/
|
|
92
|
-
export declare function bottomRight(rect: Rectangle): Point.Point;
|
|
93
|
-
/**
|
|
94
|
-
* Returns `true` if the given rectangle has a portrait aspect ratio.
|
|
95
|
-
*/
|
|
96
|
-
export declare function isPortrait(rect: Rectangle): boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Returns `true` if the given rectangle has a landscape aspect ratio.
|
|
99
|
-
*/
|
|
100
|
-
export declare function isLandscape(rect: Rectangle): boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Returns `true` if the given rectangle has a square aspect ratio.
|
|
103
|
-
*/
|
|
104
|
-
export declare function isSquare(rect: Rectangle): boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Pads a rectangle by the given amount, maintaining the center position.
|
|
107
|
-
*
|
|
108
|
-
* @param rect The rectangle to apply padding to.
|
|
109
|
-
* @param padding The padding to add.
|
|
110
|
-
*/
|
|
111
|
-
export declare function pad(rect: Rectangle, padding: number): Rectangle;
|
|
112
|
-
/**
|
|
113
|
-
* Returns `true` if the given rectangle contains all the given `points`.
|
|
114
|
-
*
|
|
115
|
-
* @param rect The rectangle to check against.
|
|
116
|
-
* @param points The points to check.
|
|
117
|
-
*/
|
|
118
|
-
export declare function containsPoints(rect: Rectangle, ...points: Point.Point[]): boolean;
|
|
119
|
-
/**
|
|
120
|
-
* Parses a JSON string representation of a Rectangle and returns an object.
|
|
121
|
-
*
|
|
122
|
-
* @param json A JSON string, either in the form `[x,y,width,height]` or `{"x": 0, "y": 0, "width": 10, "height": 10}`
|
|
123
|
-
* @returns A parsed Point.
|
|
124
|
-
*/
|
|
125
|
-
export declare function fromJson(json: string): Rectangle;
|
|
1
|
+
import * as Dimensions from './dimensions';
|
|
2
|
+
import * as Point from './point';
|
|
3
|
+
/**
|
|
4
|
+
* A `Rectangle` is an object with position and size.
|
|
5
|
+
*/
|
|
6
|
+
export interface Rectangle {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Returns a new `Rectangle` with the given position and size.
|
|
14
|
+
*/
|
|
15
|
+
export declare function create(x: number, y: number, width: number, height: number): Rectangle;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a new `Rectangle` at the origin point and given size.
|
|
18
|
+
*/
|
|
19
|
+
export declare function fromDimensions(dimensions: Dimensions.Dimensions): Rectangle;
|
|
20
|
+
/**
|
|
21
|
+
* Returns a new `Rectangle` with the given position and size.
|
|
22
|
+
*/
|
|
23
|
+
export declare function fromPointAndDimensions(point: Point.Point, dimensions: Dimensions.Dimensions): Rectangle;
|
|
24
|
+
/**
|
|
25
|
+
* Returns a new `Rectangle` with the given top-left and bottom-right positions.
|
|
26
|
+
* The returned rectangle will always returns a positive width and height.
|
|
27
|
+
*/
|
|
28
|
+
export declare function fromPoints(topLeftPt: Point.Point, bottomRightPt: Point.Point): Rectangle;
|
|
29
|
+
/**
|
|
30
|
+
* Returns a rectangle where the longest length of `rect` will be equal to the
|
|
31
|
+
* shortest length of `to`. The shortest length of `rect` will be proportionally
|
|
32
|
+
* scaled to match the aspect ratio of `rect`. The returned rectangle will be
|
|
33
|
+
* centered within `to`.
|
|
34
|
+
*
|
|
35
|
+
* @see {@link cropFit}
|
|
36
|
+
*/
|
|
37
|
+
export declare function containFit(to: Rectangle, rect: Rectangle): Rectangle;
|
|
38
|
+
/**
|
|
39
|
+
* Returns a rectangle where the shortest length of `rect` will be equal to the
|
|
40
|
+
* longest length of `to`. The longest length of `rect` will be proportionally
|
|
41
|
+
* scaled to match the aspect ratio of `rect`. The returned rectangle will be
|
|
42
|
+
* centered within `to`.
|
|
43
|
+
*
|
|
44
|
+
* @see {@link containFit}
|
|
45
|
+
*/
|
|
46
|
+
export declare function cropFit(to: Rectangle, rect: Rectangle): Rectangle;
|
|
47
|
+
/**
|
|
48
|
+
* Returns a rectangle where each side of `rect` will be reduced proportionally
|
|
49
|
+
* to have an area less than or equal to the provided `to` value. The returned
|
|
50
|
+
* rectangle will be centered within the original bounds of `rect`.
|
|
51
|
+
*
|
|
52
|
+
* @param to - the maximum area this rectangle can have
|
|
53
|
+
* @param rect - the rectangle to scale to fit the specified area
|
|
54
|
+
*/
|
|
55
|
+
export declare function scaleFit(to: number, rect: Rectangle): Rectangle;
|
|
56
|
+
/**
|
|
57
|
+
* Returns a rectangle where the position and dimensions are scaled by the given
|
|
58
|
+
* factors. If `scaleY` is omitted, then the position and dimensions are scaled
|
|
59
|
+
* uniformly by `scaleOrScaleX`.
|
|
60
|
+
*
|
|
61
|
+
* @param rect The rectangle to scale.
|
|
62
|
+
* @param scaleOrScaleX The uniform scale factor, or the horizontal scale
|
|
63
|
+
* factor.
|
|
64
|
+
* @param scaleY The vertical scale factor.
|
|
65
|
+
* @returns A scaled rectangle.
|
|
66
|
+
*/
|
|
67
|
+
export declare function scale(rect: Rectangle, scaleOrScaleX: number, scaleY?: number): Rectangle;
|
|
68
|
+
/**
|
|
69
|
+
* Returns true if two rectangles are equal in position and size.
|
|
70
|
+
*/
|
|
71
|
+
export declare function isEqual(a: Rectangle, b: Rectangle): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Returns a rectangle that has its position shifted by a given offset. The
|
|
74
|
+
* size of the rectangle is unchanged.
|
|
75
|
+
*/
|
|
76
|
+
export declare function offset(delta: Point.Point, rect: Rectangle): Rectangle;
|
|
77
|
+
/**
|
|
78
|
+
* Returns the area of the rectangle.
|
|
79
|
+
*/
|
|
80
|
+
export declare function area(rect: Rectangle): number;
|
|
81
|
+
/**
|
|
82
|
+
* Returns the center point of the rectangle.
|
|
83
|
+
*/
|
|
84
|
+
export declare function center(rect: Rectangle): Point.Point;
|
|
85
|
+
/**
|
|
86
|
+
* Returns the top-left position of the rectangle, as a point.
|
|
87
|
+
*/
|
|
88
|
+
export declare function topLeft(rect: Rectangle): Point.Point;
|
|
89
|
+
/**
|
|
90
|
+
* Returns the bottom-right position of the rectangle, as a point.
|
|
91
|
+
*/
|
|
92
|
+
export declare function bottomRight(rect: Rectangle): Point.Point;
|
|
93
|
+
/**
|
|
94
|
+
* Returns `true` if the given rectangle has a portrait aspect ratio.
|
|
95
|
+
*/
|
|
96
|
+
export declare function isPortrait(rect: Rectangle): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Returns `true` if the given rectangle has a landscape aspect ratio.
|
|
99
|
+
*/
|
|
100
|
+
export declare function isLandscape(rect: Rectangle): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Returns `true` if the given rectangle has a square aspect ratio.
|
|
103
|
+
*/
|
|
104
|
+
export declare function isSquare(rect: Rectangle): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Pads a rectangle by the given amount, maintaining the center position.
|
|
107
|
+
*
|
|
108
|
+
* @param rect The rectangle to apply padding to.
|
|
109
|
+
* @param padding The padding to add.
|
|
110
|
+
*/
|
|
111
|
+
export declare function pad(rect: Rectangle, padding: number): Rectangle;
|
|
112
|
+
/**
|
|
113
|
+
* Returns `true` if the given rectangle contains all the given `points`.
|
|
114
|
+
*
|
|
115
|
+
* @param rect The rectangle to check against.
|
|
116
|
+
* @param points The points to check.
|
|
117
|
+
*/
|
|
118
|
+
export declare function containsPoints(rect: Rectangle, ...points: Point.Point[]): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Parses a JSON string representation of a Rectangle and returns an object.
|
|
121
|
+
*
|
|
122
|
+
* @param json A JSON string, either in the form `[x,y,width,height]` or `{"x": 0, "y": 0, "width": 10, "height": 10}`
|
|
123
|
+
* @returns A parsed Point.
|
|
124
|
+
*/
|
|
125
|
+
export declare function fromJson(json: string): Rectangle;
|