@immugio/three-math-extensions 0.2.21 → 0.2.22
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 +11 -2
- package/README.md +183 -1
- package/cjs/Line2D.js +59 -8
- package/cjs/Line3D.js +1 -1
- package/docs/classes/BoundingBox.md +13 -9
- package/docs/classes/Line2D.md +292 -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 +8 -4
- 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 +59 -8
- package/esm/Line3D.js +1 -1
- package/package.json +1 -1
- package/src/Line2D.ts +69 -8
- package/src/Line3D.ts +1 -1
- package/types/Line2D.d.ts +21 -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,7 +29,11 @@
|
|
|
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)
|
|
@@ -38,6 +44,7 @@
|
|
|
38
44
|
- [in3DSpace](Line2D.md#in3dspace)
|
|
39
45
|
- [intersect](Line2D.md#intersect)
|
|
40
46
|
- [isCollinearWithTouchOrOverlap](Line2D.md#iscollinearwithtouchoroverlap)
|
|
47
|
+
- [isParallelTo](Line2D.md#isparallelto)
|
|
41
48
|
- [isPointBesideLineSection](Line2D.md#ispointbesidelinesection)
|
|
42
49
|
- [isPointCloseToAndBesideLineSection](Line2D.md#ispointclosetoandbesidelinesection)
|
|
43
50
|
- [isPointOnInfiniteLine](Line2D.md#ispointoninfiniteline)
|
|
@@ -45,6 +52,7 @@
|
|
|
45
52
|
- [moveEndPoint](Line2D.md#moveendpoint)
|
|
46
53
|
- [moveStartPoint](Line2D.md#movestartpoint)
|
|
47
54
|
- [overlaps](Line2D.md#overlaps)
|
|
55
|
+
- [projectOn](Line2D.md#projecton)
|
|
48
56
|
- [resize](Line2D.md#resize)
|
|
49
57
|
- [rotate](Line2D.md#rotate)
|
|
50
58
|
- [setCenter](Line2D.md#setcenter)
|
|
@@ -61,6 +69,7 @@
|
|
|
61
69
|
- [fromLength](Line2D.md#fromlength)
|
|
62
70
|
- [fromPoints](Line2D.md#frompoints)
|
|
63
71
|
- [fromPolygon](Line2D.md#frompolygon)
|
|
72
|
+
- [groupConnectedLines](Line2D.md#groupconnectedlines)
|
|
64
73
|
- [joinLine](Line2D.md#joinline)
|
|
65
74
|
- [joinLines](Line2D.md#joinlines)
|
|
66
75
|
|
|
@@ -68,7 +77,7 @@
|
|
|
68
77
|
|
|
69
78
|
### constructor
|
|
70
79
|
|
|
71
|
-
• **new Line2D**(`start`, `end`, `index?`)
|
|
80
|
+
• **new Line2D**(`start`, `end`, `index?`): [`Line2D`](Line2D.md)
|
|
72
81
|
|
|
73
82
|
#### Parameters
|
|
74
83
|
|
|
@@ -78,9 +87,13 @@
|
|
|
78
87
|
| `end` | [`Vec2`](Vec2.md) | `undefined` |
|
|
79
88
|
| `index` | `number` | `0` |
|
|
80
89
|
|
|
90
|
+
#### Returns
|
|
91
|
+
|
|
92
|
+
[`Line2D`](Line2D.md)
|
|
93
|
+
|
|
81
94
|
#### Defined in
|
|
82
95
|
|
|
83
|
-
[src/Line2D.ts:
|
|
96
|
+
[src/Line2D.ts:16](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L16)
|
|
84
97
|
|
|
85
98
|
## Properties
|
|
86
99
|
|
|
@@ -90,7 +103,7 @@
|
|
|
90
103
|
|
|
91
104
|
#### Defined in
|
|
92
105
|
|
|
93
|
-
[src/Line2D.ts:
|
|
106
|
+
[src/Line2D.ts:16](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L16)
|
|
94
107
|
|
|
95
108
|
___
|
|
96
109
|
|
|
@@ -100,7 +113,7 @@ ___
|
|
|
100
113
|
|
|
101
114
|
#### Defined in
|
|
102
115
|
|
|
103
|
-
[src/Line2D.ts:
|
|
116
|
+
[src/Line2D.ts:16](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L16)
|
|
104
117
|
|
|
105
118
|
___
|
|
106
119
|
|
|
@@ -110,7 +123,7 @@ ___
|
|
|
110
123
|
|
|
111
124
|
#### Defined in
|
|
112
125
|
|
|
113
|
-
[src/Line2D.ts:
|
|
126
|
+
[src/Line2D.ts:16](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L16)
|
|
114
127
|
|
|
115
128
|
## Accessors
|
|
116
129
|
|
|
@@ -124,7 +137,7 @@ ___
|
|
|
124
137
|
|
|
125
138
|
#### Defined in
|
|
126
139
|
|
|
127
|
-
[src/Line2D.ts:
|
|
140
|
+
[src/Line2D.ts:53](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L53)
|
|
128
141
|
|
|
129
142
|
• `set` **center**(`value`): `void`
|
|
130
143
|
|
|
@@ -143,7 +156,7 @@ Modifies this line.
|
|
|
143
156
|
|
|
144
157
|
#### Defined in
|
|
145
158
|
|
|
146
|
-
[src/Line2D.ts:
|
|
159
|
+
[src/Line2D.ts:62](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L62)
|
|
147
160
|
|
|
148
161
|
___
|
|
149
162
|
|
|
@@ -159,7 +172,7 @@ Returns the direction of this line.
|
|
|
159
172
|
|
|
160
173
|
#### Defined in
|
|
161
174
|
|
|
162
|
-
[src/Line2D.ts:
|
|
175
|
+
[src/Line2D.ts:189](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L189)
|
|
163
176
|
|
|
164
177
|
___
|
|
165
178
|
|
|
@@ -176,7 +189,35 @@ Endpoints are not cloned.
|
|
|
176
189
|
|
|
177
190
|
#### Defined in
|
|
178
191
|
|
|
179
|
-
[src/Line2D.ts:
|
|
192
|
+
[src/Line2D.ts:162](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L162)
|
|
193
|
+
|
|
194
|
+
___
|
|
195
|
+
|
|
196
|
+
### isCloserToHorizontal
|
|
197
|
+
|
|
198
|
+
• `get` **isCloserToHorizontal**(): `boolean`
|
|
199
|
+
|
|
200
|
+
#### Returns
|
|
201
|
+
|
|
202
|
+
`boolean`
|
|
203
|
+
|
|
204
|
+
#### Defined in
|
|
205
|
+
|
|
206
|
+
[src/Line2D.ts:746](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L746)
|
|
207
|
+
|
|
208
|
+
___
|
|
209
|
+
|
|
210
|
+
### isCloserToVertical
|
|
211
|
+
|
|
212
|
+
• `get` **isCloserToVertical**(): `boolean`
|
|
213
|
+
|
|
214
|
+
#### Returns
|
|
215
|
+
|
|
216
|
+
`boolean`
|
|
217
|
+
|
|
218
|
+
#### Defined in
|
|
219
|
+
|
|
220
|
+
[src/Line2D.ts:751](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L751)
|
|
180
221
|
|
|
181
222
|
___
|
|
182
223
|
|
|
@@ -190,7 +231,7 @@ ___
|
|
|
190
231
|
|
|
191
232
|
#### Defined in
|
|
192
233
|
|
|
193
|
-
[src/Line2D.ts:
|
|
234
|
+
[src/Line2D.ts:145](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L145)
|
|
194
235
|
|
|
195
236
|
• `set` **length**(`l`): `void`
|
|
196
237
|
|
|
@@ -209,7 +250,7 @@ Modifies this line.
|
|
|
209
250
|
|
|
210
251
|
#### Defined in
|
|
211
252
|
|
|
212
|
-
[src/Line2D.ts:
|
|
253
|
+
[src/Line2D.ts:140](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L140)
|
|
213
254
|
|
|
214
255
|
## Methods
|
|
215
256
|
|
|
@@ -232,7 +273,7 @@ Clone the line, does not modify.
|
|
|
232
273
|
|
|
233
274
|
#### Defined in
|
|
234
275
|
|
|
235
|
-
[src/Line2D.ts:
|
|
276
|
+
[src/Line2D.ts:459](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L459)
|
|
236
277
|
|
|
237
278
|
___
|
|
238
279
|
|
|
@@ -248,7 +289,7 @@ Deep clone of this line
|
|
|
248
289
|
|
|
249
290
|
#### Defined in
|
|
250
291
|
|
|
251
|
-
[src/Line2D.ts:
|
|
292
|
+
[src/Line2D.ts:830](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L830)
|
|
252
293
|
|
|
253
294
|
___
|
|
254
295
|
|
|
@@ -272,7 +313,7 @@ Returns the closest point on the line to the given point.
|
|
|
272
313
|
|
|
273
314
|
#### Defined in
|
|
274
315
|
|
|
275
|
-
[src/Line2D.ts:
|
|
316
|
+
[src/Line2D.ts:478](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L478)
|
|
276
317
|
|
|
277
318
|
___
|
|
278
319
|
|
|
@@ -293,7 +334,84 @@ ___
|
|
|
293
334
|
|
|
294
335
|
#### Defined in
|
|
295
336
|
|
|
296
|
-
[src/Line2D.ts:
|
|
337
|
+
[src/Line2D.ts:487](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L487)
|
|
338
|
+
|
|
339
|
+
___
|
|
340
|
+
|
|
341
|
+
### connectsTo
|
|
342
|
+
|
|
343
|
+
▸ **connectsTo**(`other`, `tolerance?`, `breakpoints?`): `boolean`
|
|
344
|
+
|
|
345
|
+
Returns true if any endpoint of this line is within the tolerance of any
|
|
346
|
+
|
|
347
|
+
#### Parameters
|
|
348
|
+
|
|
349
|
+
| Name | Type | Default value |
|
|
350
|
+
| :------ | :------ | :------ |
|
|
351
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
352
|
+
| `tolerance` | `number` | `0` |
|
|
353
|
+
| `breakpoints` | [`Vec2`](Vec2.md)[] | `[]` |
|
|
354
|
+
|
|
355
|
+
#### Returns
|
|
356
|
+
|
|
357
|
+
`boolean`
|
|
358
|
+
|
|
359
|
+
**`Other`**
|
|
360
|
+
|
|
361
|
+
line's endpoints.
|
|
362
|
+
|
|
363
|
+
#### Defined in
|
|
364
|
+
|
|
365
|
+
[src/Line2D.ts:801](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L801)
|
|
366
|
+
|
|
367
|
+
___
|
|
368
|
+
|
|
369
|
+
### containsPoint
|
|
370
|
+
|
|
371
|
+
▸ **containsPoint**(`p`, `tolerance?`): `boolean`
|
|
372
|
+
|
|
373
|
+
Check that this line segment contains provided point.
|
|
374
|
+
|
|
375
|
+
#### Parameters
|
|
376
|
+
|
|
377
|
+
| Name | Type | Default value |
|
|
378
|
+
| :------ | :------ | :------ |
|
|
379
|
+
| `p` | `Vector2` | `undefined` |
|
|
380
|
+
| `tolerance` | `number` | `0` |
|
|
381
|
+
|
|
382
|
+
#### Returns
|
|
383
|
+
|
|
384
|
+
`boolean`
|
|
385
|
+
|
|
386
|
+
#### Defined in
|
|
387
|
+
|
|
388
|
+
[src/Line2D.ts:171](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L171)
|
|
389
|
+
|
|
390
|
+
___
|
|
391
|
+
|
|
392
|
+
### covers
|
|
393
|
+
|
|
394
|
+
▸ **covers**(`other`, `tolerance?`, `parallelTolerance?`): `boolean`
|
|
395
|
+
|
|
396
|
+
Checks if the current line covers another line.
|
|
397
|
+
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.
|
|
398
|
+
Both distance and angle tolerance can be provided.
|
|
399
|
+
|
|
400
|
+
#### Parameters
|
|
401
|
+
|
|
402
|
+
| Name | Type | Default value |
|
|
403
|
+
| :------ | :------ | :------ |
|
|
404
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
405
|
+
| `tolerance` | `number` | `0` |
|
|
406
|
+
| `parallelTolerance` | `number` | `0` |
|
|
407
|
+
|
|
408
|
+
#### Returns
|
|
409
|
+
|
|
410
|
+
`boolean`
|
|
411
|
+
|
|
412
|
+
#### Defined in
|
|
413
|
+
|
|
414
|
+
[src/Line2D.ts:434](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L434)
|
|
297
415
|
|
|
298
416
|
___
|
|
299
417
|
|
|
@@ -313,7 +431,30 @@ ___
|
|
|
313
431
|
|
|
314
432
|
#### Defined in
|
|
315
433
|
|
|
316
|
-
[src/Line2D.ts:
|
|
434
|
+
[src/Line2D.ts:483](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L483)
|
|
435
|
+
|
|
436
|
+
___
|
|
437
|
+
|
|
438
|
+
### distanceToPoint
|
|
439
|
+
|
|
440
|
+
▸ **distanceToPoint**(`p`, `clampToLine?`): `number`
|
|
441
|
+
|
|
442
|
+
Distance from this line to the provided point.
|
|
443
|
+
|
|
444
|
+
#### Parameters
|
|
445
|
+
|
|
446
|
+
| Name | Type | Default value |
|
|
447
|
+
| :------ | :------ | :------ |
|
|
448
|
+
| `p` | `Vector2` | `undefined` |
|
|
449
|
+
| `clampToLine` | `boolean` | `true` |
|
|
450
|
+
|
|
451
|
+
#### Returns
|
|
452
|
+
|
|
453
|
+
`number`
|
|
454
|
+
|
|
455
|
+
#### Defined in
|
|
456
|
+
|
|
457
|
+
[src/Line2D.ts:181](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L181)
|
|
317
458
|
|
|
318
459
|
___
|
|
319
460
|
|
|
@@ -335,19 +476,20 @@ Returns the distance between the **infinite** line and the point.
|
|
|
335
476
|
|
|
336
477
|
#### Defined in
|
|
337
478
|
|
|
338
|
-
[src/Line2D.ts:
|
|
479
|
+
[src/Line2D.ts:507](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L507)
|
|
339
480
|
|
|
340
481
|
___
|
|
341
482
|
|
|
342
483
|
### equals
|
|
343
484
|
|
|
344
|
-
▸ **equals**(`other`): `boolean`
|
|
485
|
+
▸ **equals**(`other`, `tolerance?`): `boolean`
|
|
345
486
|
|
|
346
487
|
#### Parameters
|
|
347
488
|
|
|
348
|
-
| Name | Type |
|
|
349
|
-
| :------ | :------ |
|
|
350
|
-
| `other` | [`Line2D`](Line2D.md) |
|
|
489
|
+
| Name | Type | Default value |
|
|
490
|
+
| :------ | :------ | :------ |
|
|
491
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
492
|
+
| `tolerance` | `number` | `0` |
|
|
351
493
|
|
|
352
494
|
#### Returns
|
|
353
495
|
|
|
@@ -355,7 +497,7 @@ ___
|
|
|
355
497
|
|
|
356
498
|
#### Defined in
|
|
357
499
|
|
|
358
|
-
[src/Line2D.ts:
|
|
500
|
+
[src/Line2D.ts:819](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L819)
|
|
359
501
|
|
|
360
502
|
___
|
|
361
503
|
|
|
@@ -379,7 +521,7 @@ Does not create a copy. Provided line is modified.
|
|
|
379
521
|
|
|
380
522
|
#### Defined in
|
|
381
523
|
|
|
382
|
-
[src/Line2D.ts:
|
|
524
|
+
[src/Line2D.ts:644](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L644)
|
|
383
525
|
|
|
384
526
|
___
|
|
385
527
|
|
|
@@ -403,7 +545,7 @@ Modifies this line.
|
|
|
403
545
|
|
|
404
546
|
#### Defined in
|
|
405
547
|
|
|
406
|
-
[src/Line2D.ts:
|
|
548
|
+
[src/Line2D.ts:665](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L665)
|
|
407
549
|
|
|
408
550
|
___
|
|
409
551
|
|
|
@@ -420,7 +562,7 @@ Modifies this line.
|
|
|
420
562
|
|
|
421
563
|
#### Defined in
|
|
422
564
|
|
|
423
|
-
[src/Line2D.ts:
|
|
565
|
+
[src/Line2D.ts:197](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L197)
|
|
424
566
|
|
|
425
567
|
___
|
|
426
568
|
|
|
@@ -442,7 +584,7 @@ Logical AND of this and the other line section.
|
|
|
442
584
|
|
|
443
585
|
#### Defined in
|
|
444
586
|
|
|
445
|
-
[src/Line2D.ts:
|
|
587
|
+
[src/Line2D.ts:347](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L347)
|
|
446
588
|
|
|
447
589
|
___
|
|
448
590
|
|
|
@@ -467,7 +609,7 @@ Check that the line section intersect and that they are in the specified angle t
|
|
|
467
609
|
|
|
468
610
|
#### Defined in
|
|
469
611
|
|
|
470
|
-
[src/Line2D.ts:
|
|
612
|
+
[src/Line2D.ts:727](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L727)
|
|
471
613
|
|
|
472
614
|
___
|
|
473
615
|
|
|
@@ -491,7 +633,7 @@ A new Line3D instance.
|
|
|
491
633
|
|
|
492
634
|
#### Defined in
|
|
493
635
|
|
|
494
|
-
[src/Line2D.ts:
|
|
636
|
+
[src/Line2D.ts:815](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L815)
|
|
495
637
|
|
|
496
638
|
___
|
|
497
639
|
|
|
@@ -514,7 +656,7 @@ Returns the intersection point of two lines.
|
|
|
514
656
|
|
|
515
657
|
#### Defined in
|
|
516
658
|
|
|
517
|
-
[src/Line2D.ts:
|
|
659
|
+
[src/Line2D.ts:690](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L690)
|
|
518
660
|
|
|
519
661
|
___
|
|
520
662
|
|
|
@@ -536,7 +678,28 @@ Returns true if other line is collinear and overlaps or at least touching this l
|
|
|
536
678
|
|
|
537
679
|
#### Defined in
|
|
538
680
|
|
|
539
|
-
[src/Line2D.ts:
|
|
681
|
+
[src/Line2D.ts:297](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L297)
|
|
682
|
+
|
|
683
|
+
___
|
|
684
|
+
|
|
685
|
+
### isParallelTo
|
|
686
|
+
|
|
687
|
+
▸ **isParallelTo**(`other`, `angleTolerance?`): `boolean`
|
|
688
|
+
|
|
689
|
+
#### Parameters
|
|
690
|
+
|
|
691
|
+
| Name | Type | Default value |
|
|
692
|
+
| :------ | :------ | :------ |
|
|
693
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
694
|
+
| `angleTolerance` | `number` | `Number.EPSILON` |
|
|
695
|
+
|
|
696
|
+
#### Returns
|
|
697
|
+
|
|
698
|
+
`boolean`
|
|
699
|
+
|
|
700
|
+
#### Defined in
|
|
701
|
+
|
|
702
|
+
[src/Line2D.ts:92](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L92)
|
|
540
703
|
|
|
541
704
|
___
|
|
542
705
|
|
|
@@ -558,7 +721,7 @@ Returns true when the point is beside the line **segment**
|
|
|
558
721
|
|
|
559
722
|
#### Defined in
|
|
560
723
|
|
|
561
|
-
[src/Line2D.ts:
|
|
724
|
+
[src/Line2D.ts:277](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L277)
|
|
562
725
|
|
|
563
726
|
___
|
|
564
727
|
|
|
@@ -581,7 +744,7 @@ Returns true when the point is beside the line **segment** and within the maxDis
|
|
|
581
744
|
|
|
582
745
|
#### Defined in
|
|
583
746
|
|
|
584
|
-
[src/Line2D.ts:
|
|
747
|
+
[src/Line2D.ts:268](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L268)
|
|
585
748
|
|
|
586
749
|
___
|
|
587
750
|
|
|
@@ -603,7 +766,7 @@ Returns true when the point is on the **infinite** line.
|
|
|
603
766
|
|
|
604
767
|
#### Defined in
|
|
605
768
|
|
|
606
|
-
[src/Line2D.ts:
|
|
769
|
+
[src/Line2D.ts:289](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L289)
|
|
607
770
|
|
|
608
771
|
___
|
|
609
772
|
|
|
@@ -627,7 +790,7 @@ https://stackoverflow.com/questions/6865832/detecting-if-a-point-is-of-a-line-se
|
|
|
627
790
|
|
|
628
791
|
#### Defined in
|
|
629
792
|
|
|
630
|
-
[src/Line2D.ts:
|
|
793
|
+
[src/Line2D.ts:255](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L255)
|
|
631
794
|
|
|
632
795
|
___
|
|
633
796
|
|
|
@@ -650,7 +813,7 @@ Modifies this line.
|
|
|
650
813
|
|
|
651
814
|
#### Defined in
|
|
652
815
|
|
|
653
|
-
[src/Line2D.ts:
|
|
816
|
+
[src/Line2D.ts:120](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L120)
|
|
654
817
|
|
|
655
818
|
___
|
|
656
819
|
|
|
@@ -670,33 +833,58 @@ ___
|
|
|
670
833
|
|
|
671
834
|
#### Defined in
|
|
672
835
|
|
|
673
|
-
[src/Line2D.ts:
|
|
836
|
+
[src/Line2D.ts:109](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L109)
|
|
674
837
|
|
|
675
838
|
___
|
|
676
839
|
|
|
677
840
|
### overlaps
|
|
678
841
|
|
|
679
|
-
▸ **overlaps**(`other`): `boolean`
|
|
842
|
+
▸ **overlaps**(`other`, `distanceTolerance?`, `parallelTolerance?`): `boolean`
|
|
680
843
|
|
|
681
844
|
Returns true if there is any overlap between this line and the
|
|
682
845
|
|
|
846
|
+
#### Parameters
|
|
847
|
+
|
|
848
|
+
| Name | Type | Default value |
|
|
849
|
+
| :------ | :------ | :------ |
|
|
850
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
851
|
+
| `distanceTolerance` | `number` | `0` |
|
|
852
|
+
| `parallelTolerance` | `number` | `0` |
|
|
853
|
+
|
|
854
|
+
#### Returns
|
|
855
|
+
|
|
856
|
+
`boolean`
|
|
857
|
+
|
|
683
858
|
**`Other`**
|
|
684
859
|
|
|
685
860
|
line section.
|
|
686
861
|
|
|
862
|
+
#### Defined in
|
|
863
|
+
|
|
864
|
+
[src/Line2D.ts:309](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L309)
|
|
865
|
+
|
|
866
|
+
___
|
|
867
|
+
|
|
868
|
+
### projectOn
|
|
869
|
+
|
|
870
|
+
▸ **projectOn**(`other`, `clampToLine`): [`Line2D`](Line2D.md)
|
|
871
|
+
|
|
872
|
+
Returns a new line that is the projection of this line onto @other. Uses `closestPointToPoint` to find the projection.
|
|
873
|
+
|
|
687
874
|
#### Parameters
|
|
688
875
|
|
|
689
876
|
| Name | Type |
|
|
690
877
|
| :------ | :------ |
|
|
691
878
|
| `other` | [`Line2D`](Line2D.md) |
|
|
879
|
+
| `clampToLine` | `boolean` |
|
|
692
880
|
|
|
693
881
|
#### Returns
|
|
694
882
|
|
|
695
|
-
`
|
|
883
|
+
[`Line2D`](Line2D.md)
|
|
696
884
|
|
|
697
885
|
#### Defined in
|
|
698
886
|
|
|
699
|
-
[src/Line2D.ts:
|
|
887
|
+
[src/Line2D.ts:447](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L447)
|
|
700
888
|
|
|
701
889
|
___
|
|
702
890
|
|
|
@@ -716,7 +904,7 @@ ___
|
|
|
716
904
|
|
|
717
905
|
#### Defined in
|
|
718
906
|
|
|
719
|
-
[src/Line2D.ts:
|
|
907
|
+
[src/Line2D.ts:86](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L86)
|
|
720
908
|
|
|
721
909
|
___
|
|
722
910
|
|
|
@@ -740,7 +928,7 @@ Modifies this line.
|
|
|
740
928
|
|
|
741
929
|
#### Defined in
|
|
742
930
|
|
|
743
|
-
[src/Line2D.ts:
|
|
931
|
+
[src/Line2D.ts:211](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L211)
|
|
744
932
|
|
|
745
933
|
___
|
|
746
934
|
|
|
@@ -763,7 +951,7 @@ Modifies this line.
|
|
|
763
951
|
|
|
764
952
|
#### Defined in
|
|
765
953
|
|
|
766
|
-
[src/Line2D.ts:
|
|
954
|
+
[src/Line2D.ts:77](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L77)
|
|
767
955
|
|
|
768
956
|
___
|
|
769
957
|
|
|
@@ -785,7 +973,7 @@ Set the length of this line. Center and direction remain unchanged.
|
|
|
785
973
|
|
|
786
974
|
#### Defined in
|
|
787
975
|
|
|
788
|
-
[src/Line2D.ts:
|
|
976
|
+
[src/Line2D.ts:153](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L153)
|
|
789
977
|
|
|
790
978
|
___
|
|
791
979
|
|
|
@@ -808,7 +996,7 @@ Returns the original line section split into two parts, if the line **sections**
|
|
|
808
996
|
|
|
809
997
|
#### Defined in
|
|
810
998
|
|
|
811
|
-
[src/Line2D.ts:
|
|
999
|
+
[src/Line2D.ts:560](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L560)
|
|
812
1000
|
|
|
813
1001
|
___
|
|
814
1002
|
|
|
@@ -832,7 +1020,7 @@ Otherwise, null if the lines are parallel and do not intersect
|
|
|
832
1020
|
|
|
833
1021
|
#### Defined in
|
|
834
1022
|
|
|
835
|
-
[src/Line2D.ts:
|
|
1023
|
+
[src/Line2D.ts:579](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L579)
|
|
836
1024
|
|
|
837
1025
|
___
|
|
838
1026
|
|
|
@@ -846,7 +1034,7 @@ ___
|
|
|
846
1034
|
|
|
847
1035
|
#### Defined in
|
|
848
1036
|
|
|
849
|
-
[src/Line2D.ts:
|
|
1037
|
+
[src/Line2D.ts:834](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L834)
|
|
850
1038
|
|
|
851
1039
|
___
|
|
852
1040
|
|
|
@@ -869,7 +1057,7 @@ Modifies this line.
|
|
|
869
1057
|
|
|
870
1058
|
#### Defined in
|
|
871
1059
|
|
|
872
|
-
[src/Line2D.ts:
|
|
1060
|
+
[src/Line2D.ts:222](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L222)
|
|
873
1061
|
|
|
874
1062
|
___
|
|
875
1063
|
|
|
@@ -892,7 +1080,7 @@ Modifies this line.
|
|
|
892
1080
|
|
|
893
1081
|
#### Defined in
|
|
894
1082
|
|
|
895
|
-
[src/Line2D.ts:
|
|
1083
|
+
[src/Line2D.ts:235](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L235)
|
|
896
1084
|
|
|
897
1085
|
___
|
|
898
1086
|
|
|
@@ -915,7 +1103,7 @@ Modifies this line.
|
|
|
915
1103
|
|
|
916
1104
|
#### Defined in
|
|
917
1105
|
|
|
918
|
-
[src/Line2D.ts:
|
|
1106
|
+
[src/Line2D.ts:244](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L244)
|
|
919
1107
|
|
|
920
1108
|
___
|
|
921
1109
|
|
|
@@ -938,22 +1126,16 @@ Does not create a copy. Provided line is modified.
|
|
|
938
1126
|
|
|
939
1127
|
#### Defined in
|
|
940
1128
|
|
|
941
|
-
[src/Line2D.ts:
|
|
1129
|
+
[src/Line2D.ts:622](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L622)
|
|
942
1130
|
|
|
943
1131
|
___
|
|
944
1132
|
|
|
945
1133
|
### clipLines
|
|
946
1134
|
|
|
947
|
-
▸
|
|
1135
|
+
▸ **clipLines**(`source`, `clips`): [`Line2D`](Line2D.md)[]
|
|
948
1136
|
|
|
949
1137
|
Returns lines that are the result of clipping
|
|
950
1138
|
|
|
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
1139
|
#### Parameters
|
|
958
1140
|
|
|
959
1141
|
| Name | Type |
|
|
@@ -965,15 +1147,21 @@ Clones the line, does not modify this.
|
|
|
965
1147
|
|
|
966
1148
|
[`Line2D`](Line2D.md)[]
|
|
967
1149
|
|
|
1150
|
+
**`Source`**
|
|
1151
|
+
|
|
1152
|
+
line by the @clips.
|
|
1153
|
+
Clips must be parallel to this line.
|
|
1154
|
+
Clones the line, does not modify this.
|
|
1155
|
+
|
|
968
1156
|
#### Defined in
|
|
969
1157
|
|
|
970
|
-
[src/Line2D.ts:
|
|
1158
|
+
[src/Line2D.ts:521](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L521)
|
|
971
1159
|
|
|
972
1160
|
___
|
|
973
1161
|
|
|
974
1162
|
### fromCoordinates
|
|
975
1163
|
|
|
976
|
-
▸
|
|
1164
|
+
▸ **fromCoordinates**(`x1`, `y1`, `x2`, `y2`, `index?`): [`Line2D`](Line2D.md)
|
|
977
1165
|
|
|
978
1166
|
#### Parameters
|
|
979
1167
|
|
|
@@ -991,13 +1179,13 @@ ___
|
|
|
991
1179
|
|
|
992
1180
|
#### Defined in
|
|
993
1181
|
|
|
994
|
-
[src/Line2D.ts:
|
|
1182
|
+
[src/Line2D.ts:19](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L19)
|
|
995
1183
|
|
|
996
1184
|
___
|
|
997
1185
|
|
|
998
1186
|
### fromLength
|
|
999
1187
|
|
|
1000
|
-
▸
|
|
1188
|
+
▸ **fromLength**(`length`): [`Line2D`](Line2D.md)
|
|
1001
1189
|
|
|
1002
1190
|
#### Parameters
|
|
1003
1191
|
|
|
@@ -1011,13 +1199,13 @@ ___
|
|
|
1011
1199
|
|
|
1012
1200
|
#### Defined in
|
|
1013
1201
|
|
|
1014
|
-
[src/Line2D.ts:
|
|
1202
|
+
[src/Line2D.ts:49](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L49)
|
|
1015
1203
|
|
|
1016
1204
|
___
|
|
1017
1205
|
|
|
1018
1206
|
### fromPoints
|
|
1019
1207
|
|
|
1020
|
-
▸
|
|
1208
|
+
▸ **fromPoints**(`p1`, `p2`, `index?`): [`Line2D`](Line2D.md)
|
|
1021
1209
|
|
|
1022
1210
|
#### Parameters
|
|
1023
1211
|
|
|
@@ -1033,13 +1221,13 @@ ___
|
|
|
1033
1221
|
|
|
1034
1222
|
#### Defined in
|
|
1035
1223
|
|
|
1036
|
-
[src/Line2D.ts:
|
|
1224
|
+
[src/Line2D.ts:23](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L23)
|
|
1037
1225
|
|
|
1038
1226
|
___
|
|
1039
1227
|
|
|
1040
1228
|
### fromPolygon
|
|
1041
1229
|
|
|
1042
|
-
▸
|
|
1230
|
+
▸ **fromPolygon**(`polygon`, `forceClosedPolygon?`): [`Line2D`](Line2D.md)[]
|
|
1043
1231
|
|
|
1044
1232
|
Creates a polygon formed by an array of lines from points provided.
|
|
1045
1233
|
The polygon will only be closed if either
|
|
@@ -1058,26 +1246,39 @@ The polygon will only be closed if either
|
|
|
1058
1246
|
|
|
1059
1247
|
#### Defined in
|
|
1060
1248
|
|
|
1061
|
-
[src/Line2D.ts:
|
|
1249
|
+
[src/Line2D.ts:32](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L32)
|
|
1062
1250
|
|
|
1063
1251
|
___
|
|
1064
1252
|
|
|
1065
|
-
###
|
|
1253
|
+
### groupConnectedLines
|
|
1066
1254
|
|
|
1067
|
-
▸
|
|
1255
|
+
▸ **groupConnectedLines**(`lines`, `tolerance?`, `breakpoints?`): [`Line2D`](Line2D.md)[][]
|
|
1068
1256
|
|
|
1069
|
-
|
|
1257
|
+
Accepts an array of Line2D and groups them into arrays of connected lines
|
|
1070
1258
|
|
|
1071
|
-
|
|
1259
|
+
#### Parameters
|
|
1072
1260
|
|
|
1073
|
-
|
|
1261
|
+
| Name | Type | Default value | Description |
|
|
1262
|
+
| :------ | :------ | :------ | :------ |
|
|
1263
|
+
| `lines` | [`Line2D`](Line2D.md)[] | `undefined` | Lines to be grouped |
|
|
1264
|
+
| `tolerance` | `number` | `0` | Tolerance for considering lines as connected |
|
|
1265
|
+
| `breakpoints` | [`Vec2`](Vec2.md)[] | `[]` | |
|
|
1074
1266
|
|
|
1075
|
-
|
|
1267
|
+
#### Returns
|
|
1076
1268
|
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1269
|
+
[`Line2D`](Line2D.md)[][]
|
|
1270
|
+
|
|
1271
|
+
#### Defined in
|
|
1272
|
+
|
|
1273
|
+
[src/Line2D.ts:761](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L761)
|
|
1274
|
+
|
|
1275
|
+
___
|
|
1276
|
+
|
|
1277
|
+
### joinLine
|
|
1278
|
+
|
|
1279
|
+
▸ **joinLine**(`line`, `other`): [`Line2D`](Line2D.md)
|
|
1280
|
+
|
|
1281
|
+
Joins a copy of
|
|
1081
1282
|
|
|
1082
1283
|
#### Parameters
|
|
1083
1284
|
|
|
@@ -1090,15 +1291,26 @@ Clones the line, does not modify.
|
|
|
1090
1291
|
|
|
1091
1292
|
[`Line2D`](Line2D.md)
|
|
1092
1293
|
|
|
1294
|
+
**`Line`**
|
|
1295
|
+
|
|
1296
|
+
with the
|
|
1297
|
+
|
|
1298
|
+
**`Other`**
|
|
1299
|
+
|
|
1300
|
+
line.
|
|
1301
|
+
Other must be parallel to this line.
|
|
1302
|
+
Returns null if there is no overlap
|
|
1303
|
+
Clones the line, does not modify.
|
|
1304
|
+
|
|
1093
1305
|
#### Defined in
|
|
1094
1306
|
|
|
1095
|
-
[src/Line2D.ts:
|
|
1307
|
+
[src/Line2D.ts:381](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L381)
|
|
1096
1308
|
|
|
1097
1309
|
___
|
|
1098
1310
|
|
|
1099
1311
|
### joinLines
|
|
1100
1312
|
|
|
1101
|
-
▸
|
|
1313
|
+
▸ **joinLines**(`lines`): [`Line2D`](Line2D.md)[]
|
|
1102
1314
|
|
|
1103
1315
|
Joins provided lines into several joined lines.
|
|
1104
1316
|
Lines must be parallel for joining.
|
|
@@ -1116,4 +1328,4 @@ Clone the lines, does not modify.
|
|
|
1116
1328
|
|
|
1117
1329
|
#### Defined in
|
|
1118
1330
|
|
|
1119
|
-
[src/Line2D.ts:
|
|
1331
|
+
[src/Line2D.ts:398](https://github.com/Immugio/three-math-extensions/blob/905d178/src/Line2D.ts#L398)
|