@immugio/three-math-extensions 0.2.21 → 0.2.23
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 +18 -96
- package/README.md +183 -1
- package/cjs/Line2D.js +79 -12
- package/cjs/Line3D.js +1 -1
- package/docs/classes/BoundingBox.md +13 -9
- package/docs/classes/Line2D.md +325 -80
- package/docs/classes/Line3D.md +155 -84
- package/docs/classes/Polygon.md +23 -19
- package/docs/classes/Rectangle.md +23 -19
- package/docs/classes/Size2.md +9 -5
- package/docs/classes/Vec2.md +62 -12
- package/docs/classes/Vec3.md +65 -15
- package/docs/interfaces/Point2.md +3 -3
- package/docs/interfaces/Point3.md +4 -4
- package/docs/modules.md +86 -5
- package/esm/Line2D.js +79 -12
- package/esm/Line3D.js +1 -1
- package/package.json +1 -1
- package/src/Line2D.ts +93 -12
- package/src/Line3D.ts +1 -1
- package/types/Line2D.d.ts +28 -2
- package/types/Line3D.d.ts +1 -1
- package/docs/README.md +0 -90
package/docs/classes/Line2D.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[@immugio/three-math-extensions](
|
|
1
|
+
[@immugio/three-math-extensions](../../README.md) / [Exports](../modules.md) / Line2D
|
|
2
2
|
|
|
3
3
|
# Class: Line2D
|
|
4
4
|
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
- [center](Line2D.md#center)
|
|
20
20
|
- [direction](Line2D.md#direction)
|
|
21
21
|
- [endpoints](Line2D.md#endpoints)
|
|
22
|
+
- [isCloserToHorizontal](Line2D.md#isclosertohorizontal)
|
|
23
|
+
- [isCloserToVertical](Line2D.md#isclosertovertical)
|
|
22
24
|
- [length](Line2D.md#length)
|
|
23
25
|
|
|
24
26
|
### Methods
|
|
@@ -27,17 +29,23 @@
|
|
|
27
29
|
- [clone](Line2D.md#clone)
|
|
28
30
|
- [closestPointToPoint](Line2D.md#closestpointtopoint)
|
|
29
31
|
- [closestPointToPointParameter](Line2D.md#closestpointtopointparameter)
|
|
32
|
+
- [connectsTo](Line2D.md#connectsto)
|
|
33
|
+
- [containsPoint](Line2D.md#containspoint)
|
|
34
|
+
- [covers](Line2D.md#covers)
|
|
30
35
|
- [delta](Line2D.md#delta)
|
|
36
|
+
- [distanceToPoint](Line2D.md#distancetopoint)
|
|
31
37
|
- [distanceToPointOnInfiniteLine](Line2D.md#distancetopointoninfiniteline)
|
|
32
38
|
- [equals](Line2D.md#equals)
|
|
33
39
|
- [extendToEnds](Line2D.md#extendtoends)
|
|
34
40
|
- [extendToOrTrimAtIntersection](Line2D.md#extendtoortrimatintersection)
|
|
35
41
|
- [flip](Line2D.md#flip)
|
|
36
42
|
- [getOverlap](Line2D.md#getoverlap)
|
|
43
|
+
- [getParallelLineInTheSameDirection](Line2D.md#getparallellineinthesamedirection)
|
|
37
44
|
- [hasIntersectionWithAngle](Line2D.md#hasintersectionwithangle)
|
|
38
45
|
- [in3DSpace](Line2D.md#in3dspace)
|
|
39
46
|
- [intersect](Line2D.md#intersect)
|
|
40
47
|
- [isCollinearWithTouchOrOverlap](Line2D.md#iscollinearwithtouchoroverlap)
|
|
48
|
+
- [isParallelTo](Line2D.md#isparallelto)
|
|
41
49
|
- [isPointBesideLineSection](Line2D.md#ispointbesidelinesection)
|
|
42
50
|
- [isPointCloseToAndBesideLineSection](Line2D.md#ispointclosetoandbesidelinesection)
|
|
43
51
|
- [isPointOnInfiniteLine](Line2D.md#ispointoninfiniteline)
|
|
@@ -45,6 +53,7 @@
|
|
|
45
53
|
- [moveEndPoint](Line2D.md#moveendpoint)
|
|
46
54
|
- [moveStartPoint](Line2D.md#movestartpoint)
|
|
47
55
|
- [overlaps](Line2D.md#overlaps)
|
|
56
|
+
- [projectOn](Line2D.md#projecton)
|
|
48
57
|
- [resize](Line2D.md#resize)
|
|
49
58
|
- [rotate](Line2D.md#rotate)
|
|
50
59
|
- [setCenter](Line2D.md#setcenter)
|
|
@@ -61,6 +70,7 @@
|
|
|
61
70
|
- [fromLength](Line2D.md#fromlength)
|
|
62
71
|
- [fromPoints](Line2D.md#frompoints)
|
|
63
72
|
- [fromPolygon](Line2D.md#frompolygon)
|
|
73
|
+
- [groupConnectedLines](Line2D.md#groupconnectedlines)
|
|
64
74
|
- [joinLine](Line2D.md#joinline)
|
|
65
75
|
- [joinLines](Line2D.md#joinlines)
|
|
66
76
|
|
|
@@ -68,7 +78,7 @@
|
|
|
68
78
|
|
|
69
79
|
### constructor
|
|
70
80
|
|
|
71
|
-
• **new Line2D**(`start`, `end`, `index?`)
|
|
81
|
+
• **new Line2D**(`start`, `end`, `index?`): [`Line2D`](Line2D.md)
|
|
72
82
|
|
|
73
83
|
#### Parameters
|
|
74
84
|
|
|
@@ -78,9 +88,13 @@
|
|
|
78
88
|
| `end` | [`Vec2`](Vec2.md) | `undefined` |
|
|
79
89
|
| `index` | `number` | `0` |
|
|
80
90
|
|
|
91
|
+
#### Returns
|
|
92
|
+
|
|
93
|
+
[`Line2D`](Line2D.md)
|
|
94
|
+
|
|
81
95
|
#### Defined in
|
|
82
96
|
|
|
83
|
-
[src/Line2D.ts:
|
|
97
|
+
[src/Line2D.ts:15](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L15)
|
|
84
98
|
|
|
85
99
|
## Properties
|
|
86
100
|
|
|
@@ -90,7 +104,7 @@
|
|
|
90
104
|
|
|
91
105
|
#### Defined in
|
|
92
106
|
|
|
93
|
-
[src/Line2D.ts:
|
|
107
|
+
[src/Line2D.ts:15](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L15)
|
|
94
108
|
|
|
95
109
|
___
|
|
96
110
|
|
|
@@ -100,7 +114,7 @@ ___
|
|
|
100
114
|
|
|
101
115
|
#### Defined in
|
|
102
116
|
|
|
103
|
-
[src/Line2D.ts:
|
|
117
|
+
[src/Line2D.ts:15](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L15)
|
|
104
118
|
|
|
105
119
|
___
|
|
106
120
|
|
|
@@ -110,7 +124,7 @@ ___
|
|
|
110
124
|
|
|
111
125
|
#### Defined in
|
|
112
126
|
|
|
113
|
-
[src/Line2D.ts:
|
|
127
|
+
[src/Line2D.ts:15](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L15)
|
|
114
128
|
|
|
115
129
|
## Accessors
|
|
116
130
|
|
|
@@ -124,7 +138,7 @@ ___
|
|
|
124
138
|
|
|
125
139
|
#### Defined in
|
|
126
140
|
|
|
127
|
-
[src/Line2D.ts:
|
|
141
|
+
[src/Line2D.ts:52](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L52)
|
|
128
142
|
|
|
129
143
|
• `set` **center**(`value`): `void`
|
|
130
144
|
|
|
@@ -143,7 +157,7 @@ Modifies this line.
|
|
|
143
157
|
|
|
144
158
|
#### Defined in
|
|
145
159
|
|
|
146
|
-
[src/Line2D.ts:
|
|
160
|
+
[src/Line2D.ts:61](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L61)
|
|
147
161
|
|
|
148
162
|
___
|
|
149
163
|
|
|
@@ -159,7 +173,7 @@ Returns the direction of this line.
|
|
|
159
173
|
|
|
160
174
|
#### Defined in
|
|
161
175
|
|
|
162
|
-
[src/Line2D.ts:
|
|
176
|
+
[src/Line2D.ts:209](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L209)
|
|
163
177
|
|
|
164
178
|
___
|
|
165
179
|
|
|
@@ -176,7 +190,35 @@ Endpoints are not cloned.
|
|
|
176
190
|
|
|
177
191
|
#### Defined in
|
|
178
192
|
|
|
179
|
-
[src/Line2D.ts:
|
|
193
|
+
[src/Line2D.ts:161](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L161)
|
|
194
|
+
|
|
195
|
+
___
|
|
196
|
+
|
|
197
|
+
### isCloserToHorizontal
|
|
198
|
+
|
|
199
|
+
• `get` **isCloserToHorizontal**(): `boolean`
|
|
200
|
+
|
|
201
|
+
#### Returns
|
|
202
|
+
|
|
203
|
+
`boolean`
|
|
204
|
+
|
|
205
|
+
#### Defined in
|
|
206
|
+
|
|
207
|
+
[src/Line2D.ts:766](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L766)
|
|
208
|
+
|
|
209
|
+
___
|
|
210
|
+
|
|
211
|
+
### isCloserToVertical
|
|
212
|
+
|
|
213
|
+
• `get` **isCloserToVertical**(): `boolean`
|
|
214
|
+
|
|
215
|
+
#### Returns
|
|
216
|
+
|
|
217
|
+
`boolean`
|
|
218
|
+
|
|
219
|
+
#### Defined in
|
|
220
|
+
|
|
221
|
+
[src/Line2D.ts:771](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L771)
|
|
180
222
|
|
|
181
223
|
___
|
|
182
224
|
|
|
@@ -190,7 +232,7 @@ ___
|
|
|
190
232
|
|
|
191
233
|
#### Defined in
|
|
192
234
|
|
|
193
|
-
[src/Line2D.ts:
|
|
235
|
+
[src/Line2D.ts:144](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L144)
|
|
194
236
|
|
|
195
237
|
• `set` **length**(`l`): `void`
|
|
196
238
|
|
|
@@ -209,7 +251,7 @@ Modifies this line.
|
|
|
209
251
|
|
|
210
252
|
#### Defined in
|
|
211
253
|
|
|
212
|
-
[src/Line2D.ts:
|
|
254
|
+
[src/Line2D.ts:139](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L139)
|
|
213
255
|
|
|
214
256
|
## Methods
|
|
215
257
|
|
|
@@ -232,7 +274,7 @@ Clone the line, does not modify.
|
|
|
232
274
|
|
|
233
275
|
#### Defined in
|
|
234
276
|
|
|
235
|
-
[src/Line2D.ts:
|
|
277
|
+
[src/Line2D.ts:479](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L479)
|
|
236
278
|
|
|
237
279
|
___
|
|
238
280
|
|
|
@@ -248,7 +290,7 @@ Deep clone of this line
|
|
|
248
290
|
|
|
249
291
|
#### Defined in
|
|
250
292
|
|
|
251
|
-
[src/Line2D.ts:
|
|
293
|
+
[src/Line2D.ts:850](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L850)
|
|
252
294
|
|
|
253
295
|
___
|
|
254
296
|
|
|
@@ -272,7 +314,7 @@ Returns the closest point on the line to the given point.
|
|
|
272
314
|
|
|
273
315
|
#### Defined in
|
|
274
316
|
|
|
275
|
-
[src/Line2D.ts:
|
|
317
|
+
[src/Line2D.ts:498](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L498)
|
|
276
318
|
|
|
277
319
|
___
|
|
278
320
|
|
|
@@ -293,7 +335,84 @@ ___
|
|
|
293
335
|
|
|
294
336
|
#### Defined in
|
|
295
337
|
|
|
296
|
-
[src/Line2D.ts:
|
|
338
|
+
[src/Line2D.ts:507](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L507)
|
|
339
|
+
|
|
340
|
+
___
|
|
341
|
+
|
|
342
|
+
### connectsTo
|
|
343
|
+
|
|
344
|
+
▸ **connectsTo**(`other`, `tolerance?`, `breakpoints?`): `boolean`
|
|
345
|
+
|
|
346
|
+
Returns true if any endpoint of this line is within the tolerance of any
|
|
347
|
+
|
|
348
|
+
#### Parameters
|
|
349
|
+
|
|
350
|
+
| Name | Type | Default value |
|
|
351
|
+
| :------ | :------ | :------ |
|
|
352
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
353
|
+
| `tolerance` | `number` | `0` |
|
|
354
|
+
| `breakpoints` | [`Vec2`](Vec2.md)[] | `[]` |
|
|
355
|
+
|
|
356
|
+
#### Returns
|
|
357
|
+
|
|
358
|
+
`boolean`
|
|
359
|
+
|
|
360
|
+
**`Other`**
|
|
361
|
+
|
|
362
|
+
line's endpoints.
|
|
363
|
+
|
|
364
|
+
#### Defined in
|
|
365
|
+
|
|
366
|
+
[src/Line2D.ts:821](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L821)
|
|
367
|
+
|
|
368
|
+
___
|
|
369
|
+
|
|
370
|
+
### containsPoint
|
|
371
|
+
|
|
372
|
+
▸ **containsPoint**(`p`, `tolerance?`): `boolean`
|
|
373
|
+
|
|
374
|
+
Check that this line segment contains provided point.
|
|
375
|
+
|
|
376
|
+
#### Parameters
|
|
377
|
+
|
|
378
|
+
| Name | Type | Default value |
|
|
379
|
+
| :------ | :------ | :------ |
|
|
380
|
+
| `p` | `Vector2` | `undefined` |
|
|
381
|
+
| `tolerance` | `number` | `0` |
|
|
382
|
+
|
|
383
|
+
#### Returns
|
|
384
|
+
|
|
385
|
+
`boolean`
|
|
386
|
+
|
|
387
|
+
#### Defined in
|
|
388
|
+
|
|
389
|
+
[src/Line2D.ts:170](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L170)
|
|
390
|
+
|
|
391
|
+
___
|
|
392
|
+
|
|
393
|
+
### covers
|
|
394
|
+
|
|
395
|
+
▸ **covers**(`other`, `tolerance?`, `parallelTolerance?`): `boolean`
|
|
396
|
+
|
|
397
|
+
Checks if the current line covers another line.
|
|
398
|
+
A line is considered to cover another line if they are parallel and both the start and end points of the other line are contained within the current line.
|
|
399
|
+
Both distance and angle tolerance can be provided.
|
|
400
|
+
|
|
401
|
+
#### Parameters
|
|
402
|
+
|
|
403
|
+
| Name | Type | Default value |
|
|
404
|
+
| :------ | :------ | :------ |
|
|
405
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
406
|
+
| `tolerance` | `number` | `0` |
|
|
407
|
+
| `parallelTolerance` | `number` | `0` |
|
|
408
|
+
|
|
409
|
+
#### Returns
|
|
410
|
+
|
|
411
|
+
`boolean`
|
|
412
|
+
|
|
413
|
+
#### Defined in
|
|
414
|
+
|
|
415
|
+
[src/Line2D.ts:454](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L454)
|
|
297
416
|
|
|
298
417
|
___
|
|
299
418
|
|
|
@@ -313,7 +432,30 @@ ___
|
|
|
313
432
|
|
|
314
433
|
#### Defined in
|
|
315
434
|
|
|
316
|
-
[src/Line2D.ts:
|
|
435
|
+
[src/Line2D.ts:503](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L503)
|
|
436
|
+
|
|
437
|
+
___
|
|
438
|
+
|
|
439
|
+
### distanceToPoint
|
|
440
|
+
|
|
441
|
+
▸ **distanceToPoint**(`p`, `clampToLine?`): `number`
|
|
442
|
+
|
|
443
|
+
Distance from this line to the provided point.
|
|
444
|
+
|
|
445
|
+
#### Parameters
|
|
446
|
+
|
|
447
|
+
| Name | Type | Default value |
|
|
448
|
+
| :------ | :------ | :------ |
|
|
449
|
+
| `p` | `Vector2` | `undefined` |
|
|
450
|
+
| `clampToLine` | `boolean` | `true` |
|
|
451
|
+
|
|
452
|
+
#### Returns
|
|
453
|
+
|
|
454
|
+
`number`
|
|
455
|
+
|
|
456
|
+
#### Defined in
|
|
457
|
+
|
|
458
|
+
[src/Line2D.ts:180](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L180)
|
|
317
459
|
|
|
318
460
|
___
|
|
319
461
|
|
|
@@ -335,19 +477,20 @@ Returns the distance between the **infinite** line and the point.
|
|
|
335
477
|
|
|
336
478
|
#### Defined in
|
|
337
479
|
|
|
338
|
-
[src/Line2D.ts:
|
|
480
|
+
[src/Line2D.ts:527](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L527)
|
|
339
481
|
|
|
340
482
|
___
|
|
341
483
|
|
|
342
484
|
### equals
|
|
343
485
|
|
|
344
|
-
▸ **equals**(`other`): `boolean`
|
|
486
|
+
▸ **equals**(`other`, `tolerance?`): `boolean`
|
|
345
487
|
|
|
346
488
|
#### Parameters
|
|
347
489
|
|
|
348
|
-
| Name | Type |
|
|
349
|
-
| :------ | :------ |
|
|
350
|
-
| `other` | [`Line2D`](Line2D.md) |
|
|
490
|
+
| Name | Type | Default value |
|
|
491
|
+
| :------ | :------ | :------ |
|
|
492
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
493
|
+
| `tolerance` | `number` | `0` |
|
|
351
494
|
|
|
352
495
|
#### Returns
|
|
353
496
|
|
|
@@ -355,7 +498,7 @@ ___
|
|
|
355
498
|
|
|
356
499
|
#### Defined in
|
|
357
500
|
|
|
358
|
-
[src/Line2D.ts:
|
|
501
|
+
[src/Line2D.ts:839](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L839)
|
|
359
502
|
|
|
360
503
|
___
|
|
361
504
|
|
|
@@ -379,7 +522,7 @@ Does not create a copy. Provided line is modified.
|
|
|
379
522
|
|
|
380
523
|
#### Defined in
|
|
381
524
|
|
|
382
|
-
[src/Line2D.ts:
|
|
525
|
+
[src/Line2D.ts:664](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L664)
|
|
383
526
|
|
|
384
527
|
___
|
|
385
528
|
|
|
@@ -403,7 +546,7 @@ Modifies this line.
|
|
|
403
546
|
|
|
404
547
|
#### Defined in
|
|
405
548
|
|
|
406
|
-
[src/Line2D.ts:
|
|
549
|
+
[src/Line2D.ts:685](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L685)
|
|
407
550
|
|
|
408
551
|
___
|
|
409
552
|
|
|
@@ -420,7 +563,7 @@ Modifies this line.
|
|
|
420
563
|
|
|
421
564
|
#### Defined in
|
|
422
565
|
|
|
423
|
-
[src/Line2D.ts:
|
|
566
|
+
[src/Line2D.ts:217](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L217)
|
|
424
567
|
|
|
425
568
|
___
|
|
426
569
|
|
|
@@ -442,7 +585,39 @@ Logical AND of this and the other line section.
|
|
|
442
585
|
|
|
443
586
|
#### Defined in
|
|
444
587
|
|
|
445
|
-
[src/Line2D.ts:
|
|
588
|
+
[src/Line2D.ts:367](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L367)
|
|
589
|
+
|
|
590
|
+
___
|
|
591
|
+
|
|
592
|
+
### getParallelLineInTheSameDirection
|
|
593
|
+
|
|
594
|
+
▸ **getParallelLineInTheSameDirection**(`other`, `parallelTolerance?`): [`Line2D`](Line2D.md)
|
|
595
|
+
|
|
596
|
+
Returns a copy of
|
|
597
|
+
|
|
598
|
+
#### Parameters
|
|
599
|
+
|
|
600
|
+
| Name | Type | Default value |
|
|
601
|
+
| :------ | :------ | :------ |
|
|
602
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
603
|
+
| `parallelTolerance` | `number` | `0` |
|
|
604
|
+
|
|
605
|
+
#### Returns
|
|
606
|
+
|
|
607
|
+
[`Line2D`](Line2D.md)
|
|
608
|
+
|
|
609
|
+
**`Other`**
|
|
610
|
+
|
|
611
|
+
line, the direction of
|
|
612
|
+
|
|
613
|
+
**`Other`**
|
|
614
|
+
|
|
615
|
+
is reversed if needed.
|
|
616
|
+
Returns null if lines are not parallel.
|
|
617
|
+
|
|
618
|
+
#### Defined in
|
|
619
|
+
|
|
620
|
+
[src/Line2D.ts:191](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L191)
|
|
446
621
|
|
|
447
622
|
___
|
|
448
623
|
|
|
@@ -467,7 +642,7 @@ Check that the line section intersect and that they are in the specified angle t
|
|
|
467
642
|
|
|
468
643
|
#### Defined in
|
|
469
644
|
|
|
470
|
-
[src/Line2D.ts:
|
|
645
|
+
[src/Line2D.ts:747](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L747)
|
|
471
646
|
|
|
472
647
|
___
|
|
473
648
|
|
|
@@ -491,7 +666,7 @@ A new Line3D instance.
|
|
|
491
666
|
|
|
492
667
|
#### Defined in
|
|
493
668
|
|
|
494
|
-
[src/Line2D.ts:
|
|
669
|
+
[src/Line2D.ts:835](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L835)
|
|
495
670
|
|
|
496
671
|
___
|
|
497
672
|
|
|
@@ -514,7 +689,7 @@ Returns the intersection point of two lines.
|
|
|
514
689
|
|
|
515
690
|
#### Defined in
|
|
516
691
|
|
|
517
|
-
[src/Line2D.ts:
|
|
692
|
+
[src/Line2D.ts:710](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L710)
|
|
518
693
|
|
|
519
694
|
___
|
|
520
695
|
|
|
@@ -536,7 +711,28 @@ Returns true if other line is collinear and overlaps or at least touching this l
|
|
|
536
711
|
|
|
537
712
|
#### Defined in
|
|
538
713
|
|
|
539
|
-
[src/Line2D.ts:
|
|
714
|
+
[src/Line2D.ts:317](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L317)
|
|
715
|
+
|
|
716
|
+
___
|
|
717
|
+
|
|
718
|
+
### isParallelTo
|
|
719
|
+
|
|
720
|
+
▸ **isParallelTo**(`other`, `angleTolerance?`): `boolean`
|
|
721
|
+
|
|
722
|
+
#### Parameters
|
|
723
|
+
|
|
724
|
+
| Name | Type | Default value |
|
|
725
|
+
| :------ | :------ | :------ |
|
|
726
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
727
|
+
| `angleTolerance` | `number` | `Number.EPSILON` |
|
|
728
|
+
|
|
729
|
+
#### Returns
|
|
730
|
+
|
|
731
|
+
`boolean`
|
|
732
|
+
|
|
733
|
+
#### Defined in
|
|
734
|
+
|
|
735
|
+
[src/Line2D.ts:91](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L91)
|
|
540
736
|
|
|
541
737
|
___
|
|
542
738
|
|
|
@@ -558,7 +754,7 @@ Returns true when the point is beside the line **segment**
|
|
|
558
754
|
|
|
559
755
|
#### Defined in
|
|
560
756
|
|
|
561
|
-
[src/Line2D.ts:
|
|
757
|
+
[src/Line2D.ts:297](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L297)
|
|
562
758
|
|
|
563
759
|
___
|
|
564
760
|
|
|
@@ -581,7 +777,7 @@ Returns true when the point is beside the line **segment** and within the maxDis
|
|
|
581
777
|
|
|
582
778
|
#### Defined in
|
|
583
779
|
|
|
584
|
-
[src/Line2D.ts:
|
|
780
|
+
[src/Line2D.ts:288](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L288)
|
|
585
781
|
|
|
586
782
|
___
|
|
587
783
|
|
|
@@ -603,7 +799,7 @@ Returns true when the point is on the **infinite** line.
|
|
|
603
799
|
|
|
604
800
|
#### Defined in
|
|
605
801
|
|
|
606
|
-
[src/Line2D.ts:
|
|
802
|
+
[src/Line2D.ts:309](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L309)
|
|
607
803
|
|
|
608
804
|
___
|
|
609
805
|
|
|
@@ -627,7 +823,7 @@ https://stackoverflow.com/questions/6865832/detecting-if-a-point-is-of-a-line-se
|
|
|
627
823
|
|
|
628
824
|
#### Defined in
|
|
629
825
|
|
|
630
|
-
[src/Line2D.ts:
|
|
826
|
+
[src/Line2D.ts:275](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L275)
|
|
631
827
|
|
|
632
828
|
___
|
|
633
829
|
|
|
@@ -650,7 +846,7 @@ Modifies this line.
|
|
|
650
846
|
|
|
651
847
|
#### Defined in
|
|
652
848
|
|
|
653
|
-
[src/Line2D.ts:
|
|
849
|
+
[src/Line2D.ts:119](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L119)
|
|
654
850
|
|
|
655
851
|
___
|
|
656
852
|
|
|
@@ -670,33 +866,58 @@ ___
|
|
|
670
866
|
|
|
671
867
|
#### Defined in
|
|
672
868
|
|
|
673
|
-
[src/Line2D.ts:
|
|
869
|
+
[src/Line2D.ts:108](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L108)
|
|
674
870
|
|
|
675
871
|
___
|
|
676
872
|
|
|
677
873
|
### overlaps
|
|
678
874
|
|
|
679
|
-
▸ **overlaps**(`other`): `boolean`
|
|
875
|
+
▸ **overlaps**(`other`, `distanceTolerance?`, `parallelTolerance?`): `boolean`
|
|
680
876
|
|
|
681
877
|
Returns true if there is any overlap between this line and the
|
|
682
878
|
|
|
879
|
+
#### Parameters
|
|
880
|
+
|
|
881
|
+
| Name | Type | Default value |
|
|
882
|
+
| :------ | :------ | :------ |
|
|
883
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
884
|
+
| `distanceTolerance` | `number` | `0` |
|
|
885
|
+
| `parallelTolerance` | `number` | `0` |
|
|
886
|
+
|
|
887
|
+
#### Returns
|
|
888
|
+
|
|
889
|
+
`boolean`
|
|
890
|
+
|
|
683
891
|
**`Other`**
|
|
684
892
|
|
|
685
893
|
line section.
|
|
686
894
|
|
|
895
|
+
#### Defined in
|
|
896
|
+
|
|
897
|
+
[src/Line2D.ts:329](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L329)
|
|
898
|
+
|
|
899
|
+
___
|
|
900
|
+
|
|
901
|
+
### projectOn
|
|
902
|
+
|
|
903
|
+
▸ **projectOn**(`other`, `clampToLine`): [`Line2D`](Line2D.md)
|
|
904
|
+
|
|
905
|
+
Returns a new line that is the projection of this line onto @other. Uses `closestPointToPoint` to find the projection.
|
|
906
|
+
|
|
687
907
|
#### Parameters
|
|
688
908
|
|
|
689
909
|
| Name | Type |
|
|
690
910
|
| :------ | :------ |
|
|
691
911
|
| `other` | [`Line2D`](Line2D.md) |
|
|
912
|
+
| `clampToLine` | `boolean` |
|
|
692
913
|
|
|
693
914
|
#### Returns
|
|
694
915
|
|
|
695
|
-
`
|
|
916
|
+
[`Line2D`](Line2D.md)
|
|
696
917
|
|
|
697
918
|
#### Defined in
|
|
698
919
|
|
|
699
|
-
[src/Line2D.ts:
|
|
920
|
+
[src/Line2D.ts:467](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L467)
|
|
700
921
|
|
|
701
922
|
___
|
|
702
923
|
|
|
@@ -716,7 +937,7 @@ ___
|
|
|
716
937
|
|
|
717
938
|
#### Defined in
|
|
718
939
|
|
|
719
|
-
[src/Line2D.ts:
|
|
940
|
+
[src/Line2D.ts:85](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L85)
|
|
720
941
|
|
|
721
942
|
___
|
|
722
943
|
|
|
@@ -740,7 +961,7 @@ Modifies this line.
|
|
|
740
961
|
|
|
741
962
|
#### Defined in
|
|
742
963
|
|
|
743
|
-
[src/Line2D.ts:
|
|
964
|
+
[src/Line2D.ts:231](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L231)
|
|
744
965
|
|
|
745
966
|
___
|
|
746
967
|
|
|
@@ -763,7 +984,7 @@ Modifies this line.
|
|
|
763
984
|
|
|
764
985
|
#### Defined in
|
|
765
986
|
|
|
766
|
-
[src/Line2D.ts:
|
|
987
|
+
[src/Line2D.ts:76](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L76)
|
|
767
988
|
|
|
768
989
|
___
|
|
769
990
|
|
|
@@ -785,7 +1006,7 @@ Set the length of this line. Center and direction remain unchanged.
|
|
|
785
1006
|
|
|
786
1007
|
#### Defined in
|
|
787
1008
|
|
|
788
|
-
[src/Line2D.ts:
|
|
1009
|
+
[src/Line2D.ts:152](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L152)
|
|
789
1010
|
|
|
790
1011
|
___
|
|
791
1012
|
|
|
@@ -808,7 +1029,7 @@ Returns the original line section split into two parts, if the line **sections**
|
|
|
808
1029
|
|
|
809
1030
|
#### Defined in
|
|
810
1031
|
|
|
811
|
-
[src/Line2D.ts:
|
|
1032
|
+
[src/Line2D.ts:580](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L580)
|
|
812
1033
|
|
|
813
1034
|
___
|
|
814
1035
|
|
|
@@ -832,7 +1053,7 @@ Otherwise, null if the lines are parallel and do not intersect
|
|
|
832
1053
|
|
|
833
1054
|
#### Defined in
|
|
834
1055
|
|
|
835
|
-
[src/Line2D.ts:
|
|
1056
|
+
[src/Line2D.ts:599](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L599)
|
|
836
1057
|
|
|
837
1058
|
___
|
|
838
1059
|
|
|
@@ -846,7 +1067,7 @@ ___
|
|
|
846
1067
|
|
|
847
1068
|
#### Defined in
|
|
848
1069
|
|
|
849
|
-
[src/Line2D.ts:
|
|
1070
|
+
[src/Line2D.ts:854](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L854)
|
|
850
1071
|
|
|
851
1072
|
___
|
|
852
1073
|
|
|
@@ -869,7 +1090,7 @@ Modifies this line.
|
|
|
869
1090
|
|
|
870
1091
|
#### Defined in
|
|
871
1092
|
|
|
872
|
-
[src/Line2D.ts:
|
|
1093
|
+
[src/Line2D.ts:242](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L242)
|
|
873
1094
|
|
|
874
1095
|
___
|
|
875
1096
|
|
|
@@ -892,7 +1113,7 @@ Modifies this line.
|
|
|
892
1113
|
|
|
893
1114
|
#### Defined in
|
|
894
1115
|
|
|
895
|
-
[src/Line2D.ts:
|
|
1116
|
+
[src/Line2D.ts:255](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L255)
|
|
896
1117
|
|
|
897
1118
|
___
|
|
898
1119
|
|
|
@@ -915,7 +1136,7 @@ Modifies this line.
|
|
|
915
1136
|
|
|
916
1137
|
#### Defined in
|
|
917
1138
|
|
|
918
|
-
[src/Line2D.ts:
|
|
1139
|
+
[src/Line2D.ts:264](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L264)
|
|
919
1140
|
|
|
920
1141
|
___
|
|
921
1142
|
|
|
@@ -938,22 +1159,16 @@ Does not create a copy. Provided line is modified.
|
|
|
938
1159
|
|
|
939
1160
|
#### Defined in
|
|
940
1161
|
|
|
941
|
-
[src/Line2D.ts:
|
|
1162
|
+
[src/Line2D.ts:642](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L642)
|
|
942
1163
|
|
|
943
1164
|
___
|
|
944
1165
|
|
|
945
1166
|
### clipLines
|
|
946
1167
|
|
|
947
|
-
▸
|
|
1168
|
+
▸ **clipLines**(`source`, `clips`): [`Line2D`](Line2D.md)[]
|
|
948
1169
|
|
|
949
1170
|
Returns lines that are the result of clipping
|
|
950
1171
|
|
|
951
|
-
**`Source`**
|
|
952
|
-
|
|
953
|
-
line by the @clips.
|
|
954
|
-
Clips must be parallel to this line.
|
|
955
|
-
Clones the line, does not modify this.
|
|
956
|
-
|
|
957
1172
|
#### Parameters
|
|
958
1173
|
|
|
959
1174
|
| Name | Type |
|
|
@@ -965,15 +1180,21 @@ Clones the line, does not modify this.
|
|
|
965
1180
|
|
|
966
1181
|
[`Line2D`](Line2D.md)[]
|
|
967
1182
|
|
|
1183
|
+
**`Source`**
|
|
1184
|
+
|
|
1185
|
+
line by the @clips.
|
|
1186
|
+
Clips must be parallel to this line.
|
|
1187
|
+
Clones the line, does not modify this.
|
|
1188
|
+
|
|
968
1189
|
#### Defined in
|
|
969
1190
|
|
|
970
|
-
[src/Line2D.ts:
|
|
1191
|
+
[src/Line2D.ts:541](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L541)
|
|
971
1192
|
|
|
972
1193
|
___
|
|
973
1194
|
|
|
974
1195
|
### fromCoordinates
|
|
975
1196
|
|
|
976
|
-
▸
|
|
1197
|
+
▸ **fromCoordinates**(`x1`, `y1`, `x2`, `y2`, `index?`): [`Line2D`](Line2D.md)
|
|
977
1198
|
|
|
978
1199
|
#### Parameters
|
|
979
1200
|
|
|
@@ -991,13 +1212,13 @@ ___
|
|
|
991
1212
|
|
|
992
1213
|
#### Defined in
|
|
993
1214
|
|
|
994
|
-
[src/Line2D.ts:
|
|
1215
|
+
[src/Line2D.ts:18](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L18)
|
|
995
1216
|
|
|
996
1217
|
___
|
|
997
1218
|
|
|
998
1219
|
### fromLength
|
|
999
1220
|
|
|
1000
|
-
▸
|
|
1221
|
+
▸ **fromLength**(`length`): [`Line2D`](Line2D.md)
|
|
1001
1222
|
|
|
1002
1223
|
#### Parameters
|
|
1003
1224
|
|
|
@@ -1011,13 +1232,13 @@ ___
|
|
|
1011
1232
|
|
|
1012
1233
|
#### Defined in
|
|
1013
1234
|
|
|
1014
|
-
[src/Line2D.ts:
|
|
1235
|
+
[src/Line2D.ts:48](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L48)
|
|
1015
1236
|
|
|
1016
1237
|
___
|
|
1017
1238
|
|
|
1018
1239
|
### fromPoints
|
|
1019
1240
|
|
|
1020
|
-
▸
|
|
1241
|
+
▸ **fromPoints**(`p1`, `p2`, `index?`): [`Line2D`](Line2D.md)
|
|
1021
1242
|
|
|
1022
1243
|
#### Parameters
|
|
1023
1244
|
|
|
@@ -1033,13 +1254,13 @@ ___
|
|
|
1033
1254
|
|
|
1034
1255
|
#### Defined in
|
|
1035
1256
|
|
|
1036
|
-
[src/Line2D.ts:
|
|
1257
|
+
[src/Line2D.ts:22](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L22)
|
|
1037
1258
|
|
|
1038
1259
|
___
|
|
1039
1260
|
|
|
1040
1261
|
### fromPolygon
|
|
1041
1262
|
|
|
1042
|
-
▸
|
|
1263
|
+
▸ **fromPolygon**(`polygon`, `forceClosedPolygon?`): [`Line2D`](Line2D.md)[]
|
|
1043
1264
|
|
|
1044
1265
|
Creates a polygon formed by an array of lines from points provided.
|
|
1045
1266
|
The polygon will only be closed if either
|
|
@@ -1058,26 +1279,39 @@ The polygon will only be closed if either
|
|
|
1058
1279
|
|
|
1059
1280
|
#### Defined in
|
|
1060
1281
|
|
|
1061
|
-
[src/Line2D.ts:
|
|
1282
|
+
[src/Line2D.ts:31](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L31)
|
|
1062
1283
|
|
|
1063
1284
|
___
|
|
1064
1285
|
|
|
1065
|
-
###
|
|
1286
|
+
### groupConnectedLines
|
|
1066
1287
|
|
|
1067
|
-
▸
|
|
1288
|
+
▸ **groupConnectedLines**(`lines`, `tolerance?`, `breakpoints?`): [`Line2D`](Line2D.md)[][]
|
|
1068
1289
|
|
|
1069
|
-
|
|
1290
|
+
Accepts an array of Line2D and groups them into arrays of connected lines
|
|
1070
1291
|
|
|
1071
|
-
|
|
1292
|
+
#### Parameters
|
|
1072
1293
|
|
|
1073
|
-
|
|
1294
|
+
| Name | Type | Default value | Description |
|
|
1295
|
+
| :------ | :------ | :------ | :------ |
|
|
1296
|
+
| `lines` | [`Line2D`](Line2D.md)[] | `undefined` | Lines to be grouped |
|
|
1297
|
+
| `tolerance` | `number` | `0` | Tolerance for considering lines as connected |
|
|
1298
|
+
| `breakpoints` | [`Vec2`](Vec2.md)[] | `[]` | |
|
|
1074
1299
|
|
|
1075
|
-
|
|
1300
|
+
#### Returns
|
|
1076
1301
|
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1302
|
+
[`Line2D`](Line2D.md)[][]
|
|
1303
|
+
|
|
1304
|
+
#### Defined in
|
|
1305
|
+
|
|
1306
|
+
[src/Line2D.ts:781](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L781)
|
|
1307
|
+
|
|
1308
|
+
___
|
|
1309
|
+
|
|
1310
|
+
### joinLine
|
|
1311
|
+
|
|
1312
|
+
▸ **joinLine**(`line`, `other`): [`Line2D`](Line2D.md)
|
|
1313
|
+
|
|
1314
|
+
Joins a copy of
|
|
1081
1315
|
|
|
1082
1316
|
#### Parameters
|
|
1083
1317
|
|
|
@@ -1090,15 +1324,26 @@ Clones the line, does not modify.
|
|
|
1090
1324
|
|
|
1091
1325
|
[`Line2D`](Line2D.md)
|
|
1092
1326
|
|
|
1327
|
+
**`Line`**
|
|
1328
|
+
|
|
1329
|
+
with the
|
|
1330
|
+
|
|
1331
|
+
**`Other`**
|
|
1332
|
+
|
|
1333
|
+
line.
|
|
1334
|
+
Other must be parallel to this line.
|
|
1335
|
+
Returns null if there is no overlap
|
|
1336
|
+
Clones the line, does not modify.
|
|
1337
|
+
|
|
1093
1338
|
#### Defined in
|
|
1094
1339
|
|
|
1095
|
-
[src/Line2D.ts:
|
|
1340
|
+
[src/Line2D.ts:401](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L401)
|
|
1096
1341
|
|
|
1097
1342
|
___
|
|
1098
1343
|
|
|
1099
1344
|
### joinLines
|
|
1100
1345
|
|
|
1101
|
-
▸
|
|
1346
|
+
▸ **joinLines**(`lines`): [`Line2D`](Line2D.md)[]
|
|
1102
1347
|
|
|
1103
1348
|
Joins provided lines into several joined lines.
|
|
1104
1349
|
Lines must be parallel for joining.
|
|
@@ -1116,4 +1361,4 @@ Clone the lines, does not modify.
|
|
|
1116
1361
|
|
|
1117
1362
|
#### Defined in
|
|
1118
1363
|
|
|
1119
|
-
[src/Line2D.ts:
|
|
1364
|
+
[src/Line2D.ts:418](https://github.com/Immugio/three-math-extensions/blob/336678b/src/Line2D.ts#L418)
|