@immugio/three-math-extensions 0.0.13 → 0.0.14

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.
@@ -0,0 +1,1092 @@
1
+ [@immugio/three-math-extensions](../README.md) / [Exports](../modules.md) / Line2D
2
+
3
+ # Class: Line2D
4
+
5
+ ## Table of contents
6
+
7
+ ### Constructors
8
+
9
+ - [constructor](Line2D.md#constructor)
10
+
11
+ ### Properties
12
+
13
+ - [end](Line2D.md#end)
14
+ - [index](Line2D.md#index)
15
+ - [start](Line2D.md#start)
16
+
17
+ ### Accessors
18
+
19
+ - [center](Line2D.md#center)
20
+ - [direction](Line2D.md#direction)
21
+ - [endpoints](Line2D.md#endpoints)
22
+ - [length](Line2D.md#length)
23
+
24
+ ### Methods
25
+
26
+ - [chunk](Line2D.md#chunk)
27
+ - [clone](Line2D.md#clone)
28
+ - [closestPointOnInfiniteLine](Line2D.md#closestpointoninfiniteline)
29
+ - [closestPointOnLine](Line2D.md#closestpointonline)
30
+ - [closestPointToPointParameterOnInfiniteLine](Line2D.md#closestpointtopointparameteroninfiniteline)
31
+ - [distanceToPointOnInfiniteLine](Line2D.md#distancetopointoninfiniteline)
32
+ - [equals](Line2D.md#equals)
33
+ - [extendToEnds](Line2D.md#extendtoends)
34
+ - [extendToOrTrimAtIntersection](Line2D.md#extendtoortrimatintersection)
35
+ - [flip](Line2D.md#flip)
36
+ - [getOverlap](Line2D.md#getoverlap)
37
+ - [hasIntersectionWithAngle](Line2D.md#hasintersectionwithangle)
38
+ - [intersect](Line2D.md#intersect)
39
+ - [isCollinearWithTouchOrOverlap](Line2D.md#iscollinearwithtouchoroverlap)
40
+ - [isPointBesideLineSection](Line2D.md#ispointbesidelinesection)
41
+ - [isPointCloseToAndBesideLineSection](Line2D.md#ispointclosetoandbesidelinesection)
42
+ - [isPointOnInfiniteLine](Line2D.md#ispointoninfiniteline)
43
+ - [isPointOnLineSection](Line2D.md#ispointonlinesection)
44
+ - [moveEndPoint](Line2D.md#moveendpoint)
45
+ - [moveStartPoint](Line2D.md#movestartpoint)
46
+ - [overlaps](Line2D.md#overlaps)
47
+ - [resize](Line2D.md#resize)
48
+ - [rotate](Line2D.md#rotate)
49
+ - [setCenter](Line2D.md#setcenter)
50
+ - [setLength](Line2D.md#setlength)
51
+ - [splitAtIntersection](Line2D.md#splitatintersection)
52
+ - [splitAtOrExtendToIntersection](Line2D.md#splitatorextendtointersection)
53
+ - [toString](Line2D.md#tostring)
54
+ - [translate](Line2D.md#translate)
55
+ - [translateLeft](Line2D.md#translateleft)
56
+ - [translateRight](Line2D.md#translateright)
57
+ - [trimExcess](Line2D.md#trimexcess)
58
+ - [clipLines](Line2D.md#cliplines)
59
+ - [fromCoordinates](Line2D.md#fromcoordinates)
60
+ - [fromLength](Line2D.md#fromlength)
61
+ - [fromPoints](Line2D.md#frompoints)
62
+ - [fromPolygon](Line2D.md#frompolygon)
63
+ - [joinLine](Line2D.md#joinline)
64
+ - [joinLines](Line2D.md#joinlines)
65
+
66
+ ## Constructors
67
+
68
+ ### constructor
69
+
70
+ • **new Line2D**(`start`, `end`, `index?`)
71
+
72
+ #### Parameters
73
+
74
+ | Name | Type | Default value |
75
+ | :------ | :------ | :------ |
76
+ | `start` | [`Vec2`](Vec2.md) | `undefined` |
77
+ | `end` | [`Vec2`](Vec2.md) | `undefined` |
78
+ | `index` | `number` | `0` |
79
+
80
+ #### Defined in
81
+
82
+ [src/Line2D.ts:7](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L7)
83
+
84
+ ## Properties
85
+
86
+ ### end
87
+
88
+ • **end**: [`Vec2`](Vec2.md)
89
+
90
+ #### Defined in
91
+
92
+ [src/Line2D.ts:7](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L7)
93
+
94
+ ___
95
+
96
+ ### index
97
+
98
+ • **index**: `number` = `0`
99
+
100
+ #### Defined in
101
+
102
+ [src/Line2D.ts:7](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L7)
103
+
104
+ ___
105
+
106
+ ### start
107
+
108
+ • **start**: [`Vec2`](Vec2.md)
109
+
110
+ #### Defined in
111
+
112
+ [src/Line2D.ts:7](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L7)
113
+
114
+ ## Accessors
115
+
116
+ ### center
117
+
118
+ • `get` **center**(): [`Vec2`](Vec2.md)
119
+
120
+ #### Returns
121
+
122
+ [`Vec2`](Vec2.md)
123
+
124
+ #### Defined in
125
+
126
+ [src/Line2D.ts:44](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L44)
127
+
128
+ • `set` **center**(`value`): `void`
129
+
130
+ Set the center of the line to the provided point. Length and direction remain unchanged.
131
+ Modifies this line.
132
+
133
+ #### Parameters
134
+
135
+ | Name | Type |
136
+ | :------ | :------ |
137
+ | `value` | `Point2` |
138
+
139
+ #### Returns
140
+
141
+ `void`
142
+
143
+ #### Defined in
144
+
145
+ [src/Line2D.ts:53](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L53)
146
+
147
+ ___
148
+
149
+ ### direction
150
+
151
+ • `get` **direction**(): [`Vec2`](Vec2.md)
152
+
153
+ Returns the direction of this line.
154
+
155
+ #### Returns
156
+
157
+ [`Vec2`](Vec2.md)
158
+
159
+ #### Defined in
160
+
161
+ [src/Line2D.ts:147](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L147)
162
+
163
+ ___
164
+
165
+ ### endpoints
166
+
167
+ • `get` **endpoints**(): [`Vec2`](Vec2.md)[]
168
+
169
+ Returns the start and end points of the line as an array.
170
+ Endpoints are not cloned.
171
+
172
+ #### Returns
173
+
174
+ [`Vec2`](Vec2.md)[]
175
+
176
+ #### Defined in
177
+
178
+ [src/Line2D.ts:140](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L140)
179
+
180
+ ___
181
+
182
+ ### length
183
+
184
+ • `get` **length**(): `number`
185
+
186
+ #### Returns
187
+
188
+ `number`
189
+
190
+ #### Defined in
191
+
192
+ [src/Line2D.ts:123](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L123)
193
+
194
+ • `set` **length**(`l`): `void`
195
+
196
+ Set the length of this line. Center and direction remain unchanged.
197
+ Modifies this line.
198
+
199
+ #### Parameters
200
+
201
+ | Name | Type |
202
+ | :------ | :------ |
203
+ | `l` | `number` |
204
+
205
+ #### Returns
206
+
207
+ `void`
208
+
209
+ #### Defined in
210
+
211
+ [src/Line2D.ts:118](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L118)
212
+
213
+ ## Methods
214
+
215
+ ### chunk
216
+
217
+ ▸ **chunk**(`maxSegmentLength`): [`Line2D`](Line2D.md)[]
218
+
219
+ Divides the Line3D into a number of segments of the given length.
220
+ Clone the line, does not modify.
221
+
222
+ #### Parameters
223
+
224
+ | Name | Type | Description |
225
+ | :------ | :------ | :------ |
226
+ | `maxSegmentLength` | `number` | number |
227
+
228
+ #### Returns
229
+
230
+ [`Line2D`](Line2D.md)[]
231
+
232
+ #### Defined in
233
+
234
+ [src/Line2D.ts:370](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L370)
235
+
236
+ ___
237
+
238
+ ### clone
239
+
240
+ ▸ **clone**(): [`Line2D`](Line2D.md)
241
+
242
+ Deep clone of this line
243
+
244
+ #### Returns
245
+
246
+ [`Line2D`](Line2D.md)
247
+
248
+ #### Defined in
249
+
250
+ [src/Line2D.ts:650](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L650)
251
+
252
+ ___
253
+
254
+ ### closestPointOnInfiniteLine
255
+
256
+ ▸ **closestPointOnInfiniteLine**(`point`): [`Vec2`](Vec2.md)
257
+
258
+ Returns the closest point on the **infinite** line to the given point.
259
+
260
+ #### Parameters
261
+
262
+ | Name | Type |
263
+ | :------ | :------ |
264
+ | `point` | `Vector2` |
265
+
266
+ #### Returns
267
+
268
+ [`Vec2`](Vec2.md)
269
+
270
+ #### Defined in
271
+
272
+ [src/Line2D.ts:401](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L401)
273
+
274
+ ___
275
+
276
+ ### closestPointOnLine
277
+
278
+ ▸ **closestPointOnLine**(`point`): [`Vec2`](Vec2.md)
279
+
280
+ Returns the closest point on the line **section** to the given point.
281
+
282
+ #### Parameters
283
+
284
+ | Name | Type |
285
+ | :------ | :------ |
286
+ | `point` | `Vector2` |
287
+
288
+ #### Returns
289
+
290
+ [`Vec2`](Vec2.md)
291
+
292
+ #### Defined in
293
+
294
+ [src/Line2D.ts:410](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L410)
295
+
296
+ ___
297
+
298
+ ### closestPointToPointParameterOnInfiniteLine
299
+
300
+ ▸ **closestPointToPointParameterOnInfiniteLine**(`point`): `number`
301
+
302
+ Returns the closest point parameter on the **infinite** line to the given point.
303
+
304
+ #### Parameters
305
+
306
+ | Name | Type |
307
+ | :------ | :------ |
308
+ | `point` | `Vector2` |
309
+
310
+ #### Returns
311
+
312
+ `number`
313
+
314
+ #### Defined in
315
+
316
+ [src/Line2D.ts:387](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L387)
317
+
318
+ ___
319
+
320
+ ### distanceToPointOnInfiniteLine
321
+
322
+ ▸ **distanceToPointOnInfiniteLine**(`point`): `number`
323
+
324
+ Returns the distance between the **infinite** line and the point.
325
+
326
+ #### Parameters
327
+
328
+ | Name | Type |
329
+ | :------ | :------ |
330
+ | `point` | `Point2` |
331
+
332
+ #### Returns
333
+
334
+ `number`
335
+
336
+ #### Defined in
337
+
338
+ [src/Line2D.ts:423](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L423)
339
+
340
+ ___
341
+
342
+ ### equals
343
+
344
+ ▸ **equals**(`other`): `boolean`
345
+
346
+ #### Parameters
347
+
348
+ | Name | Type |
349
+ | :------ | :------ |
350
+ | `other` | [`Line2D`](Line2D.md) |
351
+
352
+ #### Returns
353
+
354
+ `boolean`
355
+
356
+ #### Defined in
357
+
358
+ [src/Line2D.ts:658](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L658)
359
+
360
+ ___
361
+
362
+ ### extendToEnds
363
+
364
+ ▸ **extendToEnds**(`lineToExtend`, `tolerance`): `void`
365
+
366
+ If other line is shorter than this, endpoints are moved to extend other
367
+ Does not create a copy. Provided line is modified.
368
+
369
+ #### Parameters
370
+
371
+ | Name | Type |
372
+ | :------ | :------ |
373
+ | `lineToExtend` | [`Line2D`](Line2D.md) |
374
+ | `tolerance` | `number` |
375
+
376
+ #### Returns
377
+
378
+ `void`
379
+
380
+ #### Defined in
381
+
382
+ [src/Line2D.ts:560](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L560)
383
+
384
+ ___
385
+
386
+ ### extendToOrTrimAtIntersection
387
+
388
+ ▸ **extendToOrTrimAtIntersection**(`other`, `maxDistanceToIntersection?`): [`Line2D`](Line2D.md)
389
+
390
+ If there is an intersection between this and other, this line is extended to the intersection point. Lines are assumed to be infinite.
391
+ Modifies this line.
392
+
393
+ #### Parameters
394
+
395
+ | Name | Type | Default value |
396
+ | :------ | :------ | :------ |
397
+ | `other` | [`Line2D`](Line2D.md) | `undefined` |
398
+ | `maxDistanceToIntersection` | `number` | `Number.MAX_VALUE` |
399
+
400
+ #### Returns
401
+
402
+ [`Line2D`](Line2D.md)
403
+
404
+ #### Defined in
405
+
406
+ [src/Line2D.ts:581](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L581)
407
+
408
+ ___
409
+
410
+ ### flip
411
+
412
+ ▸ **flip**(): [`Line2D`](Line2D.md)
413
+
414
+ Inverts the direction of the line.
415
+ Modifies this line.
416
+
417
+ #### Returns
418
+
419
+ [`Line2D`](Line2D.md)
420
+
421
+ #### Defined in
422
+
423
+ [src/Line2D.ts:155](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L155)
424
+
425
+ ___
426
+
427
+ ### getOverlap
428
+
429
+ ▸ **getOverlap**(`other`): [`Line2D`](Line2D.md)
430
+
431
+ Logical AND of this and the other line section.
432
+
433
+ #### Parameters
434
+
435
+ | Name | Type |
436
+ | :------ | :------ |
437
+ | `other` | [`Line2D`](Line2D.md) |
438
+
439
+ #### Returns
440
+
441
+ [`Line2D`](Line2D.md)
442
+
443
+ #### Defined in
444
+
445
+ [src/Line2D.ts:283](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L283)
446
+
447
+ ___
448
+
449
+ ### hasIntersectionWithAngle
450
+
451
+ ▸ **hasIntersectionWithAngle**(`other`, `expectedAngleInRads`): [`Vec2`](Vec2.md)
452
+
453
+ Check that the infinite lines intersect and that they are in the specified angle to each other
454
+
455
+ #### Parameters
456
+
457
+ | Name | Type | Description |
458
+ | :------ | :------ | :------ |
459
+ | `other` | [`Line2D`](Line2D.md) | Line |
460
+ | `expectedAngleInRads` | `number` | number |
461
+
462
+ #### Returns
463
+
464
+ [`Vec2`](Vec2.md)
465
+
466
+ #### Defined in
467
+
468
+ [src/Line2D.ts:631](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L631)
469
+
470
+ ___
471
+
472
+ ### intersect
473
+
474
+ ▸ **intersect**(`other`): [`Vec2`](Vec2.md)
475
+
476
+ Returns the intersection point of two lines. The lines are assumed to be infinite.
477
+
478
+ #### Parameters
479
+
480
+ | Name | Type |
481
+ | :------ | :------ |
482
+ | `other` | [`Line2D`](Line2D.md) |
483
+
484
+ #### Returns
485
+
486
+ [`Vec2`](Vec2.md)
487
+
488
+ #### Defined in
489
+
490
+ [src/Line2D.ts:604](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L604)
491
+
492
+ ___
493
+
494
+ ### isCollinearWithTouchOrOverlap
495
+
496
+ ▸ **isCollinearWithTouchOrOverlap**(`other`): `boolean`
497
+
498
+ Returns true if other line is collinear and overlaps or at least touching this line.
499
+
500
+ #### Parameters
501
+
502
+ | Name | Type |
503
+ | :------ | :------ |
504
+ | `other` | [`Line2D`](Line2D.md) |
505
+
506
+ #### Returns
507
+
508
+ `boolean`
509
+
510
+ #### Defined in
511
+
512
+ [src/Line2D.ts:255](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L255)
513
+
514
+ ___
515
+
516
+ ### isPointBesideLineSection
517
+
518
+ ▸ **isPointBesideLineSection**(`point`): `boolean`
519
+
520
+ Returns true when the point is beside the line **segment**
521
+
522
+ #### Parameters
523
+
524
+ | Name | Type |
525
+ | :------ | :------ |
526
+ | `point` | `Point2` |
527
+
528
+ #### Returns
529
+
530
+ `boolean`
531
+
532
+ #### Defined in
533
+
534
+ [src/Line2D.ts:235](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L235)
535
+
536
+ ___
537
+
538
+ ### isPointCloseToAndBesideLineSection
539
+
540
+ ▸ **isPointCloseToAndBesideLineSection**(`point`, `maxDistance`): `boolean`
541
+
542
+ Returns true when the point is beside the line **segment** and within the maxDistance.
543
+
544
+ #### Parameters
545
+
546
+ | Name | Type |
547
+ | :------ | :------ |
548
+ | `point` | `Point2` |
549
+ | `maxDistance` | `number` |
550
+
551
+ #### Returns
552
+
553
+ `boolean`
554
+
555
+ #### Defined in
556
+
557
+ [src/Line2D.ts:226](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L226)
558
+
559
+ ___
560
+
561
+ ### isPointOnInfiniteLine
562
+
563
+ ▸ **isPointOnInfiniteLine**(`point`): `boolean`
564
+
565
+ Returns true when the point is on the **infinite** line.
566
+
567
+ #### Parameters
568
+
569
+ | Name | Type |
570
+ | :------ | :------ |
571
+ | `point` | `Point2` |
572
+
573
+ #### Returns
574
+
575
+ `boolean`
576
+
577
+ #### Defined in
578
+
579
+ [src/Line2D.ts:247](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L247)
580
+
581
+ ___
582
+
583
+ ### isPointOnLineSection
584
+
585
+ ▸ **isPointOnLineSection**(`point`): `boolean`
586
+
587
+ Returns true when the point is actually inside the (finite) line segment.
588
+ https://jsfiddle.net/c06zdxtL/2/
589
+ https://stackoverflow.com/questions/6865832/detecting-if-a-point-is-of-a-line-segment/6877674
590
+
591
+ #### Parameters
592
+
593
+ | Name | Type |
594
+ | :------ | :------ |
595
+ | `point` | `Point2` |
596
+
597
+ #### Returns
598
+
599
+ `boolean`
600
+
601
+ #### Defined in
602
+
603
+ [src/Line2D.ts:213](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L213)
604
+
605
+ ___
606
+
607
+ ### moveEndPoint
608
+
609
+ ▸ **moveEndPoint**(`amount`): [`Line2D`](Line2D.md)
610
+
611
+ Moves end point on the line by the given amount. Plus values move the point further away from the center.
612
+ Modifies this line.
613
+
614
+ #### Parameters
615
+
616
+ | Name | Type |
617
+ | :------ | :------ |
618
+ | `amount` | `number` |
619
+
620
+ #### Returns
621
+
622
+ [`Line2D`](Line2D.md)
623
+
624
+ #### Defined in
625
+
626
+ [src/Line2D.ts:98](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L98)
627
+
628
+ ___
629
+
630
+ ### moveStartPoint
631
+
632
+ ▸ **moveStartPoint**(`amount`): [`Line2D`](Line2D.md)
633
+
634
+ #### Parameters
635
+
636
+ | Name | Type |
637
+ | :------ | :------ |
638
+ | `amount` | `number` |
639
+
640
+ #### Returns
641
+
642
+ [`Line2D`](Line2D.md)
643
+
644
+ #### Defined in
645
+
646
+ [src/Line2D.ts:87](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L87)
647
+
648
+ ___
649
+
650
+ ### overlaps
651
+
652
+ ▸ **overlaps**(`other`): `boolean`
653
+
654
+ Returns true if there is any overlap between this line and the
655
+
656
+ **`Other`**
657
+
658
+ line section.
659
+
660
+ #### Parameters
661
+
662
+ | Name | Type |
663
+ | :------ | :------ |
664
+ | `other` | [`Line2D`](Line2D.md) |
665
+
666
+ #### Returns
667
+
668
+ `boolean`
669
+
670
+ #### Defined in
671
+
672
+ [src/Line2D.ts:267](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L267)
673
+
674
+ ___
675
+
676
+ ### resize
677
+
678
+ ▸ **resize**(`amount`): [`Line2D`](Line2D.md)
679
+
680
+ #### Parameters
681
+
682
+ | Name | Type |
683
+ | :------ | :------ |
684
+ | `amount` | `number` |
685
+
686
+ #### Returns
687
+
688
+ [`Line2D`](Line2D.md)
689
+
690
+ #### Defined in
691
+
692
+ [src/Line2D.ts:77](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L77)
693
+
694
+ ___
695
+
696
+ ### rotate
697
+
698
+ ▸ **rotate**(`radians`, `center?`): [`Line2D`](Line2D.md)
699
+
700
+ Rotates the line around the center by the given angle in radians.
701
+ Modifies this line.
702
+
703
+ #### Parameters
704
+
705
+ | Name | Type | Description |
706
+ | :------ | :------ | :------ |
707
+ | `radians` | `number` | Positive values rotate counter-clockwise. |
708
+ | `center` | [`Vec2`](Vec2.md) | |
709
+
710
+ #### Returns
711
+
712
+ [`Line2D`](Line2D.md)
713
+
714
+ #### Defined in
715
+
716
+ [src/Line2D.ts:169](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L169)
717
+
718
+ ___
719
+
720
+ ### setCenter
721
+
722
+ ▸ **setCenter**(`value`): [`Line2D`](Line2D.md)
723
+
724
+ Set the center of the line to the provided point. Length and direction remain unchanged.
725
+ Modifies this line.
726
+
727
+ #### Parameters
728
+
729
+ | Name | Type |
730
+ | :------ | :------ |
731
+ | `value` | `Point2` |
732
+
733
+ #### Returns
734
+
735
+ [`Line2D`](Line2D.md)
736
+
737
+ #### Defined in
738
+
739
+ [src/Line2D.ts:68](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L68)
740
+
741
+ ___
742
+
743
+ ### setLength
744
+
745
+ ▸ **setLength**(`length`): [`Line2D`](Line2D.md)
746
+
747
+ Set the length of this line. Center and direction remain unchanged.
748
+
749
+ #### Parameters
750
+
751
+ | Name | Type |
752
+ | :------ | :------ |
753
+ | `length` | `number` |
754
+
755
+ #### Returns
756
+
757
+ [`Line2D`](Line2D.md)
758
+
759
+ #### Defined in
760
+
761
+ [src/Line2D.ts:131](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L131)
762
+
763
+ ___
764
+
765
+ ### splitAtIntersection
766
+
767
+ ▸ **splitAtIntersection**(`other`, `tolerance?`): [`Line2D`](Line2D.md)[]
768
+
769
+ Returns the original line section split into two parts, if the line **sections** overlap, otherwise null
770
+
771
+ #### Parameters
772
+
773
+ | Name | Type | Default value |
774
+ | :------ | :------ | :------ |
775
+ | `other` | [`Line2D`](Line2D.md) | `undefined` |
776
+ | `tolerance` | `number` | `0` |
777
+
778
+ #### Returns
779
+
780
+ [`Line2D`](Line2D.md)[]
781
+
782
+ #### Defined in
783
+
784
+ [src/Line2D.ts:476](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L476)
785
+
786
+ ___
787
+
788
+ ### splitAtOrExtendToIntersection
789
+
790
+ ▸ **splitAtOrExtendToIntersection**(`other`): [`Line2D`](Line2D.md)[]
791
+
792
+ If lines **sections** overlap, returns the original line section split into two parts, sorted by length
793
+ Else, if the **infinite** lines intersect, returns a new line extended to the intersection point
794
+ Otherwise, null if the lines are parallel and do not intersect
795
+
796
+ #### Parameters
797
+
798
+ | Name | Type |
799
+ | :------ | :------ |
800
+ | `other` | [`Line2D`](Line2D.md) |
801
+
802
+ #### Returns
803
+
804
+ [`Line2D`](Line2D.md)[]
805
+
806
+ #### Defined in
807
+
808
+ [src/Line2D.ts:495](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L495)
809
+
810
+ ___
811
+
812
+ ### toString
813
+
814
+ ▸ **toString**(): `string`
815
+
816
+ #### Returns
817
+
818
+ `string`
819
+
820
+ #### Defined in
821
+
822
+ [src/Line2D.ts:654](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L654)
823
+
824
+ ___
825
+
826
+ ### translate
827
+
828
+ ▸ **translate**(`value`): [`Line2D`](Line2D.md)
829
+
830
+ Move the line by the given vector.
831
+ Modifies this line.
832
+
833
+ #### Parameters
834
+
835
+ | Name | Type |
836
+ | :------ | :------ |
837
+ | `value` | `Point2` |
838
+
839
+ #### Returns
840
+
841
+ [`Line2D`](Line2D.md)
842
+
843
+ #### Defined in
844
+
845
+ [src/Line2D.ts:180](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L180)
846
+
847
+ ___
848
+
849
+ ### translateLeft
850
+
851
+ ▸ **translateLeft**(`amount`): [`Line2D`](Line2D.md)
852
+
853
+ Move the line to its left by the given amount.
854
+ Modifies this line.
855
+
856
+ #### Parameters
857
+
858
+ | Name | Type |
859
+ | :------ | :------ |
860
+ | `amount` | `number` |
861
+
862
+ #### Returns
863
+
864
+ [`Line2D`](Line2D.md)
865
+
866
+ #### Defined in
867
+
868
+ [src/Line2D.ts:193](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L193)
869
+
870
+ ___
871
+
872
+ ### translateRight
873
+
874
+ ▸ **translateRight**(`amount`): [`Line2D`](Line2D.md)
875
+
876
+ Move the line to its right by the given amount.
877
+ Modifies this line.
878
+
879
+ #### Parameters
880
+
881
+ | Name | Type |
882
+ | :------ | :------ |
883
+ | `amount` | `number` |
884
+
885
+ #### Returns
886
+
887
+ [`Line2D`](Line2D.md)
888
+
889
+ #### Defined in
890
+
891
+ [src/Line2D.ts:202](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L202)
892
+
893
+ ___
894
+
895
+ ### trimExcess
896
+
897
+ ▸ **trimExcess**(`lineToTrim`): `void`
898
+
899
+ If other line is not contained within this line, the excess is trimmed.
900
+ Does not create a copy. Provided line is modified.
901
+
902
+ #### Parameters
903
+
904
+ | Name | Type |
905
+ | :------ | :------ |
906
+ | `lineToTrim` | [`Line2D`](Line2D.md) |
907
+
908
+ #### Returns
909
+
910
+ `void`
911
+
912
+ #### Defined in
913
+
914
+ [src/Line2D.ts:538](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L538)
915
+
916
+ ___
917
+
918
+ ### clipLines
919
+
920
+ ▸ `Static` **clipLines**(`source`, `clips`): [`Line2D`](Line2D.md)[]
921
+
922
+ Returns lines that are the result of clipping
923
+
924
+ **`Source`**
925
+
926
+ line by the @clips.
927
+ Clips must be parallel to this line.
928
+ Clones the line, does not modify this.
929
+
930
+ #### Parameters
931
+
932
+ | Name | Type |
933
+ | :------ | :------ |
934
+ | `source` | [`Line2D`](Line2D.md) |
935
+ | `clips` | [`Line2D`](Line2D.md)[] |
936
+
937
+ #### Returns
938
+
939
+ [`Line2D`](Line2D.md)[]
940
+
941
+ #### Defined in
942
+
943
+ [src/Line2D.ts:437](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L437)
944
+
945
+ ___
946
+
947
+ ### fromCoordinates
948
+
949
+ ▸ `Static` **fromCoordinates**(`x1`, `y1`, `x2`, `y2`, `index?`): [`Line2D`](Line2D.md)
950
+
951
+ #### Parameters
952
+
953
+ | Name | Type | Default value |
954
+ | :------ | :------ | :------ |
955
+ | `x1` | `number` | `undefined` |
956
+ | `y1` | `number` | `undefined` |
957
+ | `x2` | `number` | `undefined` |
958
+ | `y2` | `number` | `undefined` |
959
+ | `index` | `number` | `0` |
960
+
961
+ #### Returns
962
+
963
+ [`Line2D`](Line2D.md)
964
+
965
+ #### Defined in
966
+
967
+ [src/Line2D.ts:10](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L10)
968
+
969
+ ___
970
+
971
+ ### fromLength
972
+
973
+ ▸ `Static` **fromLength**(`length`): [`Line2D`](Line2D.md)
974
+
975
+ #### Parameters
976
+
977
+ | Name | Type |
978
+ | :------ | :------ |
979
+ | `length` | `number` |
980
+
981
+ #### Returns
982
+
983
+ [`Line2D`](Line2D.md)
984
+
985
+ #### Defined in
986
+
987
+ [src/Line2D.ts:40](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L40)
988
+
989
+ ___
990
+
991
+ ### fromPoints
992
+
993
+ ▸ `Static` **fromPoints**(`p1`, `p2`, `index?`): [`Line2D`](Line2D.md)
994
+
995
+ #### Parameters
996
+
997
+ | Name | Type | Default value |
998
+ | :------ | :------ | :------ |
999
+ | `p1` | `Point2` | `undefined` |
1000
+ | `p2` | `Point2` | `undefined` |
1001
+ | `index` | `number` | `0` |
1002
+
1003
+ #### Returns
1004
+
1005
+ [`Line2D`](Line2D.md)
1006
+
1007
+ #### Defined in
1008
+
1009
+ [src/Line2D.ts:14](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L14)
1010
+
1011
+ ___
1012
+
1013
+ ### fromPolygon
1014
+
1015
+ ▸ `Static` **fromPolygon**(`polygon`, `forceClosedPolygon?`): [`Line2D`](Line2D.md)[]
1016
+
1017
+ Creates a polygon formed by an array of lines from points provided.
1018
+ The polygon will only be closed if either
1019
+ 1) the first and last points are the same or 2) `forceClosedPolygon` is true.
1020
+
1021
+ #### Parameters
1022
+
1023
+ | Name | Type | Default value |
1024
+ | :------ | :------ | :------ |
1025
+ | `polygon` | `Point2`[] | `undefined` |
1026
+ | `forceClosedPolygon` | `boolean` | `false` |
1027
+
1028
+ #### Returns
1029
+
1030
+ [`Line2D`](Line2D.md)[]
1031
+
1032
+ #### Defined in
1033
+
1034
+ [src/Line2D.ts:23](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L23)
1035
+
1036
+ ___
1037
+
1038
+ ### joinLine
1039
+
1040
+ ▸ `Static` **joinLine**(`line`, `other`): [`Line2D`](Line2D.md)
1041
+
1042
+ Joins a copy of
1043
+
1044
+ **`Line`**
1045
+
1046
+ with the
1047
+
1048
+ **`Other`**
1049
+
1050
+ line.
1051
+ Other must be parallel to this line.
1052
+ Returns null if there is no overlap
1053
+ Clones the line, does not modify.
1054
+
1055
+ #### Parameters
1056
+
1057
+ | Name | Type |
1058
+ | :------ | :------ |
1059
+ | `line` | [`Line2D`](Line2D.md) |
1060
+ | `other` | [`Line2D`](Line2D.md) |
1061
+
1062
+ #### Returns
1063
+
1064
+ [`Line2D`](Line2D.md)
1065
+
1066
+ #### Defined in
1067
+
1068
+ [src/Line2D.ts:317](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L317)
1069
+
1070
+ ___
1071
+
1072
+ ### joinLines
1073
+
1074
+ ▸ `Static` **joinLines**(`lines`): [`Line2D`](Line2D.md)[]
1075
+
1076
+ Joins provided lines into several joined lines.
1077
+ Lines must be parallel for joining.
1078
+ Clone the lines, does not modify.
1079
+
1080
+ #### Parameters
1081
+
1082
+ | Name | Type |
1083
+ | :------ | :------ |
1084
+ | `lines` | [`Line2D`](Line2D.md)[] |
1085
+
1086
+ #### Returns
1087
+
1088
+ [`Line2D`](Line2D.md)[]
1089
+
1090
+ #### Defined in
1091
+
1092
+ [src/Line2D.ts:334](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line2D.ts#L334)