@immugio/three-math-extensions 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,6 +37,7 @@
37
37
  - [distanceToPoint](Line3D.md#distancetopoint)
38
38
  - [equals](Line3D.md#equals)
39
39
  - [getParallelLineInTheSameDirection](Line3D.md#getparallellineinthesamedirection)
40
+ - [intersect](Line3D.md#intersect)
40
41
  - [isParallelTo](Line3D.md#isparallelto)
41
42
  - [joinLine](Line3D.md#joinline)
42
43
  - [moveEndPoint](Line3D.md#moveendpoint)
@@ -72,7 +73,7 @@ Line3.constructor
72
73
 
73
74
  #### Defined in
74
75
 
75
- [src/Line3D.ts:13](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L13)
76
+ [src/Line3D.ts:13](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L13)
76
77
 
77
78
  ## Properties
78
79
 
@@ -86,7 +87,7 @@ Line3.end
86
87
 
87
88
  #### Defined in
88
89
 
89
- [src/Line3D.ts:9](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L9)
90
+ [src/Line3D.ts:9](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L9)
90
91
 
91
92
  ___
92
93
 
@@ -100,7 +101,7 @@ Line3.start
100
101
 
101
102
  #### Defined in
102
103
 
103
- [src/Line3D.ts:8](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L8)
104
+ [src/Line3D.ts:8](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L8)
104
105
 
105
106
  ## Accessors
106
107
 
@@ -116,7 +117,7 @@ Returns the center of this line
116
117
 
117
118
  #### Defined in
118
119
 
119
- [src/Line3D.ts:270](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L270)
120
+ [src/Line3D.ts:270](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L270)
120
121
 
121
122
  ___
122
123
 
@@ -132,7 +133,7 @@ Returns the direction of this line.
132
133
 
133
134
  #### Defined in
134
135
 
135
- [src/Line3D.ts:263](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L263)
136
+ [src/Line3D.ts:263](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L263)
136
137
 
137
138
  ___
138
139
 
@@ -148,7 +149,7 @@ Returns the start and end points of the line as an array.
148
149
 
149
150
  #### Defined in
150
151
 
151
- [src/Line3D.ts:293](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L293)
152
+ [src/Line3D.ts:293](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L293)
152
153
 
153
154
  ___
154
155
 
@@ -164,7 +165,7 @@ Returns this line's length.
164
165
 
165
166
  #### Defined in
166
167
 
167
- [src/Line3D.ts:247](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L247)
168
+ [src/Line3D.ts:247](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L247)
168
169
 
169
170
  ## Methods
170
171
 
@@ -186,7 +187,7 @@ Divides the Line3D into a number of segments of the given length.
186
187
 
187
188
  #### Defined in
188
189
 
189
- [src/Line3D.ts:405](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L405)
190
+ [src/Line3D.ts:405](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L405)
190
191
 
191
192
  ___
192
193
 
@@ -215,7 +216,7 @@ Clones the line, does not modify this.
215
216
 
216
217
  #### Defined in
217
218
 
218
- [src/Line3D.ts:51](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L51)
219
+ [src/Line3D.ts:51](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L51)
219
220
 
220
221
  ___
221
222
 
@@ -241,7 +242,7 @@ Clones the line, does not modify this.
241
242
 
242
243
  #### Defined in
243
244
 
244
- [src/Line3D.ts:76](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L76)
245
+ [src/Line3D.ts:76](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L76)
245
246
 
246
247
  ___
247
248
 
@@ -261,7 +262,7 @@ Line3.clone
261
262
 
262
263
  #### Defined in
263
264
 
264
- [src/Line3D.ts:464](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L464)
265
+ [src/Line3D.ts:522](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L522)
265
266
 
266
267
  ___
267
268
 
@@ -284,7 +285,7 @@ Check that this line section contains provided point.
284
285
 
285
286
  #### Defined in
286
287
 
287
- [src/Line3D.ts:302](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L302)
288
+ [src/Line3D.ts:302](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L302)
288
289
 
289
290
  ___
290
291
 
@@ -311,7 +312,7 @@ line section.
311
312
 
312
313
  #### Defined in
313
314
 
314
- [src/Line3D.ts:200](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L200)
315
+ [src/Line3D.ts:200](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L200)
315
316
 
316
317
  ___
317
318
 
@@ -334,7 +335,7 @@ Distance from this line to provided point.
334
335
 
335
336
  #### Defined in
336
337
 
337
- [src/Line3D.ts:312](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L312)
338
+ [src/Line3D.ts:312](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L312)
338
339
 
339
340
  ___
340
341
 
@@ -361,7 +362,7 @@ Line3.equals
361
362
 
362
363
  #### Defined in
363
364
 
364
- [src/Line3D.ts:457](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L457)
365
+ [src/Line3D.ts:515](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L515)
365
366
 
366
367
  ___
367
368
 
@@ -393,7 +394,34 @@ Returns null if lines are not parallel.
393
394
 
394
395
  #### Defined in
395
396
 
396
- [src/Line3D.ts:323](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L323)
397
+ [src/Line3D.ts:323](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L323)
398
+
399
+ ___
400
+
401
+ ### intersect
402
+
403
+ ▸ **intersect**(`other`): [`Line3D`](Line3D.md)
404
+
405
+ Calculates the intersection between this and `other` line. The lines are assumed to be infinite.
406
+ In a lot of cases an actual intersection cannot be calculated due to rounding errors.
407
+ Therefore, the intersection calculated by this method comes in a form of the shorted possible line segment connecting the two lines.
408
+ Sources:
409
+ http://paulbourke.net/geometry/pointlineplane/
410
+ https://stackoverflow.com/questions/2316490/the-algorithm-to-find-the-point-of-intersection-of-two-3d-line-segment/2316934#2316934
411
+
412
+ #### Parameters
413
+
414
+ | Name | Type |
415
+ | :------ | :------ |
416
+ | `other` | [`Line3D`](Line3D.md) |
417
+
418
+ #### Returns
419
+
420
+ [`Line3D`](Line3D.md)
421
+
422
+ #### Defined in
423
+
424
+ [src/Line3D.ts:456](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L456)
397
425
 
398
426
  ___
399
427
 
@@ -420,7 +448,7 @@ is parallel to this line.
420
448
 
421
449
  #### Defined in
422
450
 
423
- [src/Line3D.ts:344](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L344)
451
+ [src/Line3D.ts:344](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L344)
424
452
 
425
453
  ___
426
454
 
@@ -451,7 +479,7 @@ Clones the line, does not modify this.
451
479
 
452
480
  #### Defined in
453
481
 
454
- [src/Line3D.ts:111](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L111)
482
+ [src/Line3D.ts:111](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L111)
455
483
 
456
484
  ___
457
485
 
@@ -471,7 +499,7 @@ ___
471
499
 
472
500
  #### Defined in
473
501
 
474
- [src/Line3D.ts:380](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L380)
502
+ [src/Line3D.ts:380](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L380)
475
503
 
476
504
  ___
477
505
 
@@ -491,7 +519,7 @@ ___
491
519
 
492
520
  #### Defined in
493
521
 
494
- [src/Line3D.ts:368](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L368)
522
+ [src/Line3D.ts:368](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L368)
495
523
 
496
524
  ___
497
525
 
@@ -507,7 +535,7 @@ Project the line to 2D space, Y value is dropped
507
535
 
508
536
  #### Defined in
509
537
 
510
- [src/Line3D.ts:450](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L450)
538
+ [src/Line3D.ts:508](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L508)
511
539
 
512
540
  ___
513
541
 
@@ -535,7 +563,7 @@ line section.
535
563
 
536
564
  #### Defined in
537
565
 
538
- [src/Line3D.ts:210](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L210)
566
+ [src/Line3D.ts:210](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L210)
539
567
 
540
568
  ___
541
569
 
@@ -558,7 +586,7 @@ Returns a new line that is the projection of this line onto @other. Uses `closes
558
586
 
559
587
  #### Defined in
560
588
 
561
- [src/Line3D.ts:394](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L394)
589
+ [src/Line3D.ts:394](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L394)
562
590
 
563
591
  ___
564
592
 
@@ -578,7 +606,7 @@ ___
578
606
 
579
607
  #### Defined in
580
608
 
581
- [src/Line3D.ts:359](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L359)
609
+ [src/Line3D.ts:359](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L359)
582
610
 
583
611
  ___
584
612
 
@@ -600,7 +628,7 @@ Set the center of the line to the provided point. Length and direction remain un
600
628
 
601
629
  #### Defined in
602
630
 
603
- [src/Line3D.ts:278](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L278)
631
+ [src/Line3D.ts:278](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L278)
604
632
 
605
633
  ___
606
634
 
@@ -622,7 +650,7 @@ Set the length of this line. Center and direction remain unchanged.
622
650
 
623
651
  #### Defined in
624
652
 
625
- [src/Line3D.ts:255](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L255)
653
+ [src/Line3D.ts:255](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L255)
626
654
 
627
655
  ___
628
656
 
@@ -636,7 +664,7 @@ ___
636
664
 
637
665
  #### Defined in
638
666
 
639
- [src/Line3D.ts:468](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L468)
667
+ [src/Line3D.ts:526](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L526)
640
668
 
641
669
  ___
642
670
 
@@ -658,7 +686,7 @@ Move this line by the given vector.
658
686
 
659
687
  #### Defined in
660
688
 
661
- [src/Line3D.ts:441](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L441)
689
+ [src/Line3D.ts:441](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L441)
662
690
 
663
691
  ___
664
692
 
@@ -679,7 +707,7 @@ ___
679
707
 
680
708
  #### Defined in
681
709
 
682
- [src/Line3D.ts:18](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L18)
710
+ [src/Line3D.ts:18](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L18)
683
711
 
684
712
  ___
685
713
 
@@ -704,7 +732,7 @@ The polygon will only be closed if either
704
732
 
705
733
  #### Defined in
706
734
 
707
- [src/Line3D.ts:27](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L27)
735
+ [src/Line3D.ts:27](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L27)
708
736
 
709
737
  ___
710
738
 
@@ -729,4 +757,4 @@ Lines must be parallel for joining.
729
757
 
730
758
  #### Defined in
731
759
 
732
- [src/Line3D.ts:165](https://github.com/Immugio/three-math-extensions/blob/70c8d5e/src/Line3D.ts#L165)
760
+ [src/Line3D.ts:165](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Line3D.ts#L165)
@@ -0,0 +1,235 @@
1
+ [@immugio/three-math-extensions](../README.md) / [Exports](../modules.md) / Polygon
2
+
3
+ # Class: Polygon
4
+
5
+ ## Table of contents
6
+
7
+ ### Constructors
8
+
9
+ - [constructor](Polygon.md#constructor)
10
+
11
+ ### Properties
12
+
13
+ - [contour](Polygon.md#contour)
14
+ - [holes](Polygon.md#holes)
15
+
16
+ ### Accessors
17
+
18
+ - [size](Polygon.md#size)
19
+
20
+ ### Methods
21
+
22
+ - [boundingBox](Polygon.md#boundingbox)
23
+ - [center](Polygon.md#center)
24
+ - [centerOnOrigin](Polygon.md#centeronorigin)
25
+ - [clone](Polygon.md#clone)
26
+ - [ensureLastPoint](Polygon.md#ensurelastpoint)
27
+ - [equals](Polygon.md#equals)
28
+ - [flip](Polygon.md#flip)
29
+ - [toBoundingPolygon](Polygon.md#toboundingpolygon)
30
+ - [toRectangle](Polygon.md#torectangle)
31
+ - [fromPoints](Polygon.md#frompoints)
32
+
33
+ ## Constructors
34
+
35
+ ### constructor
36
+
37
+ • **new Polygon**(`contour`, `holes?`)
38
+
39
+ #### Parameters
40
+
41
+ | Name | Type |
42
+ | :------ | :------ |
43
+ | `contour` | [`Vec2`](Vec2.md)[] |
44
+ | `holes?` | [`Vec2`](Vec2.md)[][] |
45
+
46
+ #### Defined in
47
+
48
+ [src/Polygon.ts:8](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Polygon.ts#L8)
49
+
50
+ ## Properties
51
+
52
+ ### contour
53
+
54
+ • **contour**: [`Vec2`](Vec2.md)[]
55
+
56
+ #### Defined in
57
+
58
+ [src/Polygon.ts:8](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Polygon.ts#L8)
59
+
60
+ ___
61
+
62
+ ### holes
63
+
64
+ • `Optional` **holes**: [`Vec2`](Vec2.md)[][]
65
+
66
+ #### Defined in
67
+
68
+ [src/Polygon.ts:8](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Polygon.ts#L8)
69
+
70
+ ## Accessors
71
+
72
+ ### size
73
+
74
+ • `get` **size**(): [`Vec2`](Vec2.md)
75
+
76
+ #### Returns
77
+
78
+ [`Vec2`](Vec2.md)
79
+
80
+ #### Defined in
81
+
82
+ [src/Polygon.ts:15](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Polygon.ts#L15)
83
+
84
+ ## Methods
85
+
86
+ ### boundingBox
87
+
88
+ ▸ **boundingBox**(): [`BoundingBox`](BoundingBox.md)
89
+
90
+ #### Returns
91
+
92
+ [`BoundingBox`](BoundingBox.md)
93
+
94
+ #### Defined in
95
+
96
+ [src/Polygon.ts:64](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Polygon.ts#L64)
97
+
98
+ ___
99
+
100
+ ### center
101
+
102
+ ▸ **center**(): [`Vec2`](Vec2.md)
103
+
104
+ #### Returns
105
+
106
+ [`Vec2`](Vec2.md)
107
+
108
+ #### Defined in
109
+
110
+ [src/Polygon.ts:39](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Polygon.ts#L39)
111
+
112
+ ___
113
+
114
+ ### centerOnOrigin
115
+
116
+ ▸ **centerOnOrigin**(): [`Polygon`](Polygon.md)
117
+
118
+ #### Returns
119
+
120
+ [`Polygon`](Polygon.md)
121
+
122
+ #### Defined in
123
+
124
+ [src/Polygon.ts:20](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Polygon.ts#L20)
125
+
126
+ ___
127
+
128
+ ### clone
129
+
130
+ ▸ **clone**(): [`Polygon`](Polygon.md)
131
+
132
+ #### Returns
133
+
134
+ [`Polygon`](Polygon.md)
135
+
136
+ #### Defined in
137
+
138
+ [src/Polygon.ts:106](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Polygon.ts#L106)
139
+
140
+ ___
141
+
142
+ ### ensureLastPoint
143
+
144
+ ▸ **ensureLastPoint**(): [`Polygon`](Polygon.md)
145
+
146
+ #### Returns
147
+
148
+ [`Polygon`](Polygon.md)
149
+
150
+ #### Defined in
151
+
152
+ [src/Polygon.ts:48](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Polygon.ts#L48)
153
+
154
+ ___
155
+
156
+ ### equals
157
+
158
+ ▸ **equals**(`other`): `boolean`
159
+
160
+ #### Parameters
161
+
162
+ | Name | Type |
163
+ | :------ | :------ |
164
+ | `other` | [`Polygon`](Polygon.md) |
165
+
166
+ #### Returns
167
+
168
+ `boolean`
169
+
170
+ #### Defined in
171
+
172
+ [src/Polygon.ts:110](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Polygon.ts#L110)
173
+
174
+ ___
175
+
176
+ ### flip
177
+
178
+ ▸ **flip**(): [`Polygon`](Polygon.md)
179
+
180
+ #### Returns
181
+
182
+ [`Polygon`](Polygon.md)
183
+
184
+ #### Defined in
185
+
186
+ [src/Polygon.ts:87](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Polygon.ts#L87)
187
+
188
+ ___
189
+
190
+ ### toBoundingPolygon
191
+
192
+ ▸ **toBoundingPolygon**(): [`Polygon`](Polygon.md)
193
+
194
+ #### Returns
195
+
196
+ [`Polygon`](Polygon.md)
197
+
198
+ #### Defined in
199
+
200
+ [src/Polygon.ts:77](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Polygon.ts#L77)
201
+
202
+ ___
203
+
204
+ ### toRectangle
205
+
206
+ ▸ **toRectangle**(): [`Rectangle`](Rectangle.md)
207
+
208
+ #### Returns
209
+
210
+ [`Rectangle`](Rectangle.md)
211
+
212
+ #### Defined in
213
+
214
+ [src/Polygon.ts:101](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Polygon.ts#L101)
215
+
216
+ ___
217
+
218
+ ### fromPoints
219
+
220
+ ▸ `Static` **fromPoints**(`contour`, `holes?`): [`Polygon`](Polygon.md)
221
+
222
+ #### Parameters
223
+
224
+ | Name | Type |
225
+ | :------ | :------ |
226
+ | `contour` | `Point2`[] |
227
+ | `holes?` | `Point2`[][] |
228
+
229
+ #### Returns
230
+
231
+ [`Polygon`](Polygon.md)
232
+
233
+ #### Defined in
234
+
235
+ [src/Polygon.ts:11](https://github.com/Immugio/three-math-extensions/blob/c004965/src/Polygon.ts#L11)