@immugio/three-math-extensions 0.3.4 → 0.3.7

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/cjs/Line2D.js +90 -13
  3. package/cjs/Polygon.js +3 -0
  4. package/docs/classes/BoundingBox.md +121 -121
  5. package/docs/classes/Line2D.md +1366 -1366
  6. package/docs/classes/Line3D.md +831 -831
  7. package/docs/classes/Polygon.md +297 -297
  8. package/docs/classes/Rectangle.md +291 -291
  9. package/docs/classes/Size2.md +55 -55
  10. package/docs/classes/Vec2.md +282 -282
  11. package/docs/classes/Vec3.md +338 -338
  12. package/docs/interfaces/Point2.md +30 -30
  13. package/docs/interfaces/Point3.md +41 -41
  14. package/docs/modules.md +209 -209
  15. package/eslint.config.mjs +111 -111
  16. package/esm/Line2D.js +90 -13
  17. package/esm/Polygon.js +3 -0
  18. package/package.json +62 -62
  19. package/src/BoundingBox.ts +13 -13
  20. package/src/Line2D.ts +951 -857
  21. package/src/Line3D.ts +586 -586
  22. package/src/MathConstants.ts +1 -1
  23. package/src/Point2.ts +3 -3
  24. package/src/Point3.ts +4 -4
  25. package/src/Polygon.ts +290 -286
  26. package/src/Rectangle.ts +92 -92
  27. package/src/Size2.ts +3 -3
  28. package/src/Vec2.ts +124 -124
  29. package/src/Vec3.ts +167 -167
  30. package/src/containsPoint.ts +65 -65
  31. package/src/directions.ts +9 -9
  32. package/src/directions2d.ts +7 -7
  33. package/src/ensurePolygonClockwise.ts +9 -9
  34. package/src/extendOrTrimPolylinesAtIntersections.ts +10 -10
  35. package/src/getPolygonArea.ts +21 -21
  36. package/src/index.ts +24 -24
  37. package/src/isContinuousClosedShape.ts +24 -24
  38. package/src/isPointInPolygon.ts +23 -23
  39. package/src/isPolygonClockwise.ts +15 -15
  40. package/src/normalizeAngleDegrees.ts +6 -6
  41. package/src/normalizeAngleRadians.ts +14 -14
  42. package/src/offsetPolyline.ts +26 -26
  43. package/src/polygonPerimeter.ts +13 -13
  44. package/src/sortLinesByConnections.ts +45 -45
  45. package/types/Line2D.d.ts +12 -5
@@ -1,291 +1,291 @@
1
- [@immugio/three-math-extensions](../../README.md) / [Exports](../modules.md) / Rectangle
2
-
3
- # Class: Rectangle
4
-
5
- ## Table of contents
6
-
7
- ### Constructors
8
-
9
- - [constructor](Rectangle.md#constructor)
10
-
11
- ### Properties
12
-
13
- - [bottomY](Rectangle.md#bottomy)
14
- - [leftX](Rectangle.md#leftx)
15
- - [rightX](Rectangle.md#rightx)
16
- - [topY](Rectangle.md#topy)
17
-
18
- ### Accessors
19
-
20
- - [center](Rectangle.md#center)
21
- - [hasSize](Rectangle.md#hassize)
22
- - [offset](Rectangle.md#offset)
23
- - [size](Rectangle.md#size)
24
-
25
- ### Methods
26
-
27
- - [centerOnOrigin](Rectangle.md#centeronorigin)
28
- - [clone](Rectangle.md#clone)
29
- - [equals](Rectangle.md#equals)
30
- - [flipVertical](Rectangle.md#flipvertical)
31
- - [overlaps](Rectangle.md#overlaps)
32
- - [toPoints](Rectangle.md#topoints)
33
- - [toPolygon](Rectangle.md#topolygon)
34
- - [translate](Rectangle.md#translate)
35
-
36
- ## Constructors
37
-
38
- ### constructor
39
-
40
- • **new Rectangle**(`leftX`, `rightX`, `topY`, `bottomY`): [`Rectangle`](Rectangle.md)
41
-
42
- #### Parameters
43
-
44
- | Name | Type |
45
- | :------ | :------ |
46
- | `leftX` | `number` |
47
- | `rightX` | `number` |
48
- | `topY` | `number` |
49
- | `bottomY` | `number` |
50
-
51
- #### Returns
52
-
53
- [`Rectangle`](Rectangle.md)
54
-
55
- #### Defined in
56
-
57
- [src/Rectangle.ts:7](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L7)
58
-
59
- ## Properties
60
-
61
- ### bottomY
62
-
63
- • **bottomY**: `number`
64
-
65
- #### Defined in
66
-
67
- [src/Rectangle.ts:7](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L7)
68
-
69
- ___
70
-
71
- ### leftX
72
-
73
- • **leftX**: `number`
74
-
75
- #### Defined in
76
-
77
- [src/Rectangle.ts:7](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L7)
78
-
79
- ___
80
-
81
- ### rightX
82
-
83
- • **rightX**: `number`
84
-
85
- #### Defined in
86
-
87
- [src/Rectangle.ts:7](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L7)
88
-
89
- ___
90
-
91
- ### topY
92
-
93
- • **topY**: `number`
94
-
95
- #### Defined in
96
-
97
- [src/Rectangle.ts:7](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L7)
98
-
99
- ## Accessors
100
-
101
- ### center
102
-
103
- • `get` **center**(): [`Vec2`](Vec2.md)
104
-
105
- #### Returns
106
-
107
- [`Vec2`](Vec2.md)
108
-
109
- #### Defined in
110
-
111
- [src/Rectangle.ts:20](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L20)
112
-
113
- ___
114
-
115
- ### hasSize
116
-
117
- • `get` **hasSize**(): `boolean`
118
-
119
- #### Returns
120
-
121
- `boolean`
122
-
123
- #### Defined in
124
-
125
- [src/Rectangle.ts:41](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L41)
126
-
127
- ___
128
-
129
- ### offset
130
-
131
- • `get` **offset**(): [`Vec2`](Vec2.md)
132
-
133
- #### Returns
134
-
135
- [`Vec2`](Vec2.md)
136
-
137
- #### Defined in
138
-
139
- [src/Rectangle.ts:27](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L27)
140
-
141
- ___
142
-
143
- ### size
144
-
145
- • `get` **size**(): [`Vec2`](Vec2.md)
146
-
147
- #### Returns
148
-
149
- [`Vec2`](Vec2.md)
150
-
151
- #### Defined in
152
-
153
- [src/Rectangle.ts:13](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L13)
154
-
155
- ## Methods
156
-
157
- ### centerOnOrigin
158
-
159
- ▸ **centerOnOrigin**(): [`Rectangle`](Rectangle.md)
160
-
161
- #### Returns
162
-
163
- [`Rectangle`](Rectangle.md)
164
-
165
- #### Defined in
166
-
167
- [src/Rectangle.ts:54](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L54)
168
-
169
- ___
170
-
171
- ### clone
172
-
173
- ▸ **clone**(): [`Rectangle`](Rectangle.md)
174
-
175
- #### Returns
176
-
177
- [`Rectangle`](Rectangle.md)
178
-
179
- #### Defined in
180
-
181
- [src/Rectangle.ts:9](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L9)
182
-
183
- ___
184
-
185
- ### equals
186
-
187
- ▸ **equals**(`other`): `boolean`
188
-
189
- #### Parameters
190
-
191
- | Name | Type |
192
- | :------ | :------ |
193
- | `other` | [`Rectangle`](Rectangle.md) |
194
-
195
- #### Returns
196
-
197
- `boolean`
198
-
199
- #### Defined in
200
-
201
- [src/Rectangle.ts:90](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L90)
202
-
203
- ___
204
-
205
- ### flipVertical
206
-
207
- ▸ **flipVertical**(`xCenter`): [`Rectangle`](Rectangle.md)
208
-
209
- #### Parameters
210
-
211
- | Name | Type |
212
- | :------ | :------ |
213
- | `xCenter` | `number` |
214
-
215
- #### Returns
216
-
217
- [`Rectangle`](Rectangle.md)
218
-
219
- #### Defined in
220
-
221
- [src/Rectangle.ts:80](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L80)
222
-
223
- ___
224
-
225
- ### overlaps
226
-
227
- ▸ **overlaps**(`other`): `boolean`
228
-
229
- #### Parameters
230
-
231
- | Name | Type |
232
- | :------ | :------ |
233
- | `other` | [`Rectangle`](Rectangle.md) |
234
-
235
- #### Returns
236
-
237
- `boolean`
238
-
239
- #### Defined in
240
-
241
- [src/Rectangle.ts:34](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L34)
242
-
243
- ___
244
-
245
- ### toPoints
246
-
247
- ▸ **toPoints**(): [`Vec2`](Vec2.md)[]
248
-
249
- The polygon is always constructed as "clockwise", assuming X axis to the right and Y axis down.
250
-
251
- #### Returns
252
-
253
- [`Vec2`](Vec2.md)[]
254
-
255
- #### Defined in
256
-
257
- [src/Rectangle.ts:71](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L71)
258
-
259
- ___
260
-
261
- ### toPolygon
262
-
263
- ▸ **toPolygon**(): [`Polygon`](Polygon.md)
264
-
265
- #### Returns
266
-
267
- [`Polygon`](Polygon.md)
268
-
269
- #### Defined in
270
-
271
- [src/Rectangle.ts:64](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L64)
272
-
273
- ___
274
-
275
- ### translate
276
-
277
- ▸ **translate**(`diff`): [`Rectangle`](Rectangle.md)
278
-
279
- #### Parameters
280
-
281
- | Name | Type |
282
- | :------ | :------ |
283
- | `diff` | [`Point2`](../interfaces/Point2.md) |
284
-
285
- #### Returns
286
-
287
- [`Rectangle`](Rectangle.md)
288
-
289
- #### Defined in
290
-
291
- [src/Rectangle.ts:45](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L45)
1
+ [@immugio/three-math-extensions](../../README.md) / [Exports](../modules.md) / Rectangle
2
+
3
+ # Class: Rectangle
4
+
5
+ ## Table of contents
6
+
7
+ ### Constructors
8
+
9
+ - [constructor](Rectangle.md#constructor)
10
+
11
+ ### Properties
12
+
13
+ - [bottomY](Rectangle.md#bottomy)
14
+ - [leftX](Rectangle.md#leftx)
15
+ - [rightX](Rectangle.md#rightx)
16
+ - [topY](Rectangle.md#topy)
17
+
18
+ ### Accessors
19
+
20
+ - [center](Rectangle.md#center)
21
+ - [hasSize](Rectangle.md#hassize)
22
+ - [offset](Rectangle.md#offset)
23
+ - [size](Rectangle.md#size)
24
+
25
+ ### Methods
26
+
27
+ - [centerOnOrigin](Rectangle.md#centeronorigin)
28
+ - [clone](Rectangle.md#clone)
29
+ - [equals](Rectangle.md#equals)
30
+ - [flipVertical](Rectangle.md#flipvertical)
31
+ - [overlaps](Rectangle.md#overlaps)
32
+ - [toPoints](Rectangle.md#topoints)
33
+ - [toPolygon](Rectangle.md#topolygon)
34
+ - [translate](Rectangle.md#translate)
35
+
36
+ ## Constructors
37
+
38
+ ### constructor
39
+
40
+ • **new Rectangle**(`leftX`, `rightX`, `topY`, `bottomY`): [`Rectangle`](Rectangle.md)
41
+
42
+ #### Parameters
43
+
44
+ | Name | Type |
45
+ | :------ | :------ |
46
+ | `leftX` | `number` |
47
+ | `rightX` | `number` |
48
+ | `topY` | `number` |
49
+ | `bottomY` | `number` |
50
+
51
+ #### Returns
52
+
53
+ [`Rectangle`](Rectangle.md)
54
+
55
+ #### Defined in
56
+
57
+ [src/Rectangle.ts:7](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L7)
58
+
59
+ ## Properties
60
+
61
+ ### bottomY
62
+
63
+ • **bottomY**: `number`
64
+
65
+ #### Defined in
66
+
67
+ [src/Rectangle.ts:7](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L7)
68
+
69
+ ___
70
+
71
+ ### leftX
72
+
73
+ • **leftX**: `number`
74
+
75
+ #### Defined in
76
+
77
+ [src/Rectangle.ts:7](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L7)
78
+
79
+ ___
80
+
81
+ ### rightX
82
+
83
+ • **rightX**: `number`
84
+
85
+ #### Defined in
86
+
87
+ [src/Rectangle.ts:7](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L7)
88
+
89
+ ___
90
+
91
+ ### topY
92
+
93
+ • **topY**: `number`
94
+
95
+ #### Defined in
96
+
97
+ [src/Rectangle.ts:7](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L7)
98
+
99
+ ## Accessors
100
+
101
+ ### center
102
+
103
+ • `get` **center**(): [`Vec2`](Vec2.md)
104
+
105
+ #### Returns
106
+
107
+ [`Vec2`](Vec2.md)
108
+
109
+ #### Defined in
110
+
111
+ [src/Rectangle.ts:20](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L20)
112
+
113
+ ___
114
+
115
+ ### hasSize
116
+
117
+ • `get` **hasSize**(): `boolean`
118
+
119
+ #### Returns
120
+
121
+ `boolean`
122
+
123
+ #### Defined in
124
+
125
+ [src/Rectangle.ts:41](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L41)
126
+
127
+ ___
128
+
129
+ ### offset
130
+
131
+ • `get` **offset**(): [`Vec2`](Vec2.md)
132
+
133
+ #### Returns
134
+
135
+ [`Vec2`](Vec2.md)
136
+
137
+ #### Defined in
138
+
139
+ [src/Rectangle.ts:27](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L27)
140
+
141
+ ___
142
+
143
+ ### size
144
+
145
+ • `get` **size**(): [`Vec2`](Vec2.md)
146
+
147
+ #### Returns
148
+
149
+ [`Vec2`](Vec2.md)
150
+
151
+ #### Defined in
152
+
153
+ [src/Rectangle.ts:13](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L13)
154
+
155
+ ## Methods
156
+
157
+ ### centerOnOrigin
158
+
159
+ ▸ **centerOnOrigin**(): [`Rectangle`](Rectangle.md)
160
+
161
+ #### Returns
162
+
163
+ [`Rectangle`](Rectangle.md)
164
+
165
+ #### Defined in
166
+
167
+ [src/Rectangle.ts:54](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L54)
168
+
169
+ ___
170
+
171
+ ### clone
172
+
173
+ ▸ **clone**(): [`Rectangle`](Rectangle.md)
174
+
175
+ #### Returns
176
+
177
+ [`Rectangle`](Rectangle.md)
178
+
179
+ #### Defined in
180
+
181
+ [src/Rectangle.ts:9](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L9)
182
+
183
+ ___
184
+
185
+ ### equals
186
+
187
+ ▸ **equals**(`other`): `boolean`
188
+
189
+ #### Parameters
190
+
191
+ | Name | Type |
192
+ | :------ | :------ |
193
+ | `other` | [`Rectangle`](Rectangle.md) |
194
+
195
+ #### Returns
196
+
197
+ `boolean`
198
+
199
+ #### Defined in
200
+
201
+ [src/Rectangle.ts:90](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L90)
202
+
203
+ ___
204
+
205
+ ### flipVertical
206
+
207
+ ▸ **flipVertical**(`xCenter`): [`Rectangle`](Rectangle.md)
208
+
209
+ #### Parameters
210
+
211
+ | Name | Type |
212
+ | :------ | :------ |
213
+ | `xCenter` | `number` |
214
+
215
+ #### Returns
216
+
217
+ [`Rectangle`](Rectangle.md)
218
+
219
+ #### Defined in
220
+
221
+ [src/Rectangle.ts:80](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L80)
222
+
223
+ ___
224
+
225
+ ### overlaps
226
+
227
+ ▸ **overlaps**(`other`): `boolean`
228
+
229
+ #### Parameters
230
+
231
+ | Name | Type |
232
+ | :------ | :------ |
233
+ | `other` | [`Rectangle`](Rectangle.md) |
234
+
235
+ #### Returns
236
+
237
+ `boolean`
238
+
239
+ #### Defined in
240
+
241
+ [src/Rectangle.ts:34](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L34)
242
+
243
+ ___
244
+
245
+ ### toPoints
246
+
247
+ ▸ **toPoints**(): [`Vec2`](Vec2.md)[]
248
+
249
+ The polygon is always constructed as "clockwise", assuming X axis to the right and Y axis down.
250
+
251
+ #### Returns
252
+
253
+ [`Vec2`](Vec2.md)[]
254
+
255
+ #### Defined in
256
+
257
+ [src/Rectangle.ts:71](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L71)
258
+
259
+ ___
260
+
261
+ ### toPolygon
262
+
263
+ ▸ **toPolygon**(): [`Polygon`](Polygon.md)
264
+
265
+ #### Returns
266
+
267
+ [`Polygon`](Polygon.md)
268
+
269
+ #### Defined in
270
+
271
+ [src/Rectangle.ts:64](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L64)
272
+
273
+ ___
274
+
275
+ ### translate
276
+
277
+ ▸ **translate**(`diff`): [`Rectangle`](Rectangle.md)
278
+
279
+ #### Parameters
280
+
281
+ | Name | Type |
282
+ | :------ | :------ |
283
+ | `diff` | [`Point2`](../interfaces/Point2.md) |
284
+
285
+ #### Returns
286
+
287
+ [`Rectangle`](Rectangle.md)
288
+
289
+ #### Defined in
290
+
291
+ [src/Rectangle.ts:45](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Rectangle.ts#L45)
@@ -1,55 +1,55 @@
1
- [@immugio/three-math-extensions](../../README.md) / [Exports](../modules.md) / Size2
2
-
3
- # Class: Size2
4
-
5
- ## Table of contents
6
-
7
- ### Constructors
8
-
9
- - [constructor](Size2.md#constructor)
10
-
11
- ### Properties
12
-
13
- - [height](Size2.md#height)
14
- - [width](Size2.md#width)
15
-
16
- ## Constructors
17
-
18
- ### constructor
19
-
20
- • **new Size2**(`width`, `height`): [`Size2`](Size2.md)
21
-
22
- #### Parameters
23
-
24
- | Name | Type |
25
- | :------ | :------ |
26
- | `width` | `number` |
27
- | `height` | `number` |
28
-
29
- #### Returns
30
-
31
- [`Size2`](Size2.md)
32
-
33
- #### Defined in
34
-
35
- [src/Size2.ts:2](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Size2.ts#L2)
36
-
37
- ## Properties
38
-
39
- ### height
40
-
41
- • **height**: `number`
42
-
43
- #### Defined in
44
-
45
- [src/Size2.ts:2](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Size2.ts#L2)
46
-
47
- ___
48
-
49
- ### width
50
-
51
- • **width**: `number`
52
-
53
- #### Defined in
54
-
55
- [src/Size2.ts:2](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Size2.ts#L2)
1
+ [@immugio/three-math-extensions](../../README.md) / [Exports](../modules.md) / Size2
2
+
3
+ # Class: Size2
4
+
5
+ ## Table of contents
6
+
7
+ ### Constructors
8
+
9
+ - [constructor](Size2.md#constructor)
10
+
11
+ ### Properties
12
+
13
+ - [height](Size2.md#height)
14
+ - [width](Size2.md#width)
15
+
16
+ ## Constructors
17
+
18
+ ### constructor
19
+
20
+ • **new Size2**(`width`, `height`): [`Size2`](Size2.md)
21
+
22
+ #### Parameters
23
+
24
+ | Name | Type |
25
+ | :------ | :------ |
26
+ | `width` | `number` |
27
+ | `height` | `number` |
28
+
29
+ #### Returns
30
+
31
+ [`Size2`](Size2.md)
32
+
33
+ #### Defined in
34
+
35
+ [src/Size2.ts:2](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Size2.ts#L2)
36
+
37
+ ## Properties
38
+
39
+ ### height
40
+
41
+ • **height**: `number`
42
+
43
+ #### Defined in
44
+
45
+ [src/Size2.ts:2](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Size2.ts#L2)
46
+
47
+ ___
48
+
49
+ ### width
50
+
51
+ • **width**: `number`
52
+
53
+ #### Defined in
54
+
55
+ [src/Size2.ts:2](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Size2.ts#L2)