@immugio/three-math-extensions 0.3.4 → 0.3.6
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 +17 -1
- package/cjs/Line2D.js +90 -13
- package/docs/classes/BoundingBox.md +121 -121
- package/docs/classes/Line2D.md +1366 -1366
- package/docs/classes/Line3D.md +831 -831
- package/docs/classes/Polygon.md +297 -297
- package/docs/classes/Rectangle.md +291 -291
- package/docs/classes/Size2.md +55 -55
- package/docs/classes/Vec2.md +282 -282
- package/docs/classes/Vec3.md +338 -338
- package/docs/interfaces/Point2.md +30 -30
- package/docs/interfaces/Point3.md +41 -41
- package/docs/modules.md +209 -209
- package/eslint.config.mjs +111 -111
- package/esm/Line2D.js +90 -13
- package/package.json +62 -62
- package/src/BoundingBox.ts +13 -13
- package/src/Line2D.ts +951 -857
- package/src/Line3D.ts +586 -586
- package/src/MathConstants.ts +1 -1
- package/src/Point2.ts +3 -3
- package/src/Point3.ts +4 -4
- package/src/Polygon.ts +286 -286
- package/src/Rectangle.ts +92 -92
- package/src/Size2.ts +3 -3
- package/src/Vec2.ts +124 -124
- package/src/Vec3.ts +167 -167
- package/src/containsPoint.ts +65 -65
- package/src/directions.ts +9 -9
- package/src/directions2d.ts +7 -7
- package/src/ensurePolygonClockwise.ts +9 -9
- package/src/extendOrTrimPolylinesAtIntersections.ts +10 -10
- package/src/getPolygonArea.ts +21 -21
- package/src/index.ts +24 -24
- package/src/isContinuousClosedShape.ts +24 -24
- package/src/isPointInPolygon.ts +23 -23
- package/src/isPolygonClockwise.ts +15 -15
- package/src/normalizeAngleDegrees.ts +6 -6
- package/src/normalizeAngleRadians.ts +14 -14
- package/src/offsetPolyline.ts +26 -26
- package/src/polygonPerimeter.ts +13 -13
- package/src/sortLinesByConnections.ts +45 -45
- package/types/Line2D.d.ts +12 -5
package/docs/classes/Line2D.md
CHANGED
|
@@ -1,1366 +1,1366 @@
|
|
|
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
|
-
- [isCloserToHorizontal](Line2D.md#isclosertohorizontal)
|
|
23
|
-
- [isCloserToVertical](Line2D.md#isclosertovertical)
|
|
24
|
-
- [length](Line2D.md#length)
|
|
25
|
-
|
|
26
|
-
### Methods
|
|
27
|
-
|
|
28
|
-
- [chunk](Line2D.md#chunk)
|
|
29
|
-
- [clone](Line2D.md#clone)
|
|
30
|
-
- [closestPointToPoint](Line2D.md#closestpointtopoint)
|
|
31
|
-
- [closestPointToPointParameter](Line2D.md#closestpointtopointparameter)
|
|
32
|
-
- [connectsTo](Line2D.md#connectsto)
|
|
33
|
-
- [containsPoint](Line2D.md#containspoint)
|
|
34
|
-
- [covers](Line2D.md#covers)
|
|
35
|
-
- [delta](Line2D.md#delta)
|
|
36
|
-
- [distanceToPoint](Line2D.md#distancetopoint)
|
|
37
|
-
- [distanceToPointOnInfiniteLine](Line2D.md#distancetopointoninfiniteline)
|
|
38
|
-
- [equals](Line2D.md#equals)
|
|
39
|
-
- [extendToEnds](Line2D.md#extendtoends)
|
|
40
|
-
- [extendToOrTrimAtIntersection](Line2D.md#extendtoortrimatintersection)
|
|
41
|
-
- [flip](Line2D.md#flip)
|
|
42
|
-
- [getOverlap](Line2D.md#getoverlap)
|
|
43
|
-
- [getParallelLineInTheSameDirection](Line2D.md#getparallellineinthesamedirection)
|
|
44
|
-
- [hasIntersectionWithAngle](Line2D.md#hasintersectionwithangle)
|
|
45
|
-
- [in3DSpace](Line2D.md#in3dspace)
|
|
46
|
-
- [intersect](Line2D.md#intersect)
|
|
47
|
-
- [isCollinearWithTouchOrOverlap](Line2D.md#iscollinearwithtouchoroverlap)
|
|
48
|
-
- [isParallelTo](Line2D.md#isparallelto)
|
|
49
|
-
- [isPointBesideLineSection](Line2D.md#ispointbesidelinesection)
|
|
50
|
-
- [isPointCloseToAndBesideLineSection](Line2D.md#ispointclosetoandbesidelinesection)
|
|
51
|
-
- [isPointOnInfiniteLine](Line2D.md#ispointoninfiniteline)
|
|
52
|
-
- [isPointOnLineSection](Line2D.md#ispointonlinesection)
|
|
53
|
-
- [moveEndPoint](Line2D.md#moveendpoint)
|
|
54
|
-
- [moveStartPoint](Line2D.md#movestartpoint)
|
|
55
|
-
- [overlaps](Line2D.md#overlaps)
|
|
56
|
-
- [projectOn](Line2D.md#projecton)
|
|
57
|
-
- [resize](Line2D.md#resize)
|
|
58
|
-
- [rotate](Line2D.md#rotate)
|
|
59
|
-
- [setCenter](Line2D.md#setcenter)
|
|
60
|
-
- [setLength](Line2D.md#setlength)
|
|
61
|
-
- [splitAtIntersection](Line2D.md#splitatintersection)
|
|
62
|
-
- [splitAtOrExtendToIntersection](Line2D.md#splitatorextendtointersection)
|
|
63
|
-
- [toString](Line2D.md#tostring)
|
|
64
|
-
- [translate](Line2D.md#translate)
|
|
65
|
-
- [translateLeft](Line2D.md#translateleft)
|
|
66
|
-
- [translateRight](Line2D.md#translateright)
|
|
67
|
-
- [trimExcess](Line2D.md#trimexcess)
|
|
68
|
-
- [clipLines](Line2D.md#cliplines)
|
|
69
|
-
- [fromCoordinates](Line2D.md#fromcoordinates)
|
|
70
|
-
- [fromLength](Line2D.md#fromlength)
|
|
71
|
-
- [fromPoints](Line2D.md#frompoints)
|
|
72
|
-
- [fromPolygon](Line2D.md#frompolygon)
|
|
73
|
-
- [groupConnectedLines](Line2D.md#groupconnectedlines)
|
|
74
|
-
- [joinLine](Line2D.md#joinline)
|
|
75
|
-
- [joinLines](Line2D.md#joinlines)
|
|
76
|
-
|
|
77
|
-
## Constructors
|
|
78
|
-
|
|
79
|
-
### constructor
|
|
80
|
-
|
|
81
|
-
• **new Line2D**(`start`, `end`, `index?`): [`Line2D`](Line2D.md)
|
|
82
|
-
|
|
83
|
-
#### Parameters
|
|
84
|
-
|
|
85
|
-
| Name | Type | Default value |
|
|
86
|
-
| :------ | :------ | :------ |
|
|
87
|
-
| `start` | [`Vec2`](Vec2.md) | `undefined` |
|
|
88
|
-
| `end` | [`Vec2`](Vec2.md) | `undefined` |
|
|
89
|
-
| `index` | `number` | `0` |
|
|
90
|
-
|
|
91
|
-
#### Returns
|
|
92
|
-
|
|
93
|
-
[`Line2D`](Line2D.md)
|
|
94
|
-
|
|
95
|
-
#### Defined in
|
|
96
|
-
|
|
97
|
-
[src/Line2D.ts:15](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L15)
|
|
98
|
-
|
|
99
|
-
## Properties
|
|
100
|
-
|
|
101
|
-
### end
|
|
102
|
-
|
|
103
|
-
• **end**: [`Vec2`](Vec2.md)
|
|
104
|
-
|
|
105
|
-
#### Defined in
|
|
106
|
-
|
|
107
|
-
[src/Line2D.ts:15](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L15)
|
|
108
|
-
|
|
109
|
-
___
|
|
110
|
-
|
|
111
|
-
### index
|
|
112
|
-
|
|
113
|
-
• **index**: `number` = `0`
|
|
114
|
-
|
|
115
|
-
#### Defined in
|
|
116
|
-
|
|
117
|
-
[src/Line2D.ts:15](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L15)
|
|
118
|
-
|
|
119
|
-
___
|
|
120
|
-
|
|
121
|
-
### start
|
|
122
|
-
|
|
123
|
-
• **start**: [`Vec2`](Vec2.md)
|
|
124
|
-
|
|
125
|
-
#### Defined in
|
|
126
|
-
|
|
127
|
-
[src/Line2D.ts:15](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L15)
|
|
128
|
-
|
|
129
|
-
## Accessors
|
|
130
|
-
|
|
131
|
-
### center
|
|
132
|
-
|
|
133
|
-
• `get` **center**(): [`Vec2`](Vec2.md)
|
|
134
|
-
|
|
135
|
-
#### Returns
|
|
136
|
-
|
|
137
|
-
[`Vec2`](Vec2.md)
|
|
138
|
-
|
|
139
|
-
#### Defined in
|
|
140
|
-
|
|
141
|
-
[src/Line2D.ts:52](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L52)
|
|
142
|
-
|
|
143
|
-
• `set` **center**(`value`): `void`
|
|
144
|
-
|
|
145
|
-
Set the center of the line to the provided point. Length and direction remain unchanged.
|
|
146
|
-
Modifies this line.
|
|
147
|
-
|
|
148
|
-
#### Parameters
|
|
149
|
-
|
|
150
|
-
| Name | Type |
|
|
151
|
-
| :------ | :------ |
|
|
152
|
-
| `value` | [`Point2`](../interfaces/Point2.md) |
|
|
153
|
-
|
|
154
|
-
#### Returns
|
|
155
|
-
|
|
156
|
-
`void`
|
|
157
|
-
|
|
158
|
-
#### Defined in
|
|
159
|
-
|
|
160
|
-
[src/Line2D.ts:61](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L61)
|
|
161
|
-
|
|
162
|
-
___
|
|
163
|
-
|
|
164
|
-
### direction
|
|
165
|
-
|
|
166
|
-
• `get` **direction**(): [`Vec2`](Vec2.md)
|
|
167
|
-
|
|
168
|
-
Returns the direction of this line.
|
|
169
|
-
|
|
170
|
-
#### Returns
|
|
171
|
-
|
|
172
|
-
[`Vec2`](Vec2.md)
|
|
173
|
-
|
|
174
|
-
#### Defined in
|
|
175
|
-
|
|
176
|
-
[src/Line2D.ts:209](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L209)
|
|
177
|
-
|
|
178
|
-
___
|
|
179
|
-
|
|
180
|
-
### endpoints
|
|
181
|
-
|
|
182
|
-
• `get` **endpoints**(): [`Vec2`](Vec2.md)[]
|
|
183
|
-
|
|
184
|
-
Returns the start and end points of the line as an array.
|
|
185
|
-
Endpoints are not cloned.
|
|
186
|
-
|
|
187
|
-
#### Returns
|
|
188
|
-
|
|
189
|
-
[`Vec2`](Vec2.md)[]
|
|
190
|
-
|
|
191
|
-
#### Defined in
|
|
192
|
-
|
|
193
|
-
[src/Line2D.ts:161](https://github.com/Immugio/three-math-extensions/blob/e397290/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/e397290/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/e397290/src/Line2D.ts#L771)
|
|
222
|
-
|
|
223
|
-
___
|
|
224
|
-
|
|
225
|
-
### length
|
|
226
|
-
|
|
227
|
-
• `get` **length**(): `number`
|
|
228
|
-
|
|
229
|
-
#### Returns
|
|
230
|
-
|
|
231
|
-
`number`
|
|
232
|
-
|
|
233
|
-
#### Defined in
|
|
234
|
-
|
|
235
|
-
[src/Line2D.ts:144](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L144)
|
|
236
|
-
|
|
237
|
-
• `set` **length**(`l`): `void`
|
|
238
|
-
|
|
239
|
-
Set the length of this line. Center and direction remain unchanged.
|
|
240
|
-
Modifies this line.
|
|
241
|
-
|
|
242
|
-
#### Parameters
|
|
243
|
-
|
|
244
|
-
| Name | Type |
|
|
245
|
-
| :------ | :------ |
|
|
246
|
-
| `l` | `number` |
|
|
247
|
-
|
|
248
|
-
#### Returns
|
|
249
|
-
|
|
250
|
-
`void`
|
|
251
|
-
|
|
252
|
-
#### Defined in
|
|
253
|
-
|
|
254
|
-
[src/Line2D.ts:139](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L139)
|
|
255
|
-
|
|
256
|
-
## Methods
|
|
257
|
-
|
|
258
|
-
### chunk
|
|
259
|
-
|
|
260
|
-
▸ **chunk**(`maxSegmentLength`): [`Line2D`](Line2D.md)[]
|
|
261
|
-
|
|
262
|
-
Divides the Line3D into a number of segments of the given length.
|
|
263
|
-
Clone the line, does not modify.
|
|
264
|
-
|
|
265
|
-
#### Parameters
|
|
266
|
-
|
|
267
|
-
| Name | Type | Description |
|
|
268
|
-
| :------ | :------ | :------ |
|
|
269
|
-
| `maxSegmentLength` | `number` | number |
|
|
270
|
-
|
|
271
|
-
#### Returns
|
|
272
|
-
|
|
273
|
-
[`Line2D`](Line2D.md)[]
|
|
274
|
-
|
|
275
|
-
#### Defined in
|
|
276
|
-
|
|
277
|
-
[src/Line2D.ts:479](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L479)
|
|
278
|
-
|
|
279
|
-
___
|
|
280
|
-
|
|
281
|
-
### clone
|
|
282
|
-
|
|
283
|
-
▸ **clone**(): [`Line2D`](Line2D.md)
|
|
284
|
-
|
|
285
|
-
Deep clone of this line
|
|
286
|
-
|
|
287
|
-
#### Returns
|
|
288
|
-
|
|
289
|
-
[`Line2D`](Line2D.md)
|
|
290
|
-
|
|
291
|
-
#### Defined in
|
|
292
|
-
|
|
293
|
-
[src/Line2D.ts:850](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L850)
|
|
294
|
-
|
|
295
|
-
___
|
|
296
|
-
|
|
297
|
-
### closestPointToPoint
|
|
298
|
-
|
|
299
|
-
▸ **closestPointToPoint**(`point`, `clampToLine?`, `target?`): [`Vec2`](Vec2.md)
|
|
300
|
-
|
|
301
|
-
Returns the closest point on the line to the given point.
|
|
302
|
-
|
|
303
|
-
#### Parameters
|
|
304
|
-
|
|
305
|
-
| Name | Type | Description |
|
|
306
|
-
| :------ | :------ | :------ |
|
|
307
|
-
| `point` | `Vector2` | |
|
|
308
|
-
| `clampToLine?` | `boolean` | boolean (optional) |
|
|
309
|
-
| `target?` | [`Vec2`](Vec2.md) | Vec2 (optional) |
|
|
310
|
-
|
|
311
|
-
#### Returns
|
|
312
|
-
|
|
313
|
-
[`Vec2`](Vec2.md)
|
|
314
|
-
|
|
315
|
-
#### Defined in
|
|
316
|
-
|
|
317
|
-
[src/Line2D.ts:498](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L498)
|
|
318
|
-
|
|
319
|
-
___
|
|
320
|
-
|
|
321
|
-
### closestPointToPointParameter
|
|
322
|
-
|
|
323
|
-
▸ **closestPointToPointParameter**(`point`, `clampToLine`): `number`
|
|
324
|
-
|
|
325
|
-
#### Parameters
|
|
326
|
-
|
|
327
|
-
| Name | Type |
|
|
328
|
-
| :------ | :------ |
|
|
329
|
-
| `point` | `Vector2` |
|
|
330
|
-
| `clampToLine` | `boolean` |
|
|
331
|
-
|
|
332
|
-
#### Returns
|
|
333
|
-
|
|
334
|
-
`number`
|
|
335
|
-
|
|
336
|
-
#### Defined in
|
|
337
|
-
|
|
338
|
-
[src/Line2D.ts:507](https://github.com/Immugio/three-math-extensions/blob/e397290/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/e397290/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/e397290/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/e397290/src/Line2D.ts#L454)
|
|
416
|
-
|
|
417
|
-
___
|
|
418
|
-
|
|
419
|
-
### delta
|
|
420
|
-
|
|
421
|
-
▸ **delta**(`target`): [`Vec2`](Vec2.md)
|
|
422
|
-
|
|
423
|
-
#### Parameters
|
|
424
|
-
|
|
425
|
-
| Name | Type |
|
|
426
|
-
| :------ | :------ |
|
|
427
|
-
| `target` | [`Vec2`](Vec2.md) |
|
|
428
|
-
|
|
429
|
-
#### Returns
|
|
430
|
-
|
|
431
|
-
[`Vec2`](Vec2.md)
|
|
432
|
-
|
|
433
|
-
#### Defined in
|
|
434
|
-
|
|
435
|
-
[src/Line2D.ts:503](https://github.com/Immugio/three-math-extensions/blob/e397290/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/e397290/src/Line2D.ts#L180)
|
|
459
|
-
|
|
460
|
-
___
|
|
461
|
-
|
|
462
|
-
### distanceToPointOnInfiniteLine
|
|
463
|
-
|
|
464
|
-
▸ **distanceToPointOnInfiniteLine**(`point`): `number`
|
|
465
|
-
|
|
466
|
-
Returns the distance between the **infinite** line and the point.
|
|
467
|
-
|
|
468
|
-
#### Parameters
|
|
469
|
-
|
|
470
|
-
| Name | Type |
|
|
471
|
-
| :------ | :------ |
|
|
472
|
-
| `point` | [`Point2`](../interfaces/Point2.md) |
|
|
473
|
-
|
|
474
|
-
#### Returns
|
|
475
|
-
|
|
476
|
-
`number`
|
|
477
|
-
|
|
478
|
-
#### Defined in
|
|
479
|
-
|
|
480
|
-
[src/Line2D.ts:527](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L527)
|
|
481
|
-
|
|
482
|
-
___
|
|
483
|
-
|
|
484
|
-
### equals
|
|
485
|
-
|
|
486
|
-
▸ **equals**(`other`, `tolerance?`): `boolean`
|
|
487
|
-
|
|
488
|
-
#### Parameters
|
|
489
|
-
|
|
490
|
-
| Name | Type | Default value |
|
|
491
|
-
| :------ | :------ | :------ |
|
|
492
|
-
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
493
|
-
| `tolerance` | `number` | `0` |
|
|
494
|
-
|
|
495
|
-
#### Returns
|
|
496
|
-
|
|
497
|
-
`boolean`
|
|
498
|
-
|
|
499
|
-
#### Defined in
|
|
500
|
-
|
|
501
|
-
[src/Line2D.ts:839](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L839)
|
|
502
|
-
|
|
503
|
-
___
|
|
504
|
-
|
|
505
|
-
### extendToEnds
|
|
506
|
-
|
|
507
|
-
▸ **extendToEnds**(`lineToExtend`, `tolerance`): `void`
|
|
508
|
-
|
|
509
|
-
If other line is shorter than this, endpoints are moved to extend other
|
|
510
|
-
Does not create a copy. Provided line is modified.
|
|
511
|
-
|
|
512
|
-
#### Parameters
|
|
513
|
-
|
|
514
|
-
| Name | Type |
|
|
515
|
-
| :------ | :------ |
|
|
516
|
-
| `lineToExtend` | [`Line2D`](Line2D.md) |
|
|
517
|
-
| `tolerance` | `number` |
|
|
518
|
-
|
|
519
|
-
#### Returns
|
|
520
|
-
|
|
521
|
-
`void`
|
|
522
|
-
|
|
523
|
-
#### Defined in
|
|
524
|
-
|
|
525
|
-
[src/Line2D.ts:664](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L664)
|
|
526
|
-
|
|
527
|
-
___
|
|
528
|
-
|
|
529
|
-
### extendToOrTrimAtIntersection
|
|
530
|
-
|
|
531
|
-
▸ **extendToOrTrimAtIntersection**(`other`, `maxDistanceToIntersection?`): [`Line2D`](Line2D.md)
|
|
532
|
-
|
|
533
|
-
If there is an intersection between this and other, this line is extended to the intersection point. Lines are assumed to be infinite.
|
|
534
|
-
Modifies this line.
|
|
535
|
-
|
|
536
|
-
#### Parameters
|
|
537
|
-
|
|
538
|
-
| Name | Type | Default value |
|
|
539
|
-
| :------ | :------ | :------ |
|
|
540
|
-
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
541
|
-
| `maxDistanceToIntersection` | `number` | `Number.MAX_VALUE` |
|
|
542
|
-
|
|
543
|
-
#### Returns
|
|
544
|
-
|
|
545
|
-
[`Line2D`](Line2D.md)
|
|
546
|
-
|
|
547
|
-
#### Defined in
|
|
548
|
-
|
|
549
|
-
[src/Line2D.ts:685](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L685)
|
|
550
|
-
|
|
551
|
-
___
|
|
552
|
-
|
|
553
|
-
### flip
|
|
554
|
-
|
|
555
|
-
▸ **flip**(): [`Line2D`](Line2D.md)
|
|
556
|
-
|
|
557
|
-
Inverts the direction of the line.
|
|
558
|
-
Modifies this line.
|
|
559
|
-
|
|
560
|
-
#### Returns
|
|
561
|
-
|
|
562
|
-
[`Line2D`](Line2D.md)
|
|
563
|
-
|
|
564
|
-
#### Defined in
|
|
565
|
-
|
|
566
|
-
[src/Line2D.ts:217](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L217)
|
|
567
|
-
|
|
568
|
-
___
|
|
569
|
-
|
|
570
|
-
### getOverlap
|
|
571
|
-
|
|
572
|
-
▸ **getOverlap**(`other`): [`Line2D`](Line2D.md)
|
|
573
|
-
|
|
574
|
-
Logical AND of this and the other line section.
|
|
575
|
-
|
|
576
|
-
#### Parameters
|
|
577
|
-
|
|
578
|
-
| Name | Type |
|
|
579
|
-
| :------ | :------ |
|
|
580
|
-
| `other` | [`Line2D`](Line2D.md) |
|
|
581
|
-
|
|
582
|
-
#### Returns
|
|
583
|
-
|
|
584
|
-
[`Line2D`](Line2D.md)
|
|
585
|
-
|
|
586
|
-
#### Defined in
|
|
587
|
-
|
|
588
|
-
[src/Line2D.ts:367](https://github.com/Immugio/three-math-extensions/blob/e397290/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/e397290/src/Line2D.ts#L191)
|
|
621
|
-
|
|
622
|
-
___
|
|
623
|
-
|
|
624
|
-
### hasIntersectionWithAngle
|
|
625
|
-
|
|
626
|
-
▸ **hasIntersectionWithAngle**(`other`, `expectedAngleInRads`, `angleTolerance?`, `distanceTolerance?`): [`Vec2`](Vec2.md)
|
|
627
|
-
|
|
628
|
-
Check that the line section intersect and that they are in the specified angle to each other
|
|
629
|
-
|
|
630
|
-
#### Parameters
|
|
631
|
-
|
|
632
|
-
| Name | Type | Default value | Description |
|
|
633
|
-
| :------ | :------ | :------ | :------ |
|
|
634
|
-
| `other` | [`Line2D`](Line2D.md) | `undefined` | Line |
|
|
635
|
-
| `expectedAngleInRads` | `number` | `undefined` | number |
|
|
636
|
-
| `angleTolerance` | `number` | `Number.EPSILON` | number |
|
|
637
|
-
| `distanceTolerance` | `number` | `Number.EPSILON` | number |
|
|
638
|
-
|
|
639
|
-
#### Returns
|
|
640
|
-
|
|
641
|
-
[`Vec2`](Vec2.md)
|
|
642
|
-
|
|
643
|
-
#### Defined in
|
|
644
|
-
|
|
645
|
-
[src/Line2D.ts:747](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L747)
|
|
646
|
-
|
|
647
|
-
___
|
|
648
|
-
|
|
649
|
-
### in3DSpace
|
|
650
|
-
|
|
651
|
-
▸ **in3DSpace**(`y?`): [`Line3D`](Line3D.md)
|
|
652
|
-
|
|
653
|
-
Project the line to 2D space. For start and end points Vec2.y becomes Vec3.z. and Vec3.y is provided as an argument.
|
|
654
|
-
|
|
655
|
-
#### Parameters
|
|
656
|
-
|
|
657
|
-
| Name | Type | Default value | Description |
|
|
658
|
-
| :------ | :------ | :------ | :------ |
|
|
659
|
-
| `y` | `number` | `0` | The y value of the new Vec3 instance. |
|
|
660
|
-
|
|
661
|
-
#### Returns
|
|
662
|
-
|
|
663
|
-
[`Line3D`](Line3D.md)
|
|
664
|
-
|
|
665
|
-
A new Line3D instance.
|
|
666
|
-
|
|
667
|
-
#### Defined in
|
|
668
|
-
|
|
669
|
-
[src/Line2D.ts:835](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L835)
|
|
670
|
-
|
|
671
|
-
___
|
|
672
|
-
|
|
673
|
-
### intersect
|
|
674
|
-
|
|
675
|
-
▸ **intersect**(`other`, `lineSegmentOnly?`): [`Vec2`](Vec2.md)
|
|
676
|
-
|
|
677
|
-
Returns the intersection point of two lines.
|
|
678
|
-
|
|
679
|
-
#### Parameters
|
|
680
|
-
|
|
681
|
-
| Name | Type | Description |
|
|
682
|
-
| :------ | :------ | :------ |
|
|
683
|
-
| `other` | [`Line2D`](Line2D.md) | |
|
|
684
|
-
| `lineSegmentOnly?` | `boolean` | If true, only return the intersection if it is within the line segments. Otherwise, return the intersection if the lines intersect anywhere. |
|
|
685
|
-
|
|
686
|
-
#### Returns
|
|
687
|
-
|
|
688
|
-
[`Vec2`](Vec2.md)
|
|
689
|
-
|
|
690
|
-
#### Defined in
|
|
691
|
-
|
|
692
|
-
[src/Line2D.ts:710](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L710)
|
|
693
|
-
|
|
694
|
-
___
|
|
695
|
-
|
|
696
|
-
### isCollinearWithTouchOrOverlap
|
|
697
|
-
|
|
698
|
-
▸ **isCollinearWithTouchOrOverlap**(`other`): `boolean`
|
|
699
|
-
|
|
700
|
-
Returns true if other line is collinear and overlaps or at least touching this line.
|
|
701
|
-
|
|
702
|
-
#### Parameters
|
|
703
|
-
|
|
704
|
-
| Name | Type |
|
|
705
|
-
| :------ | :------ |
|
|
706
|
-
| `other` | [`Line2D`](Line2D.md) |
|
|
707
|
-
|
|
708
|
-
#### Returns
|
|
709
|
-
|
|
710
|
-
`boolean`
|
|
711
|
-
|
|
712
|
-
#### Defined in
|
|
713
|
-
|
|
714
|
-
[src/Line2D.ts:317](https://github.com/Immugio/three-math-extensions/blob/e397290/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/e397290/src/Line2D.ts#L91)
|
|
736
|
-
|
|
737
|
-
___
|
|
738
|
-
|
|
739
|
-
### isPointBesideLineSection
|
|
740
|
-
|
|
741
|
-
▸ **isPointBesideLineSection**(`point`): `boolean`
|
|
742
|
-
|
|
743
|
-
Returns true when the point is beside the line **segment**
|
|
744
|
-
|
|
745
|
-
#### Parameters
|
|
746
|
-
|
|
747
|
-
| Name | Type |
|
|
748
|
-
| :------ | :------ |
|
|
749
|
-
| `point` | [`Point2`](../interfaces/Point2.md) |
|
|
750
|
-
|
|
751
|
-
#### Returns
|
|
752
|
-
|
|
753
|
-
`boolean`
|
|
754
|
-
|
|
755
|
-
#### Defined in
|
|
756
|
-
|
|
757
|
-
[src/Line2D.ts:297](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L297)
|
|
758
|
-
|
|
759
|
-
___
|
|
760
|
-
|
|
761
|
-
### isPointCloseToAndBesideLineSection
|
|
762
|
-
|
|
763
|
-
▸ **isPointCloseToAndBesideLineSection**(`point`, `maxDistance`): `boolean`
|
|
764
|
-
|
|
765
|
-
Returns true when the point is beside the line **segment** and within the maxDistance.
|
|
766
|
-
|
|
767
|
-
#### Parameters
|
|
768
|
-
|
|
769
|
-
| Name | Type |
|
|
770
|
-
| :------ | :------ |
|
|
771
|
-
| `point` | [`Point2`](../interfaces/Point2.md) |
|
|
772
|
-
| `maxDistance` | `number` |
|
|
773
|
-
|
|
774
|
-
#### Returns
|
|
775
|
-
|
|
776
|
-
`boolean`
|
|
777
|
-
|
|
778
|
-
#### Defined in
|
|
779
|
-
|
|
780
|
-
[src/Line2D.ts:288](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L288)
|
|
781
|
-
|
|
782
|
-
___
|
|
783
|
-
|
|
784
|
-
### isPointOnInfiniteLine
|
|
785
|
-
|
|
786
|
-
▸ **isPointOnInfiniteLine**(`point`): `boolean`
|
|
787
|
-
|
|
788
|
-
Returns true when the point is on the **infinite** line.
|
|
789
|
-
|
|
790
|
-
#### Parameters
|
|
791
|
-
|
|
792
|
-
| Name | Type |
|
|
793
|
-
| :------ | :------ |
|
|
794
|
-
| `point` | [`Point2`](../interfaces/Point2.md) |
|
|
795
|
-
|
|
796
|
-
#### Returns
|
|
797
|
-
|
|
798
|
-
`boolean`
|
|
799
|
-
|
|
800
|
-
#### Defined in
|
|
801
|
-
|
|
802
|
-
[src/Line2D.ts:309](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L309)
|
|
803
|
-
|
|
804
|
-
___
|
|
805
|
-
|
|
806
|
-
### isPointOnLineSection
|
|
807
|
-
|
|
808
|
-
▸ **isPointOnLineSection**(`point`): `boolean`
|
|
809
|
-
|
|
810
|
-
Returns true when the point is actually inside the (finite) line segment.
|
|
811
|
-
https://jsfiddle.net/c06zdxtL/2/
|
|
812
|
-
https://stackoverflow.com/questions/6865832/detecting-if-a-point-is-of-a-line-segment/6877674
|
|
813
|
-
|
|
814
|
-
#### Parameters
|
|
815
|
-
|
|
816
|
-
| Name | Type |
|
|
817
|
-
| :------ | :------ |
|
|
818
|
-
| `point` | [`Point2`](../interfaces/Point2.md) |
|
|
819
|
-
|
|
820
|
-
#### Returns
|
|
821
|
-
|
|
822
|
-
`boolean`
|
|
823
|
-
|
|
824
|
-
#### Defined in
|
|
825
|
-
|
|
826
|
-
[src/Line2D.ts:275](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L275)
|
|
827
|
-
|
|
828
|
-
___
|
|
829
|
-
|
|
830
|
-
### moveEndPoint
|
|
831
|
-
|
|
832
|
-
▸ **moveEndPoint**(`amount`): [`Line2D`](Line2D.md)
|
|
833
|
-
|
|
834
|
-
Moves end point on the line by the given amount. Plus values move the point further away from the center.
|
|
835
|
-
Modifies this line.
|
|
836
|
-
|
|
837
|
-
#### Parameters
|
|
838
|
-
|
|
839
|
-
| Name | Type |
|
|
840
|
-
| :------ | :------ |
|
|
841
|
-
| `amount` | `number` |
|
|
842
|
-
|
|
843
|
-
#### Returns
|
|
844
|
-
|
|
845
|
-
[`Line2D`](Line2D.md)
|
|
846
|
-
|
|
847
|
-
#### Defined in
|
|
848
|
-
|
|
849
|
-
[src/Line2D.ts:119](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L119)
|
|
850
|
-
|
|
851
|
-
___
|
|
852
|
-
|
|
853
|
-
### moveStartPoint
|
|
854
|
-
|
|
855
|
-
▸ **moveStartPoint**(`amount`): [`Line2D`](Line2D.md)
|
|
856
|
-
|
|
857
|
-
#### Parameters
|
|
858
|
-
|
|
859
|
-
| Name | Type |
|
|
860
|
-
| :------ | :------ |
|
|
861
|
-
| `amount` | `number` |
|
|
862
|
-
|
|
863
|
-
#### Returns
|
|
864
|
-
|
|
865
|
-
[`Line2D`](Line2D.md)
|
|
866
|
-
|
|
867
|
-
#### Defined in
|
|
868
|
-
|
|
869
|
-
[src/Line2D.ts:108](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L108)
|
|
870
|
-
|
|
871
|
-
___
|
|
872
|
-
|
|
873
|
-
### overlaps
|
|
874
|
-
|
|
875
|
-
▸ **overlaps**(`other`, `distanceTolerance?`, `parallelTolerance?`): `boolean`
|
|
876
|
-
|
|
877
|
-
Returns true if there is any overlap between this line and the
|
|
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
|
-
|
|
891
|
-
**`Other`**
|
|
892
|
-
|
|
893
|
-
line section.
|
|
894
|
-
|
|
895
|
-
#### Defined in
|
|
896
|
-
|
|
897
|
-
[src/Line2D.ts:329](https://github.com/Immugio/three-math-extensions/blob/e397290/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
|
-
|
|
907
|
-
#### Parameters
|
|
908
|
-
|
|
909
|
-
| Name | Type |
|
|
910
|
-
| :------ | :------ |
|
|
911
|
-
| `other` | [`Line2D`](Line2D.md) |
|
|
912
|
-
| `clampToLine` | `boolean` |
|
|
913
|
-
|
|
914
|
-
#### Returns
|
|
915
|
-
|
|
916
|
-
[`Line2D`](Line2D.md)
|
|
917
|
-
|
|
918
|
-
#### Defined in
|
|
919
|
-
|
|
920
|
-
[src/Line2D.ts:467](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L467)
|
|
921
|
-
|
|
922
|
-
___
|
|
923
|
-
|
|
924
|
-
### resize
|
|
925
|
-
|
|
926
|
-
▸ **resize**(`amount`): [`Line2D`](Line2D.md)
|
|
927
|
-
|
|
928
|
-
#### Parameters
|
|
929
|
-
|
|
930
|
-
| Name | Type |
|
|
931
|
-
| :------ | :------ |
|
|
932
|
-
| `amount` | `number` |
|
|
933
|
-
|
|
934
|
-
#### Returns
|
|
935
|
-
|
|
936
|
-
[`Line2D`](Line2D.md)
|
|
937
|
-
|
|
938
|
-
#### Defined in
|
|
939
|
-
|
|
940
|
-
[src/Line2D.ts:85](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L85)
|
|
941
|
-
|
|
942
|
-
___
|
|
943
|
-
|
|
944
|
-
### rotate
|
|
945
|
-
|
|
946
|
-
▸ **rotate**(`radians`, `center?`): [`Line2D`](Line2D.md)
|
|
947
|
-
|
|
948
|
-
Rotates the line around the center by the given angle in radians.
|
|
949
|
-
Modifies this line.
|
|
950
|
-
|
|
951
|
-
#### Parameters
|
|
952
|
-
|
|
953
|
-
| Name | Type | Description |
|
|
954
|
-
| :------ | :------ | :------ |
|
|
955
|
-
| `radians` | `number` | Positive values rotate counter-clockwise. |
|
|
956
|
-
| `center` | [`Vec2`](Vec2.md) | |
|
|
957
|
-
|
|
958
|
-
#### Returns
|
|
959
|
-
|
|
960
|
-
[`Line2D`](Line2D.md)
|
|
961
|
-
|
|
962
|
-
#### Defined in
|
|
963
|
-
|
|
964
|
-
[src/Line2D.ts:231](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L231)
|
|
965
|
-
|
|
966
|
-
___
|
|
967
|
-
|
|
968
|
-
### setCenter
|
|
969
|
-
|
|
970
|
-
▸ **setCenter**(`value`): [`Line2D`](Line2D.md)
|
|
971
|
-
|
|
972
|
-
Set the center of the line to the provided point. Length and direction remain unchanged.
|
|
973
|
-
Modifies this line.
|
|
974
|
-
|
|
975
|
-
#### Parameters
|
|
976
|
-
|
|
977
|
-
| Name | Type |
|
|
978
|
-
| :------ | :------ |
|
|
979
|
-
| `value` | [`Point2`](../interfaces/Point2.md) |
|
|
980
|
-
|
|
981
|
-
#### Returns
|
|
982
|
-
|
|
983
|
-
[`Line2D`](Line2D.md)
|
|
984
|
-
|
|
985
|
-
#### Defined in
|
|
986
|
-
|
|
987
|
-
[src/Line2D.ts:76](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L76)
|
|
988
|
-
|
|
989
|
-
___
|
|
990
|
-
|
|
991
|
-
### setLength
|
|
992
|
-
|
|
993
|
-
▸ **setLength**(`length`): [`Line2D`](Line2D.md)
|
|
994
|
-
|
|
995
|
-
Set the length of this line. Center and direction remain unchanged.
|
|
996
|
-
|
|
997
|
-
#### Parameters
|
|
998
|
-
|
|
999
|
-
| Name | Type |
|
|
1000
|
-
| :------ | :------ |
|
|
1001
|
-
| `length` | `number` |
|
|
1002
|
-
|
|
1003
|
-
#### Returns
|
|
1004
|
-
|
|
1005
|
-
[`Line2D`](Line2D.md)
|
|
1006
|
-
|
|
1007
|
-
#### Defined in
|
|
1008
|
-
|
|
1009
|
-
[src/Line2D.ts:152](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L152)
|
|
1010
|
-
|
|
1011
|
-
___
|
|
1012
|
-
|
|
1013
|
-
### splitAtIntersection
|
|
1014
|
-
|
|
1015
|
-
▸ **splitAtIntersection**(`other`, `tolerance?`): [`Line2D`](Line2D.md)[]
|
|
1016
|
-
|
|
1017
|
-
Returns the original line section split into two parts, if the line **sections** overlap, otherwise null
|
|
1018
|
-
|
|
1019
|
-
#### Parameters
|
|
1020
|
-
|
|
1021
|
-
| Name | Type | Default value |
|
|
1022
|
-
| :------ | :------ | :------ |
|
|
1023
|
-
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
1024
|
-
| `tolerance` | `number` | `0` |
|
|
1025
|
-
|
|
1026
|
-
#### Returns
|
|
1027
|
-
|
|
1028
|
-
[`Line2D`](Line2D.md)[]
|
|
1029
|
-
|
|
1030
|
-
#### Defined in
|
|
1031
|
-
|
|
1032
|
-
[src/Line2D.ts:580](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L580)
|
|
1033
|
-
|
|
1034
|
-
___
|
|
1035
|
-
|
|
1036
|
-
### splitAtOrExtendToIntersection
|
|
1037
|
-
|
|
1038
|
-
▸ **splitAtOrExtendToIntersection**(`other`): [`Line2D`](Line2D.md)[]
|
|
1039
|
-
|
|
1040
|
-
If lines **sections** overlap, returns the original line section split into two parts, sorted by length
|
|
1041
|
-
Else, if the **infinite** lines intersect, returns a new line extended to the intersection point
|
|
1042
|
-
Otherwise, null if the lines are parallel and do not intersect
|
|
1043
|
-
|
|
1044
|
-
#### Parameters
|
|
1045
|
-
|
|
1046
|
-
| Name | Type |
|
|
1047
|
-
| :------ | :------ |
|
|
1048
|
-
| `other` | [`Line2D`](Line2D.md) |
|
|
1049
|
-
|
|
1050
|
-
#### Returns
|
|
1051
|
-
|
|
1052
|
-
[`Line2D`](Line2D.md)[]
|
|
1053
|
-
|
|
1054
|
-
#### Defined in
|
|
1055
|
-
|
|
1056
|
-
[src/Line2D.ts:599](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L599)
|
|
1057
|
-
|
|
1058
|
-
___
|
|
1059
|
-
|
|
1060
|
-
### toString
|
|
1061
|
-
|
|
1062
|
-
▸ **toString**(): `string`
|
|
1063
|
-
|
|
1064
|
-
#### Returns
|
|
1065
|
-
|
|
1066
|
-
`string`
|
|
1067
|
-
|
|
1068
|
-
#### Defined in
|
|
1069
|
-
|
|
1070
|
-
[src/Line2D.ts:854](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L854)
|
|
1071
|
-
|
|
1072
|
-
___
|
|
1073
|
-
|
|
1074
|
-
### translate
|
|
1075
|
-
|
|
1076
|
-
▸ **translate**(`value`): [`Line2D`](Line2D.md)
|
|
1077
|
-
|
|
1078
|
-
Move the line by the given vector.
|
|
1079
|
-
Modifies this line.
|
|
1080
|
-
|
|
1081
|
-
#### Parameters
|
|
1082
|
-
|
|
1083
|
-
| Name | Type |
|
|
1084
|
-
| :------ | :------ |
|
|
1085
|
-
| `value` | [`Point2`](../interfaces/Point2.md) |
|
|
1086
|
-
|
|
1087
|
-
#### Returns
|
|
1088
|
-
|
|
1089
|
-
[`Line2D`](Line2D.md)
|
|
1090
|
-
|
|
1091
|
-
#### Defined in
|
|
1092
|
-
|
|
1093
|
-
[src/Line2D.ts:242](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L242)
|
|
1094
|
-
|
|
1095
|
-
___
|
|
1096
|
-
|
|
1097
|
-
### translateLeft
|
|
1098
|
-
|
|
1099
|
-
▸ **translateLeft**(`amount`): [`Line2D`](Line2D.md)
|
|
1100
|
-
|
|
1101
|
-
Move the line to its left by the given amount.
|
|
1102
|
-
Modifies this line.
|
|
1103
|
-
|
|
1104
|
-
#### Parameters
|
|
1105
|
-
|
|
1106
|
-
| Name | Type |
|
|
1107
|
-
| :------ | :------ |
|
|
1108
|
-
| `amount` | `number` |
|
|
1109
|
-
|
|
1110
|
-
#### Returns
|
|
1111
|
-
|
|
1112
|
-
[`Line2D`](Line2D.md)
|
|
1113
|
-
|
|
1114
|
-
#### Defined in
|
|
1115
|
-
|
|
1116
|
-
[src/Line2D.ts:255](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L255)
|
|
1117
|
-
|
|
1118
|
-
___
|
|
1119
|
-
|
|
1120
|
-
### translateRight
|
|
1121
|
-
|
|
1122
|
-
▸ **translateRight**(`amount`): [`Line2D`](Line2D.md)
|
|
1123
|
-
|
|
1124
|
-
Move the line to its right by the given amount.
|
|
1125
|
-
Modifies this line.
|
|
1126
|
-
|
|
1127
|
-
#### Parameters
|
|
1128
|
-
|
|
1129
|
-
| Name | Type |
|
|
1130
|
-
| :------ | :------ |
|
|
1131
|
-
| `amount` | `number` |
|
|
1132
|
-
|
|
1133
|
-
#### Returns
|
|
1134
|
-
|
|
1135
|
-
[`Line2D`](Line2D.md)
|
|
1136
|
-
|
|
1137
|
-
#### Defined in
|
|
1138
|
-
|
|
1139
|
-
[src/Line2D.ts:264](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L264)
|
|
1140
|
-
|
|
1141
|
-
___
|
|
1142
|
-
|
|
1143
|
-
### trimExcess
|
|
1144
|
-
|
|
1145
|
-
▸ **trimExcess**(`lineToTrim`): `void`
|
|
1146
|
-
|
|
1147
|
-
If other line is not contained within this line, the excess is trimmed.
|
|
1148
|
-
Does not create a copy. Provided line is modified.
|
|
1149
|
-
|
|
1150
|
-
#### Parameters
|
|
1151
|
-
|
|
1152
|
-
| Name | Type |
|
|
1153
|
-
| :------ | :------ |
|
|
1154
|
-
| `lineToTrim` | [`Line2D`](Line2D.md) |
|
|
1155
|
-
|
|
1156
|
-
#### Returns
|
|
1157
|
-
|
|
1158
|
-
`void`
|
|
1159
|
-
|
|
1160
|
-
#### Defined in
|
|
1161
|
-
|
|
1162
|
-
[src/Line2D.ts:642](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L642)
|
|
1163
|
-
|
|
1164
|
-
___
|
|
1165
|
-
|
|
1166
|
-
### clipLines
|
|
1167
|
-
|
|
1168
|
-
▸ **clipLines**(`source`, `clips`, `distanceTolerance?`, `parallelTolerance?`): [`Line2D`](Line2D.md)[]
|
|
1169
|
-
|
|
1170
|
-
Returns lines that are the result of clipping
|
|
1171
|
-
|
|
1172
|
-
#### Parameters
|
|
1173
|
-
|
|
1174
|
-
| Name | Type | Default value |
|
|
1175
|
-
| :------ | :------ | :------ |
|
|
1176
|
-
| `source` | [`Line2D`](Line2D.md) | `undefined` |
|
|
1177
|
-
| `clips` | [`Line2D`](Line2D.md)[] | `undefined` |
|
|
1178
|
-
| `distanceTolerance` | `number` | `0` |
|
|
1179
|
-
| `parallelTolerance` | `number` | `0` |
|
|
1180
|
-
|
|
1181
|
-
#### Returns
|
|
1182
|
-
|
|
1183
|
-
[`Line2D`](Line2D.md)[]
|
|
1184
|
-
|
|
1185
|
-
**`Source`**
|
|
1186
|
-
|
|
1187
|
-
line by the @clips.
|
|
1188
|
-
Clips must be parallel to this line.
|
|
1189
|
-
Clones the line, does not modify this.
|
|
1190
|
-
|
|
1191
|
-
#### Defined in
|
|
1192
|
-
|
|
1193
|
-
[src/Line2D.ts:541](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L541)
|
|
1194
|
-
|
|
1195
|
-
___
|
|
1196
|
-
|
|
1197
|
-
### fromCoordinates
|
|
1198
|
-
|
|
1199
|
-
▸ **fromCoordinates**(`x1`, `y1`, `x2`, `y2`, `index?`): [`Line2D`](Line2D.md)
|
|
1200
|
-
|
|
1201
|
-
#### Parameters
|
|
1202
|
-
|
|
1203
|
-
| Name | Type | Default value |
|
|
1204
|
-
| :------ | :------ | :------ |
|
|
1205
|
-
| `x1` | `number` | `undefined` |
|
|
1206
|
-
| `y1` | `number` | `undefined` |
|
|
1207
|
-
| `x2` | `number` | `undefined` |
|
|
1208
|
-
| `y2` | `number` | `undefined` |
|
|
1209
|
-
| `index` | `number` | `0` |
|
|
1210
|
-
|
|
1211
|
-
#### Returns
|
|
1212
|
-
|
|
1213
|
-
[`Line2D`](Line2D.md)
|
|
1214
|
-
|
|
1215
|
-
#### Defined in
|
|
1216
|
-
|
|
1217
|
-
[src/Line2D.ts:18](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L18)
|
|
1218
|
-
|
|
1219
|
-
___
|
|
1220
|
-
|
|
1221
|
-
### fromLength
|
|
1222
|
-
|
|
1223
|
-
▸ **fromLength**(`length`): [`Line2D`](Line2D.md)
|
|
1224
|
-
|
|
1225
|
-
#### Parameters
|
|
1226
|
-
|
|
1227
|
-
| Name | Type |
|
|
1228
|
-
| :------ | :------ |
|
|
1229
|
-
| `length` | `number` |
|
|
1230
|
-
|
|
1231
|
-
#### Returns
|
|
1232
|
-
|
|
1233
|
-
[`Line2D`](Line2D.md)
|
|
1234
|
-
|
|
1235
|
-
#### Defined in
|
|
1236
|
-
|
|
1237
|
-
[src/Line2D.ts:48](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L48)
|
|
1238
|
-
|
|
1239
|
-
___
|
|
1240
|
-
|
|
1241
|
-
### fromPoints
|
|
1242
|
-
|
|
1243
|
-
▸ **fromPoints**(`p1`, `p2`, `index?`): [`Line2D`](Line2D.md)
|
|
1244
|
-
|
|
1245
|
-
#### Parameters
|
|
1246
|
-
|
|
1247
|
-
| Name | Type | Default value |
|
|
1248
|
-
| :------ | :------ | :------ |
|
|
1249
|
-
| `p1` | [`Point2`](../interfaces/Point2.md) | `undefined` |
|
|
1250
|
-
| `p2` | [`Point2`](../interfaces/Point2.md) | `undefined` |
|
|
1251
|
-
| `index` | `number` | `0` |
|
|
1252
|
-
|
|
1253
|
-
#### Returns
|
|
1254
|
-
|
|
1255
|
-
[`Line2D`](Line2D.md)
|
|
1256
|
-
|
|
1257
|
-
#### Defined in
|
|
1258
|
-
|
|
1259
|
-
[src/Line2D.ts:22](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L22)
|
|
1260
|
-
|
|
1261
|
-
___
|
|
1262
|
-
|
|
1263
|
-
### fromPolygon
|
|
1264
|
-
|
|
1265
|
-
▸ **fromPolygon**(`polygon`, `forceClosedPolygon?`): [`Line2D`](Line2D.md)[]
|
|
1266
|
-
|
|
1267
|
-
Creates a polygon formed by an array of lines from points provided.
|
|
1268
|
-
The polygon will only be closed if either
|
|
1269
|
-
1) the first and last points are the same or 2) `forceClosedPolygon` is true.
|
|
1270
|
-
|
|
1271
|
-
#### Parameters
|
|
1272
|
-
|
|
1273
|
-
| Name | Type | Default value |
|
|
1274
|
-
| :------ | :------ | :------ |
|
|
1275
|
-
| `polygon` | [`Point2`](../interfaces/Point2.md)[] | `undefined` |
|
|
1276
|
-
| `forceClosedPolygon` | `boolean` | `false` |
|
|
1277
|
-
|
|
1278
|
-
#### Returns
|
|
1279
|
-
|
|
1280
|
-
[`Line2D`](Line2D.md)[]
|
|
1281
|
-
|
|
1282
|
-
#### Defined in
|
|
1283
|
-
|
|
1284
|
-
[src/Line2D.ts:31](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L31)
|
|
1285
|
-
|
|
1286
|
-
___
|
|
1287
|
-
|
|
1288
|
-
### groupConnectedLines
|
|
1289
|
-
|
|
1290
|
-
▸ **groupConnectedLines**(`lines`, `tolerance?`, `breakpoints?`): [`Line2D`](Line2D.md)[][]
|
|
1291
|
-
|
|
1292
|
-
Accepts an array of Line2D and groups them into arrays of connected lines
|
|
1293
|
-
|
|
1294
|
-
#### Parameters
|
|
1295
|
-
|
|
1296
|
-
| Name | Type | Default value | Description |
|
|
1297
|
-
| :------ | :------ | :------ | :------ |
|
|
1298
|
-
| `lines` | [`Line2D`](Line2D.md)[] | `undefined` | Lines to be grouped |
|
|
1299
|
-
| `tolerance` | `number` | `0` | Tolerance for considering lines as connected |
|
|
1300
|
-
| `breakpoints` | [`Vec2`](Vec2.md)[] | `[]` | |
|
|
1301
|
-
|
|
1302
|
-
#### Returns
|
|
1303
|
-
|
|
1304
|
-
[`Line2D`](Line2D.md)[][]
|
|
1305
|
-
|
|
1306
|
-
#### Defined in
|
|
1307
|
-
|
|
1308
|
-
[src/Line2D.ts:781](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L781)
|
|
1309
|
-
|
|
1310
|
-
___
|
|
1311
|
-
|
|
1312
|
-
### joinLine
|
|
1313
|
-
|
|
1314
|
-
▸ **joinLine**(`line`, `other`): [`Line2D`](Line2D.md)
|
|
1315
|
-
|
|
1316
|
-
Joins a copy of
|
|
1317
|
-
|
|
1318
|
-
#### Parameters
|
|
1319
|
-
|
|
1320
|
-
| Name | Type |
|
|
1321
|
-
| :------ | :------ |
|
|
1322
|
-
| `line` | [`Line2D`](Line2D.md) |
|
|
1323
|
-
| `other` | [`Line2D`](Line2D.md) |
|
|
1324
|
-
|
|
1325
|
-
#### Returns
|
|
1326
|
-
|
|
1327
|
-
[`Line2D`](Line2D.md)
|
|
1328
|
-
|
|
1329
|
-
**`Line`**
|
|
1330
|
-
|
|
1331
|
-
with the
|
|
1332
|
-
|
|
1333
|
-
**`Other`**
|
|
1334
|
-
|
|
1335
|
-
line.
|
|
1336
|
-
Other must be parallel to this line.
|
|
1337
|
-
Returns null if there is no overlap
|
|
1338
|
-
Clones the line, does not modify.
|
|
1339
|
-
|
|
1340
|
-
#### Defined in
|
|
1341
|
-
|
|
1342
|
-
[src/Line2D.ts:401](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L401)
|
|
1343
|
-
|
|
1344
|
-
___
|
|
1345
|
-
|
|
1346
|
-
### joinLines
|
|
1347
|
-
|
|
1348
|
-
▸ **joinLines**(`lines`): [`Line2D`](Line2D.md)[]
|
|
1349
|
-
|
|
1350
|
-
Joins provided lines into several joined lines.
|
|
1351
|
-
Lines must be parallel for joining.
|
|
1352
|
-
Clone the lines, does not modify.
|
|
1353
|
-
|
|
1354
|
-
#### Parameters
|
|
1355
|
-
|
|
1356
|
-
| Name | Type |
|
|
1357
|
-
| :------ | :------ |
|
|
1358
|
-
| `lines` | [`Line2D`](Line2D.md)[] |
|
|
1359
|
-
|
|
1360
|
-
#### Returns
|
|
1361
|
-
|
|
1362
|
-
[`Line2D`](Line2D.md)[]
|
|
1363
|
-
|
|
1364
|
-
#### Defined in
|
|
1365
|
-
|
|
1366
|
-
[src/Line2D.ts:418](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L418)
|
|
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
|
+
- [isCloserToHorizontal](Line2D.md#isclosertohorizontal)
|
|
23
|
+
- [isCloserToVertical](Line2D.md#isclosertovertical)
|
|
24
|
+
- [length](Line2D.md#length)
|
|
25
|
+
|
|
26
|
+
### Methods
|
|
27
|
+
|
|
28
|
+
- [chunk](Line2D.md#chunk)
|
|
29
|
+
- [clone](Line2D.md#clone)
|
|
30
|
+
- [closestPointToPoint](Line2D.md#closestpointtopoint)
|
|
31
|
+
- [closestPointToPointParameter](Line2D.md#closestpointtopointparameter)
|
|
32
|
+
- [connectsTo](Line2D.md#connectsto)
|
|
33
|
+
- [containsPoint](Line2D.md#containspoint)
|
|
34
|
+
- [covers](Line2D.md#covers)
|
|
35
|
+
- [delta](Line2D.md#delta)
|
|
36
|
+
- [distanceToPoint](Line2D.md#distancetopoint)
|
|
37
|
+
- [distanceToPointOnInfiniteLine](Line2D.md#distancetopointoninfiniteline)
|
|
38
|
+
- [equals](Line2D.md#equals)
|
|
39
|
+
- [extendToEnds](Line2D.md#extendtoends)
|
|
40
|
+
- [extendToOrTrimAtIntersection](Line2D.md#extendtoortrimatintersection)
|
|
41
|
+
- [flip](Line2D.md#flip)
|
|
42
|
+
- [getOverlap](Line2D.md#getoverlap)
|
|
43
|
+
- [getParallelLineInTheSameDirection](Line2D.md#getparallellineinthesamedirection)
|
|
44
|
+
- [hasIntersectionWithAngle](Line2D.md#hasintersectionwithangle)
|
|
45
|
+
- [in3DSpace](Line2D.md#in3dspace)
|
|
46
|
+
- [intersect](Line2D.md#intersect)
|
|
47
|
+
- [isCollinearWithTouchOrOverlap](Line2D.md#iscollinearwithtouchoroverlap)
|
|
48
|
+
- [isParallelTo](Line2D.md#isparallelto)
|
|
49
|
+
- [isPointBesideLineSection](Line2D.md#ispointbesidelinesection)
|
|
50
|
+
- [isPointCloseToAndBesideLineSection](Line2D.md#ispointclosetoandbesidelinesection)
|
|
51
|
+
- [isPointOnInfiniteLine](Line2D.md#ispointoninfiniteline)
|
|
52
|
+
- [isPointOnLineSection](Line2D.md#ispointonlinesection)
|
|
53
|
+
- [moveEndPoint](Line2D.md#moveendpoint)
|
|
54
|
+
- [moveStartPoint](Line2D.md#movestartpoint)
|
|
55
|
+
- [overlaps](Line2D.md#overlaps)
|
|
56
|
+
- [projectOn](Line2D.md#projecton)
|
|
57
|
+
- [resize](Line2D.md#resize)
|
|
58
|
+
- [rotate](Line2D.md#rotate)
|
|
59
|
+
- [setCenter](Line2D.md#setcenter)
|
|
60
|
+
- [setLength](Line2D.md#setlength)
|
|
61
|
+
- [splitAtIntersection](Line2D.md#splitatintersection)
|
|
62
|
+
- [splitAtOrExtendToIntersection](Line2D.md#splitatorextendtointersection)
|
|
63
|
+
- [toString](Line2D.md#tostring)
|
|
64
|
+
- [translate](Line2D.md#translate)
|
|
65
|
+
- [translateLeft](Line2D.md#translateleft)
|
|
66
|
+
- [translateRight](Line2D.md#translateright)
|
|
67
|
+
- [trimExcess](Line2D.md#trimexcess)
|
|
68
|
+
- [clipLines](Line2D.md#cliplines)
|
|
69
|
+
- [fromCoordinates](Line2D.md#fromcoordinates)
|
|
70
|
+
- [fromLength](Line2D.md#fromlength)
|
|
71
|
+
- [fromPoints](Line2D.md#frompoints)
|
|
72
|
+
- [fromPolygon](Line2D.md#frompolygon)
|
|
73
|
+
- [groupConnectedLines](Line2D.md#groupconnectedlines)
|
|
74
|
+
- [joinLine](Line2D.md#joinline)
|
|
75
|
+
- [joinLines](Line2D.md#joinlines)
|
|
76
|
+
|
|
77
|
+
## Constructors
|
|
78
|
+
|
|
79
|
+
### constructor
|
|
80
|
+
|
|
81
|
+
• **new Line2D**(`start`, `end`, `index?`): [`Line2D`](Line2D.md)
|
|
82
|
+
|
|
83
|
+
#### Parameters
|
|
84
|
+
|
|
85
|
+
| Name | Type | Default value |
|
|
86
|
+
| :------ | :------ | :------ |
|
|
87
|
+
| `start` | [`Vec2`](Vec2.md) | `undefined` |
|
|
88
|
+
| `end` | [`Vec2`](Vec2.md) | `undefined` |
|
|
89
|
+
| `index` | `number` | `0` |
|
|
90
|
+
|
|
91
|
+
#### Returns
|
|
92
|
+
|
|
93
|
+
[`Line2D`](Line2D.md)
|
|
94
|
+
|
|
95
|
+
#### Defined in
|
|
96
|
+
|
|
97
|
+
[src/Line2D.ts:15](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L15)
|
|
98
|
+
|
|
99
|
+
## Properties
|
|
100
|
+
|
|
101
|
+
### end
|
|
102
|
+
|
|
103
|
+
• **end**: [`Vec2`](Vec2.md)
|
|
104
|
+
|
|
105
|
+
#### Defined in
|
|
106
|
+
|
|
107
|
+
[src/Line2D.ts:15](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L15)
|
|
108
|
+
|
|
109
|
+
___
|
|
110
|
+
|
|
111
|
+
### index
|
|
112
|
+
|
|
113
|
+
• **index**: `number` = `0`
|
|
114
|
+
|
|
115
|
+
#### Defined in
|
|
116
|
+
|
|
117
|
+
[src/Line2D.ts:15](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L15)
|
|
118
|
+
|
|
119
|
+
___
|
|
120
|
+
|
|
121
|
+
### start
|
|
122
|
+
|
|
123
|
+
• **start**: [`Vec2`](Vec2.md)
|
|
124
|
+
|
|
125
|
+
#### Defined in
|
|
126
|
+
|
|
127
|
+
[src/Line2D.ts:15](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L15)
|
|
128
|
+
|
|
129
|
+
## Accessors
|
|
130
|
+
|
|
131
|
+
### center
|
|
132
|
+
|
|
133
|
+
• `get` **center**(): [`Vec2`](Vec2.md)
|
|
134
|
+
|
|
135
|
+
#### Returns
|
|
136
|
+
|
|
137
|
+
[`Vec2`](Vec2.md)
|
|
138
|
+
|
|
139
|
+
#### Defined in
|
|
140
|
+
|
|
141
|
+
[src/Line2D.ts:52](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L52)
|
|
142
|
+
|
|
143
|
+
• `set` **center**(`value`): `void`
|
|
144
|
+
|
|
145
|
+
Set the center of the line to the provided point. Length and direction remain unchanged.
|
|
146
|
+
Modifies this line.
|
|
147
|
+
|
|
148
|
+
#### Parameters
|
|
149
|
+
|
|
150
|
+
| Name | Type |
|
|
151
|
+
| :------ | :------ |
|
|
152
|
+
| `value` | [`Point2`](../interfaces/Point2.md) |
|
|
153
|
+
|
|
154
|
+
#### Returns
|
|
155
|
+
|
|
156
|
+
`void`
|
|
157
|
+
|
|
158
|
+
#### Defined in
|
|
159
|
+
|
|
160
|
+
[src/Line2D.ts:61](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L61)
|
|
161
|
+
|
|
162
|
+
___
|
|
163
|
+
|
|
164
|
+
### direction
|
|
165
|
+
|
|
166
|
+
• `get` **direction**(): [`Vec2`](Vec2.md)
|
|
167
|
+
|
|
168
|
+
Returns the direction of this line.
|
|
169
|
+
|
|
170
|
+
#### Returns
|
|
171
|
+
|
|
172
|
+
[`Vec2`](Vec2.md)
|
|
173
|
+
|
|
174
|
+
#### Defined in
|
|
175
|
+
|
|
176
|
+
[src/Line2D.ts:209](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L209)
|
|
177
|
+
|
|
178
|
+
___
|
|
179
|
+
|
|
180
|
+
### endpoints
|
|
181
|
+
|
|
182
|
+
• `get` **endpoints**(): [`Vec2`](Vec2.md)[]
|
|
183
|
+
|
|
184
|
+
Returns the start and end points of the line as an array.
|
|
185
|
+
Endpoints are not cloned.
|
|
186
|
+
|
|
187
|
+
#### Returns
|
|
188
|
+
|
|
189
|
+
[`Vec2`](Vec2.md)[]
|
|
190
|
+
|
|
191
|
+
#### Defined in
|
|
192
|
+
|
|
193
|
+
[src/Line2D.ts:161](https://github.com/Immugio/three-math-extensions/blob/e397290/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/e397290/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/e397290/src/Line2D.ts#L771)
|
|
222
|
+
|
|
223
|
+
___
|
|
224
|
+
|
|
225
|
+
### length
|
|
226
|
+
|
|
227
|
+
• `get` **length**(): `number`
|
|
228
|
+
|
|
229
|
+
#### Returns
|
|
230
|
+
|
|
231
|
+
`number`
|
|
232
|
+
|
|
233
|
+
#### Defined in
|
|
234
|
+
|
|
235
|
+
[src/Line2D.ts:144](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L144)
|
|
236
|
+
|
|
237
|
+
• `set` **length**(`l`): `void`
|
|
238
|
+
|
|
239
|
+
Set the length of this line. Center and direction remain unchanged.
|
|
240
|
+
Modifies this line.
|
|
241
|
+
|
|
242
|
+
#### Parameters
|
|
243
|
+
|
|
244
|
+
| Name | Type |
|
|
245
|
+
| :------ | :------ |
|
|
246
|
+
| `l` | `number` |
|
|
247
|
+
|
|
248
|
+
#### Returns
|
|
249
|
+
|
|
250
|
+
`void`
|
|
251
|
+
|
|
252
|
+
#### Defined in
|
|
253
|
+
|
|
254
|
+
[src/Line2D.ts:139](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L139)
|
|
255
|
+
|
|
256
|
+
## Methods
|
|
257
|
+
|
|
258
|
+
### chunk
|
|
259
|
+
|
|
260
|
+
▸ **chunk**(`maxSegmentLength`): [`Line2D`](Line2D.md)[]
|
|
261
|
+
|
|
262
|
+
Divides the Line3D into a number of segments of the given length.
|
|
263
|
+
Clone the line, does not modify.
|
|
264
|
+
|
|
265
|
+
#### Parameters
|
|
266
|
+
|
|
267
|
+
| Name | Type | Description |
|
|
268
|
+
| :------ | :------ | :------ |
|
|
269
|
+
| `maxSegmentLength` | `number` | number |
|
|
270
|
+
|
|
271
|
+
#### Returns
|
|
272
|
+
|
|
273
|
+
[`Line2D`](Line2D.md)[]
|
|
274
|
+
|
|
275
|
+
#### Defined in
|
|
276
|
+
|
|
277
|
+
[src/Line2D.ts:479](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L479)
|
|
278
|
+
|
|
279
|
+
___
|
|
280
|
+
|
|
281
|
+
### clone
|
|
282
|
+
|
|
283
|
+
▸ **clone**(): [`Line2D`](Line2D.md)
|
|
284
|
+
|
|
285
|
+
Deep clone of this line
|
|
286
|
+
|
|
287
|
+
#### Returns
|
|
288
|
+
|
|
289
|
+
[`Line2D`](Line2D.md)
|
|
290
|
+
|
|
291
|
+
#### Defined in
|
|
292
|
+
|
|
293
|
+
[src/Line2D.ts:850](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L850)
|
|
294
|
+
|
|
295
|
+
___
|
|
296
|
+
|
|
297
|
+
### closestPointToPoint
|
|
298
|
+
|
|
299
|
+
▸ **closestPointToPoint**(`point`, `clampToLine?`, `target?`): [`Vec2`](Vec2.md)
|
|
300
|
+
|
|
301
|
+
Returns the closest point on the line to the given point.
|
|
302
|
+
|
|
303
|
+
#### Parameters
|
|
304
|
+
|
|
305
|
+
| Name | Type | Description |
|
|
306
|
+
| :------ | :------ | :------ |
|
|
307
|
+
| `point` | `Vector2` | |
|
|
308
|
+
| `clampToLine?` | `boolean` | boolean (optional) |
|
|
309
|
+
| `target?` | [`Vec2`](Vec2.md) | Vec2 (optional) |
|
|
310
|
+
|
|
311
|
+
#### Returns
|
|
312
|
+
|
|
313
|
+
[`Vec2`](Vec2.md)
|
|
314
|
+
|
|
315
|
+
#### Defined in
|
|
316
|
+
|
|
317
|
+
[src/Line2D.ts:498](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L498)
|
|
318
|
+
|
|
319
|
+
___
|
|
320
|
+
|
|
321
|
+
### closestPointToPointParameter
|
|
322
|
+
|
|
323
|
+
▸ **closestPointToPointParameter**(`point`, `clampToLine`): `number`
|
|
324
|
+
|
|
325
|
+
#### Parameters
|
|
326
|
+
|
|
327
|
+
| Name | Type |
|
|
328
|
+
| :------ | :------ |
|
|
329
|
+
| `point` | `Vector2` |
|
|
330
|
+
| `clampToLine` | `boolean` |
|
|
331
|
+
|
|
332
|
+
#### Returns
|
|
333
|
+
|
|
334
|
+
`number`
|
|
335
|
+
|
|
336
|
+
#### Defined in
|
|
337
|
+
|
|
338
|
+
[src/Line2D.ts:507](https://github.com/Immugio/three-math-extensions/blob/e397290/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/e397290/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/e397290/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/e397290/src/Line2D.ts#L454)
|
|
416
|
+
|
|
417
|
+
___
|
|
418
|
+
|
|
419
|
+
### delta
|
|
420
|
+
|
|
421
|
+
▸ **delta**(`target`): [`Vec2`](Vec2.md)
|
|
422
|
+
|
|
423
|
+
#### Parameters
|
|
424
|
+
|
|
425
|
+
| Name | Type |
|
|
426
|
+
| :------ | :------ |
|
|
427
|
+
| `target` | [`Vec2`](Vec2.md) |
|
|
428
|
+
|
|
429
|
+
#### Returns
|
|
430
|
+
|
|
431
|
+
[`Vec2`](Vec2.md)
|
|
432
|
+
|
|
433
|
+
#### Defined in
|
|
434
|
+
|
|
435
|
+
[src/Line2D.ts:503](https://github.com/Immugio/three-math-extensions/blob/e397290/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/e397290/src/Line2D.ts#L180)
|
|
459
|
+
|
|
460
|
+
___
|
|
461
|
+
|
|
462
|
+
### distanceToPointOnInfiniteLine
|
|
463
|
+
|
|
464
|
+
▸ **distanceToPointOnInfiniteLine**(`point`): `number`
|
|
465
|
+
|
|
466
|
+
Returns the distance between the **infinite** line and the point.
|
|
467
|
+
|
|
468
|
+
#### Parameters
|
|
469
|
+
|
|
470
|
+
| Name | Type |
|
|
471
|
+
| :------ | :------ |
|
|
472
|
+
| `point` | [`Point2`](../interfaces/Point2.md) |
|
|
473
|
+
|
|
474
|
+
#### Returns
|
|
475
|
+
|
|
476
|
+
`number`
|
|
477
|
+
|
|
478
|
+
#### Defined in
|
|
479
|
+
|
|
480
|
+
[src/Line2D.ts:527](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L527)
|
|
481
|
+
|
|
482
|
+
___
|
|
483
|
+
|
|
484
|
+
### equals
|
|
485
|
+
|
|
486
|
+
▸ **equals**(`other`, `tolerance?`): `boolean`
|
|
487
|
+
|
|
488
|
+
#### Parameters
|
|
489
|
+
|
|
490
|
+
| Name | Type | Default value |
|
|
491
|
+
| :------ | :------ | :------ |
|
|
492
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
493
|
+
| `tolerance` | `number` | `0` |
|
|
494
|
+
|
|
495
|
+
#### Returns
|
|
496
|
+
|
|
497
|
+
`boolean`
|
|
498
|
+
|
|
499
|
+
#### Defined in
|
|
500
|
+
|
|
501
|
+
[src/Line2D.ts:839](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L839)
|
|
502
|
+
|
|
503
|
+
___
|
|
504
|
+
|
|
505
|
+
### extendToEnds
|
|
506
|
+
|
|
507
|
+
▸ **extendToEnds**(`lineToExtend`, `tolerance`): `void`
|
|
508
|
+
|
|
509
|
+
If other line is shorter than this, endpoints are moved to extend other
|
|
510
|
+
Does not create a copy. Provided line is modified.
|
|
511
|
+
|
|
512
|
+
#### Parameters
|
|
513
|
+
|
|
514
|
+
| Name | Type |
|
|
515
|
+
| :------ | :------ |
|
|
516
|
+
| `lineToExtend` | [`Line2D`](Line2D.md) |
|
|
517
|
+
| `tolerance` | `number` |
|
|
518
|
+
|
|
519
|
+
#### Returns
|
|
520
|
+
|
|
521
|
+
`void`
|
|
522
|
+
|
|
523
|
+
#### Defined in
|
|
524
|
+
|
|
525
|
+
[src/Line2D.ts:664](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L664)
|
|
526
|
+
|
|
527
|
+
___
|
|
528
|
+
|
|
529
|
+
### extendToOrTrimAtIntersection
|
|
530
|
+
|
|
531
|
+
▸ **extendToOrTrimAtIntersection**(`other`, `maxDistanceToIntersection?`): [`Line2D`](Line2D.md)
|
|
532
|
+
|
|
533
|
+
If there is an intersection between this and other, this line is extended to the intersection point. Lines are assumed to be infinite.
|
|
534
|
+
Modifies this line.
|
|
535
|
+
|
|
536
|
+
#### Parameters
|
|
537
|
+
|
|
538
|
+
| Name | Type | Default value |
|
|
539
|
+
| :------ | :------ | :------ |
|
|
540
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
541
|
+
| `maxDistanceToIntersection` | `number` | `Number.MAX_VALUE` |
|
|
542
|
+
|
|
543
|
+
#### Returns
|
|
544
|
+
|
|
545
|
+
[`Line2D`](Line2D.md)
|
|
546
|
+
|
|
547
|
+
#### Defined in
|
|
548
|
+
|
|
549
|
+
[src/Line2D.ts:685](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L685)
|
|
550
|
+
|
|
551
|
+
___
|
|
552
|
+
|
|
553
|
+
### flip
|
|
554
|
+
|
|
555
|
+
▸ **flip**(): [`Line2D`](Line2D.md)
|
|
556
|
+
|
|
557
|
+
Inverts the direction of the line.
|
|
558
|
+
Modifies this line.
|
|
559
|
+
|
|
560
|
+
#### Returns
|
|
561
|
+
|
|
562
|
+
[`Line2D`](Line2D.md)
|
|
563
|
+
|
|
564
|
+
#### Defined in
|
|
565
|
+
|
|
566
|
+
[src/Line2D.ts:217](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L217)
|
|
567
|
+
|
|
568
|
+
___
|
|
569
|
+
|
|
570
|
+
### getOverlap
|
|
571
|
+
|
|
572
|
+
▸ **getOverlap**(`other`): [`Line2D`](Line2D.md)
|
|
573
|
+
|
|
574
|
+
Logical AND of this and the other line section.
|
|
575
|
+
|
|
576
|
+
#### Parameters
|
|
577
|
+
|
|
578
|
+
| Name | Type |
|
|
579
|
+
| :------ | :------ |
|
|
580
|
+
| `other` | [`Line2D`](Line2D.md) |
|
|
581
|
+
|
|
582
|
+
#### Returns
|
|
583
|
+
|
|
584
|
+
[`Line2D`](Line2D.md)
|
|
585
|
+
|
|
586
|
+
#### Defined in
|
|
587
|
+
|
|
588
|
+
[src/Line2D.ts:367](https://github.com/Immugio/three-math-extensions/blob/e397290/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/e397290/src/Line2D.ts#L191)
|
|
621
|
+
|
|
622
|
+
___
|
|
623
|
+
|
|
624
|
+
### hasIntersectionWithAngle
|
|
625
|
+
|
|
626
|
+
▸ **hasIntersectionWithAngle**(`other`, `expectedAngleInRads`, `angleTolerance?`, `distanceTolerance?`): [`Vec2`](Vec2.md)
|
|
627
|
+
|
|
628
|
+
Check that the line section intersect and that they are in the specified angle to each other
|
|
629
|
+
|
|
630
|
+
#### Parameters
|
|
631
|
+
|
|
632
|
+
| Name | Type | Default value | Description |
|
|
633
|
+
| :------ | :------ | :------ | :------ |
|
|
634
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` | Line |
|
|
635
|
+
| `expectedAngleInRads` | `number` | `undefined` | number |
|
|
636
|
+
| `angleTolerance` | `number` | `Number.EPSILON` | number |
|
|
637
|
+
| `distanceTolerance` | `number` | `Number.EPSILON` | number |
|
|
638
|
+
|
|
639
|
+
#### Returns
|
|
640
|
+
|
|
641
|
+
[`Vec2`](Vec2.md)
|
|
642
|
+
|
|
643
|
+
#### Defined in
|
|
644
|
+
|
|
645
|
+
[src/Line2D.ts:747](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L747)
|
|
646
|
+
|
|
647
|
+
___
|
|
648
|
+
|
|
649
|
+
### in3DSpace
|
|
650
|
+
|
|
651
|
+
▸ **in3DSpace**(`y?`): [`Line3D`](Line3D.md)
|
|
652
|
+
|
|
653
|
+
Project the line to 2D space. For start and end points Vec2.y becomes Vec3.z. and Vec3.y is provided as an argument.
|
|
654
|
+
|
|
655
|
+
#### Parameters
|
|
656
|
+
|
|
657
|
+
| Name | Type | Default value | Description |
|
|
658
|
+
| :------ | :------ | :------ | :------ |
|
|
659
|
+
| `y` | `number` | `0` | The y value of the new Vec3 instance. |
|
|
660
|
+
|
|
661
|
+
#### Returns
|
|
662
|
+
|
|
663
|
+
[`Line3D`](Line3D.md)
|
|
664
|
+
|
|
665
|
+
A new Line3D instance.
|
|
666
|
+
|
|
667
|
+
#### Defined in
|
|
668
|
+
|
|
669
|
+
[src/Line2D.ts:835](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L835)
|
|
670
|
+
|
|
671
|
+
___
|
|
672
|
+
|
|
673
|
+
### intersect
|
|
674
|
+
|
|
675
|
+
▸ **intersect**(`other`, `lineSegmentOnly?`): [`Vec2`](Vec2.md)
|
|
676
|
+
|
|
677
|
+
Returns the intersection point of two lines.
|
|
678
|
+
|
|
679
|
+
#### Parameters
|
|
680
|
+
|
|
681
|
+
| Name | Type | Description |
|
|
682
|
+
| :------ | :------ | :------ |
|
|
683
|
+
| `other` | [`Line2D`](Line2D.md) | |
|
|
684
|
+
| `lineSegmentOnly?` | `boolean` | If true, only return the intersection if it is within the line segments. Otherwise, return the intersection if the lines intersect anywhere. |
|
|
685
|
+
|
|
686
|
+
#### Returns
|
|
687
|
+
|
|
688
|
+
[`Vec2`](Vec2.md)
|
|
689
|
+
|
|
690
|
+
#### Defined in
|
|
691
|
+
|
|
692
|
+
[src/Line2D.ts:710](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L710)
|
|
693
|
+
|
|
694
|
+
___
|
|
695
|
+
|
|
696
|
+
### isCollinearWithTouchOrOverlap
|
|
697
|
+
|
|
698
|
+
▸ **isCollinearWithTouchOrOverlap**(`other`): `boolean`
|
|
699
|
+
|
|
700
|
+
Returns true if other line is collinear and overlaps or at least touching this line.
|
|
701
|
+
|
|
702
|
+
#### Parameters
|
|
703
|
+
|
|
704
|
+
| Name | Type |
|
|
705
|
+
| :------ | :------ |
|
|
706
|
+
| `other` | [`Line2D`](Line2D.md) |
|
|
707
|
+
|
|
708
|
+
#### Returns
|
|
709
|
+
|
|
710
|
+
`boolean`
|
|
711
|
+
|
|
712
|
+
#### Defined in
|
|
713
|
+
|
|
714
|
+
[src/Line2D.ts:317](https://github.com/Immugio/three-math-extensions/blob/e397290/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/e397290/src/Line2D.ts#L91)
|
|
736
|
+
|
|
737
|
+
___
|
|
738
|
+
|
|
739
|
+
### isPointBesideLineSection
|
|
740
|
+
|
|
741
|
+
▸ **isPointBesideLineSection**(`point`): `boolean`
|
|
742
|
+
|
|
743
|
+
Returns true when the point is beside the line **segment**
|
|
744
|
+
|
|
745
|
+
#### Parameters
|
|
746
|
+
|
|
747
|
+
| Name | Type |
|
|
748
|
+
| :------ | :------ |
|
|
749
|
+
| `point` | [`Point2`](../interfaces/Point2.md) |
|
|
750
|
+
|
|
751
|
+
#### Returns
|
|
752
|
+
|
|
753
|
+
`boolean`
|
|
754
|
+
|
|
755
|
+
#### Defined in
|
|
756
|
+
|
|
757
|
+
[src/Line2D.ts:297](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L297)
|
|
758
|
+
|
|
759
|
+
___
|
|
760
|
+
|
|
761
|
+
### isPointCloseToAndBesideLineSection
|
|
762
|
+
|
|
763
|
+
▸ **isPointCloseToAndBesideLineSection**(`point`, `maxDistance`): `boolean`
|
|
764
|
+
|
|
765
|
+
Returns true when the point is beside the line **segment** and within the maxDistance.
|
|
766
|
+
|
|
767
|
+
#### Parameters
|
|
768
|
+
|
|
769
|
+
| Name | Type |
|
|
770
|
+
| :------ | :------ |
|
|
771
|
+
| `point` | [`Point2`](../interfaces/Point2.md) |
|
|
772
|
+
| `maxDistance` | `number` |
|
|
773
|
+
|
|
774
|
+
#### Returns
|
|
775
|
+
|
|
776
|
+
`boolean`
|
|
777
|
+
|
|
778
|
+
#### Defined in
|
|
779
|
+
|
|
780
|
+
[src/Line2D.ts:288](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L288)
|
|
781
|
+
|
|
782
|
+
___
|
|
783
|
+
|
|
784
|
+
### isPointOnInfiniteLine
|
|
785
|
+
|
|
786
|
+
▸ **isPointOnInfiniteLine**(`point`): `boolean`
|
|
787
|
+
|
|
788
|
+
Returns true when the point is on the **infinite** line.
|
|
789
|
+
|
|
790
|
+
#### Parameters
|
|
791
|
+
|
|
792
|
+
| Name | Type |
|
|
793
|
+
| :------ | :------ |
|
|
794
|
+
| `point` | [`Point2`](../interfaces/Point2.md) |
|
|
795
|
+
|
|
796
|
+
#### Returns
|
|
797
|
+
|
|
798
|
+
`boolean`
|
|
799
|
+
|
|
800
|
+
#### Defined in
|
|
801
|
+
|
|
802
|
+
[src/Line2D.ts:309](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L309)
|
|
803
|
+
|
|
804
|
+
___
|
|
805
|
+
|
|
806
|
+
### isPointOnLineSection
|
|
807
|
+
|
|
808
|
+
▸ **isPointOnLineSection**(`point`): `boolean`
|
|
809
|
+
|
|
810
|
+
Returns true when the point is actually inside the (finite) line segment.
|
|
811
|
+
https://jsfiddle.net/c06zdxtL/2/
|
|
812
|
+
https://stackoverflow.com/questions/6865832/detecting-if-a-point-is-of-a-line-segment/6877674
|
|
813
|
+
|
|
814
|
+
#### Parameters
|
|
815
|
+
|
|
816
|
+
| Name | Type |
|
|
817
|
+
| :------ | :------ |
|
|
818
|
+
| `point` | [`Point2`](../interfaces/Point2.md) |
|
|
819
|
+
|
|
820
|
+
#### Returns
|
|
821
|
+
|
|
822
|
+
`boolean`
|
|
823
|
+
|
|
824
|
+
#### Defined in
|
|
825
|
+
|
|
826
|
+
[src/Line2D.ts:275](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L275)
|
|
827
|
+
|
|
828
|
+
___
|
|
829
|
+
|
|
830
|
+
### moveEndPoint
|
|
831
|
+
|
|
832
|
+
▸ **moveEndPoint**(`amount`): [`Line2D`](Line2D.md)
|
|
833
|
+
|
|
834
|
+
Moves end point on the line by the given amount. Plus values move the point further away from the center.
|
|
835
|
+
Modifies this line.
|
|
836
|
+
|
|
837
|
+
#### Parameters
|
|
838
|
+
|
|
839
|
+
| Name | Type |
|
|
840
|
+
| :------ | :------ |
|
|
841
|
+
| `amount` | `number` |
|
|
842
|
+
|
|
843
|
+
#### Returns
|
|
844
|
+
|
|
845
|
+
[`Line2D`](Line2D.md)
|
|
846
|
+
|
|
847
|
+
#### Defined in
|
|
848
|
+
|
|
849
|
+
[src/Line2D.ts:119](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L119)
|
|
850
|
+
|
|
851
|
+
___
|
|
852
|
+
|
|
853
|
+
### moveStartPoint
|
|
854
|
+
|
|
855
|
+
▸ **moveStartPoint**(`amount`): [`Line2D`](Line2D.md)
|
|
856
|
+
|
|
857
|
+
#### Parameters
|
|
858
|
+
|
|
859
|
+
| Name | Type |
|
|
860
|
+
| :------ | :------ |
|
|
861
|
+
| `amount` | `number` |
|
|
862
|
+
|
|
863
|
+
#### Returns
|
|
864
|
+
|
|
865
|
+
[`Line2D`](Line2D.md)
|
|
866
|
+
|
|
867
|
+
#### Defined in
|
|
868
|
+
|
|
869
|
+
[src/Line2D.ts:108](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L108)
|
|
870
|
+
|
|
871
|
+
___
|
|
872
|
+
|
|
873
|
+
### overlaps
|
|
874
|
+
|
|
875
|
+
▸ **overlaps**(`other`, `distanceTolerance?`, `parallelTolerance?`): `boolean`
|
|
876
|
+
|
|
877
|
+
Returns true if there is any overlap between this line and the
|
|
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
|
+
|
|
891
|
+
**`Other`**
|
|
892
|
+
|
|
893
|
+
line section.
|
|
894
|
+
|
|
895
|
+
#### Defined in
|
|
896
|
+
|
|
897
|
+
[src/Line2D.ts:329](https://github.com/Immugio/three-math-extensions/blob/e397290/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
|
+
|
|
907
|
+
#### Parameters
|
|
908
|
+
|
|
909
|
+
| Name | Type |
|
|
910
|
+
| :------ | :------ |
|
|
911
|
+
| `other` | [`Line2D`](Line2D.md) |
|
|
912
|
+
| `clampToLine` | `boolean` |
|
|
913
|
+
|
|
914
|
+
#### Returns
|
|
915
|
+
|
|
916
|
+
[`Line2D`](Line2D.md)
|
|
917
|
+
|
|
918
|
+
#### Defined in
|
|
919
|
+
|
|
920
|
+
[src/Line2D.ts:467](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L467)
|
|
921
|
+
|
|
922
|
+
___
|
|
923
|
+
|
|
924
|
+
### resize
|
|
925
|
+
|
|
926
|
+
▸ **resize**(`amount`): [`Line2D`](Line2D.md)
|
|
927
|
+
|
|
928
|
+
#### Parameters
|
|
929
|
+
|
|
930
|
+
| Name | Type |
|
|
931
|
+
| :------ | :------ |
|
|
932
|
+
| `amount` | `number` |
|
|
933
|
+
|
|
934
|
+
#### Returns
|
|
935
|
+
|
|
936
|
+
[`Line2D`](Line2D.md)
|
|
937
|
+
|
|
938
|
+
#### Defined in
|
|
939
|
+
|
|
940
|
+
[src/Line2D.ts:85](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L85)
|
|
941
|
+
|
|
942
|
+
___
|
|
943
|
+
|
|
944
|
+
### rotate
|
|
945
|
+
|
|
946
|
+
▸ **rotate**(`radians`, `center?`): [`Line2D`](Line2D.md)
|
|
947
|
+
|
|
948
|
+
Rotates the line around the center by the given angle in radians.
|
|
949
|
+
Modifies this line.
|
|
950
|
+
|
|
951
|
+
#### Parameters
|
|
952
|
+
|
|
953
|
+
| Name | Type | Description |
|
|
954
|
+
| :------ | :------ | :------ |
|
|
955
|
+
| `radians` | `number` | Positive values rotate counter-clockwise. |
|
|
956
|
+
| `center` | [`Vec2`](Vec2.md) | |
|
|
957
|
+
|
|
958
|
+
#### Returns
|
|
959
|
+
|
|
960
|
+
[`Line2D`](Line2D.md)
|
|
961
|
+
|
|
962
|
+
#### Defined in
|
|
963
|
+
|
|
964
|
+
[src/Line2D.ts:231](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L231)
|
|
965
|
+
|
|
966
|
+
___
|
|
967
|
+
|
|
968
|
+
### setCenter
|
|
969
|
+
|
|
970
|
+
▸ **setCenter**(`value`): [`Line2D`](Line2D.md)
|
|
971
|
+
|
|
972
|
+
Set the center of the line to the provided point. Length and direction remain unchanged.
|
|
973
|
+
Modifies this line.
|
|
974
|
+
|
|
975
|
+
#### Parameters
|
|
976
|
+
|
|
977
|
+
| Name | Type |
|
|
978
|
+
| :------ | :------ |
|
|
979
|
+
| `value` | [`Point2`](../interfaces/Point2.md) |
|
|
980
|
+
|
|
981
|
+
#### Returns
|
|
982
|
+
|
|
983
|
+
[`Line2D`](Line2D.md)
|
|
984
|
+
|
|
985
|
+
#### Defined in
|
|
986
|
+
|
|
987
|
+
[src/Line2D.ts:76](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L76)
|
|
988
|
+
|
|
989
|
+
___
|
|
990
|
+
|
|
991
|
+
### setLength
|
|
992
|
+
|
|
993
|
+
▸ **setLength**(`length`): [`Line2D`](Line2D.md)
|
|
994
|
+
|
|
995
|
+
Set the length of this line. Center and direction remain unchanged.
|
|
996
|
+
|
|
997
|
+
#### Parameters
|
|
998
|
+
|
|
999
|
+
| Name | Type |
|
|
1000
|
+
| :------ | :------ |
|
|
1001
|
+
| `length` | `number` |
|
|
1002
|
+
|
|
1003
|
+
#### Returns
|
|
1004
|
+
|
|
1005
|
+
[`Line2D`](Line2D.md)
|
|
1006
|
+
|
|
1007
|
+
#### Defined in
|
|
1008
|
+
|
|
1009
|
+
[src/Line2D.ts:152](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L152)
|
|
1010
|
+
|
|
1011
|
+
___
|
|
1012
|
+
|
|
1013
|
+
### splitAtIntersection
|
|
1014
|
+
|
|
1015
|
+
▸ **splitAtIntersection**(`other`, `tolerance?`): [`Line2D`](Line2D.md)[]
|
|
1016
|
+
|
|
1017
|
+
Returns the original line section split into two parts, if the line **sections** overlap, otherwise null
|
|
1018
|
+
|
|
1019
|
+
#### Parameters
|
|
1020
|
+
|
|
1021
|
+
| Name | Type | Default value |
|
|
1022
|
+
| :------ | :------ | :------ |
|
|
1023
|
+
| `other` | [`Line2D`](Line2D.md) | `undefined` |
|
|
1024
|
+
| `tolerance` | `number` | `0` |
|
|
1025
|
+
|
|
1026
|
+
#### Returns
|
|
1027
|
+
|
|
1028
|
+
[`Line2D`](Line2D.md)[]
|
|
1029
|
+
|
|
1030
|
+
#### Defined in
|
|
1031
|
+
|
|
1032
|
+
[src/Line2D.ts:580](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L580)
|
|
1033
|
+
|
|
1034
|
+
___
|
|
1035
|
+
|
|
1036
|
+
### splitAtOrExtendToIntersection
|
|
1037
|
+
|
|
1038
|
+
▸ **splitAtOrExtendToIntersection**(`other`): [`Line2D`](Line2D.md)[]
|
|
1039
|
+
|
|
1040
|
+
If lines **sections** overlap, returns the original line section split into two parts, sorted by length
|
|
1041
|
+
Else, if the **infinite** lines intersect, returns a new line extended to the intersection point
|
|
1042
|
+
Otherwise, null if the lines are parallel and do not intersect
|
|
1043
|
+
|
|
1044
|
+
#### Parameters
|
|
1045
|
+
|
|
1046
|
+
| Name | Type |
|
|
1047
|
+
| :------ | :------ |
|
|
1048
|
+
| `other` | [`Line2D`](Line2D.md) |
|
|
1049
|
+
|
|
1050
|
+
#### Returns
|
|
1051
|
+
|
|
1052
|
+
[`Line2D`](Line2D.md)[]
|
|
1053
|
+
|
|
1054
|
+
#### Defined in
|
|
1055
|
+
|
|
1056
|
+
[src/Line2D.ts:599](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L599)
|
|
1057
|
+
|
|
1058
|
+
___
|
|
1059
|
+
|
|
1060
|
+
### toString
|
|
1061
|
+
|
|
1062
|
+
▸ **toString**(): `string`
|
|
1063
|
+
|
|
1064
|
+
#### Returns
|
|
1065
|
+
|
|
1066
|
+
`string`
|
|
1067
|
+
|
|
1068
|
+
#### Defined in
|
|
1069
|
+
|
|
1070
|
+
[src/Line2D.ts:854](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L854)
|
|
1071
|
+
|
|
1072
|
+
___
|
|
1073
|
+
|
|
1074
|
+
### translate
|
|
1075
|
+
|
|
1076
|
+
▸ **translate**(`value`): [`Line2D`](Line2D.md)
|
|
1077
|
+
|
|
1078
|
+
Move the line by the given vector.
|
|
1079
|
+
Modifies this line.
|
|
1080
|
+
|
|
1081
|
+
#### Parameters
|
|
1082
|
+
|
|
1083
|
+
| Name | Type |
|
|
1084
|
+
| :------ | :------ |
|
|
1085
|
+
| `value` | [`Point2`](../interfaces/Point2.md) |
|
|
1086
|
+
|
|
1087
|
+
#### Returns
|
|
1088
|
+
|
|
1089
|
+
[`Line2D`](Line2D.md)
|
|
1090
|
+
|
|
1091
|
+
#### Defined in
|
|
1092
|
+
|
|
1093
|
+
[src/Line2D.ts:242](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L242)
|
|
1094
|
+
|
|
1095
|
+
___
|
|
1096
|
+
|
|
1097
|
+
### translateLeft
|
|
1098
|
+
|
|
1099
|
+
▸ **translateLeft**(`amount`): [`Line2D`](Line2D.md)
|
|
1100
|
+
|
|
1101
|
+
Move the line to its left by the given amount.
|
|
1102
|
+
Modifies this line.
|
|
1103
|
+
|
|
1104
|
+
#### Parameters
|
|
1105
|
+
|
|
1106
|
+
| Name | Type |
|
|
1107
|
+
| :------ | :------ |
|
|
1108
|
+
| `amount` | `number` |
|
|
1109
|
+
|
|
1110
|
+
#### Returns
|
|
1111
|
+
|
|
1112
|
+
[`Line2D`](Line2D.md)
|
|
1113
|
+
|
|
1114
|
+
#### Defined in
|
|
1115
|
+
|
|
1116
|
+
[src/Line2D.ts:255](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L255)
|
|
1117
|
+
|
|
1118
|
+
___
|
|
1119
|
+
|
|
1120
|
+
### translateRight
|
|
1121
|
+
|
|
1122
|
+
▸ **translateRight**(`amount`): [`Line2D`](Line2D.md)
|
|
1123
|
+
|
|
1124
|
+
Move the line to its right by the given amount.
|
|
1125
|
+
Modifies this line.
|
|
1126
|
+
|
|
1127
|
+
#### Parameters
|
|
1128
|
+
|
|
1129
|
+
| Name | Type |
|
|
1130
|
+
| :------ | :------ |
|
|
1131
|
+
| `amount` | `number` |
|
|
1132
|
+
|
|
1133
|
+
#### Returns
|
|
1134
|
+
|
|
1135
|
+
[`Line2D`](Line2D.md)
|
|
1136
|
+
|
|
1137
|
+
#### Defined in
|
|
1138
|
+
|
|
1139
|
+
[src/Line2D.ts:264](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L264)
|
|
1140
|
+
|
|
1141
|
+
___
|
|
1142
|
+
|
|
1143
|
+
### trimExcess
|
|
1144
|
+
|
|
1145
|
+
▸ **trimExcess**(`lineToTrim`): `void`
|
|
1146
|
+
|
|
1147
|
+
If other line is not contained within this line, the excess is trimmed.
|
|
1148
|
+
Does not create a copy. Provided line is modified.
|
|
1149
|
+
|
|
1150
|
+
#### Parameters
|
|
1151
|
+
|
|
1152
|
+
| Name | Type |
|
|
1153
|
+
| :------ | :------ |
|
|
1154
|
+
| `lineToTrim` | [`Line2D`](Line2D.md) |
|
|
1155
|
+
|
|
1156
|
+
#### Returns
|
|
1157
|
+
|
|
1158
|
+
`void`
|
|
1159
|
+
|
|
1160
|
+
#### Defined in
|
|
1161
|
+
|
|
1162
|
+
[src/Line2D.ts:642](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L642)
|
|
1163
|
+
|
|
1164
|
+
___
|
|
1165
|
+
|
|
1166
|
+
### clipLines
|
|
1167
|
+
|
|
1168
|
+
▸ **clipLines**(`source`, `clips`, `distanceTolerance?`, `parallelTolerance?`): [`Line2D`](Line2D.md)[]
|
|
1169
|
+
|
|
1170
|
+
Returns lines that are the result of clipping
|
|
1171
|
+
|
|
1172
|
+
#### Parameters
|
|
1173
|
+
|
|
1174
|
+
| Name | Type | Default value |
|
|
1175
|
+
| :------ | :------ | :------ |
|
|
1176
|
+
| `source` | [`Line2D`](Line2D.md) | `undefined` |
|
|
1177
|
+
| `clips` | [`Line2D`](Line2D.md)[] | `undefined` |
|
|
1178
|
+
| `distanceTolerance` | `number` | `0` |
|
|
1179
|
+
| `parallelTolerance` | `number` | `0` |
|
|
1180
|
+
|
|
1181
|
+
#### Returns
|
|
1182
|
+
|
|
1183
|
+
[`Line2D`](Line2D.md)[]
|
|
1184
|
+
|
|
1185
|
+
**`Source`**
|
|
1186
|
+
|
|
1187
|
+
line by the @clips.
|
|
1188
|
+
Clips must be parallel to this line.
|
|
1189
|
+
Clones the line, does not modify this.
|
|
1190
|
+
|
|
1191
|
+
#### Defined in
|
|
1192
|
+
|
|
1193
|
+
[src/Line2D.ts:541](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L541)
|
|
1194
|
+
|
|
1195
|
+
___
|
|
1196
|
+
|
|
1197
|
+
### fromCoordinates
|
|
1198
|
+
|
|
1199
|
+
▸ **fromCoordinates**(`x1`, `y1`, `x2`, `y2`, `index?`): [`Line2D`](Line2D.md)
|
|
1200
|
+
|
|
1201
|
+
#### Parameters
|
|
1202
|
+
|
|
1203
|
+
| Name | Type | Default value |
|
|
1204
|
+
| :------ | :------ | :------ |
|
|
1205
|
+
| `x1` | `number` | `undefined` |
|
|
1206
|
+
| `y1` | `number` | `undefined` |
|
|
1207
|
+
| `x2` | `number` | `undefined` |
|
|
1208
|
+
| `y2` | `number` | `undefined` |
|
|
1209
|
+
| `index` | `number` | `0` |
|
|
1210
|
+
|
|
1211
|
+
#### Returns
|
|
1212
|
+
|
|
1213
|
+
[`Line2D`](Line2D.md)
|
|
1214
|
+
|
|
1215
|
+
#### Defined in
|
|
1216
|
+
|
|
1217
|
+
[src/Line2D.ts:18](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L18)
|
|
1218
|
+
|
|
1219
|
+
___
|
|
1220
|
+
|
|
1221
|
+
### fromLength
|
|
1222
|
+
|
|
1223
|
+
▸ **fromLength**(`length`): [`Line2D`](Line2D.md)
|
|
1224
|
+
|
|
1225
|
+
#### Parameters
|
|
1226
|
+
|
|
1227
|
+
| Name | Type |
|
|
1228
|
+
| :------ | :------ |
|
|
1229
|
+
| `length` | `number` |
|
|
1230
|
+
|
|
1231
|
+
#### Returns
|
|
1232
|
+
|
|
1233
|
+
[`Line2D`](Line2D.md)
|
|
1234
|
+
|
|
1235
|
+
#### Defined in
|
|
1236
|
+
|
|
1237
|
+
[src/Line2D.ts:48](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L48)
|
|
1238
|
+
|
|
1239
|
+
___
|
|
1240
|
+
|
|
1241
|
+
### fromPoints
|
|
1242
|
+
|
|
1243
|
+
▸ **fromPoints**(`p1`, `p2`, `index?`): [`Line2D`](Line2D.md)
|
|
1244
|
+
|
|
1245
|
+
#### Parameters
|
|
1246
|
+
|
|
1247
|
+
| Name | Type | Default value |
|
|
1248
|
+
| :------ | :------ | :------ |
|
|
1249
|
+
| `p1` | [`Point2`](../interfaces/Point2.md) | `undefined` |
|
|
1250
|
+
| `p2` | [`Point2`](../interfaces/Point2.md) | `undefined` |
|
|
1251
|
+
| `index` | `number` | `0` |
|
|
1252
|
+
|
|
1253
|
+
#### Returns
|
|
1254
|
+
|
|
1255
|
+
[`Line2D`](Line2D.md)
|
|
1256
|
+
|
|
1257
|
+
#### Defined in
|
|
1258
|
+
|
|
1259
|
+
[src/Line2D.ts:22](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L22)
|
|
1260
|
+
|
|
1261
|
+
___
|
|
1262
|
+
|
|
1263
|
+
### fromPolygon
|
|
1264
|
+
|
|
1265
|
+
▸ **fromPolygon**(`polygon`, `forceClosedPolygon?`): [`Line2D`](Line2D.md)[]
|
|
1266
|
+
|
|
1267
|
+
Creates a polygon formed by an array of lines from points provided.
|
|
1268
|
+
The polygon will only be closed if either
|
|
1269
|
+
1) the first and last points are the same or 2) `forceClosedPolygon` is true.
|
|
1270
|
+
|
|
1271
|
+
#### Parameters
|
|
1272
|
+
|
|
1273
|
+
| Name | Type | Default value |
|
|
1274
|
+
| :------ | :------ | :------ |
|
|
1275
|
+
| `polygon` | [`Point2`](../interfaces/Point2.md)[] | `undefined` |
|
|
1276
|
+
| `forceClosedPolygon` | `boolean` | `false` |
|
|
1277
|
+
|
|
1278
|
+
#### Returns
|
|
1279
|
+
|
|
1280
|
+
[`Line2D`](Line2D.md)[]
|
|
1281
|
+
|
|
1282
|
+
#### Defined in
|
|
1283
|
+
|
|
1284
|
+
[src/Line2D.ts:31](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L31)
|
|
1285
|
+
|
|
1286
|
+
___
|
|
1287
|
+
|
|
1288
|
+
### groupConnectedLines
|
|
1289
|
+
|
|
1290
|
+
▸ **groupConnectedLines**(`lines`, `tolerance?`, `breakpoints?`): [`Line2D`](Line2D.md)[][]
|
|
1291
|
+
|
|
1292
|
+
Accepts an array of Line2D and groups them into arrays of connected lines
|
|
1293
|
+
|
|
1294
|
+
#### Parameters
|
|
1295
|
+
|
|
1296
|
+
| Name | Type | Default value | Description |
|
|
1297
|
+
| :------ | :------ | :------ | :------ |
|
|
1298
|
+
| `lines` | [`Line2D`](Line2D.md)[] | `undefined` | Lines to be grouped |
|
|
1299
|
+
| `tolerance` | `number` | `0` | Tolerance for considering lines as connected |
|
|
1300
|
+
| `breakpoints` | [`Vec2`](Vec2.md)[] | `[]` | |
|
|
1301
|
+
|
|
1302
|
+
#### Returns
|
|
1303
|
+
|
|
1304
|
+
[`Line2D`](Line2D.md)[][]
|
|
1305
|
+
|
|
1306
|
+
#### Defined in
|
|
1307
|
+
|
|
1308
|
+
[src/Line2D.ts:781](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L781)
|
|
1309
|
+
|
|
1310
|
+
___
|
|
1311
|
+
|
|
1312
|
+
### joinLine
|
|
1313
|
+
|
|
1314
|
+
▸ **joinLine**(`line`, `other`): [`Line2D`](Line2D.md)
|
|
1315
|
+
|
|
1316
|
+
Joins a copy of
|
|
1317
|
+
|
|
1318
|
+
#### Parameters
|
|
1319
|
+
|
|
1320
|
+
| Name | Type |
|
|
1321
|
+
| :------ | :------ |
|
|
1322
|
+
| `line` | [`Line2D`](Line2D.md) |
|
|
1323
|
+
| `other` | [`Line2D`](Line2D.md) |
|
|
1324
|
+
|
|
1325
|
+
#### Returns
|
|
1326
|
+
|
|
1327
|
+
[`Line2D`](Line2D.md)
|
|
1328
|
+
|
|
1329
|
+
**`Line`**
|
|
1330
|
+
|
|
1331
|
+
with the
|
|
1332
|
+
|
|
1333
|
+
**`Other`**
|
|
1334
|
+
|
|
1335
|
+
line.
|
|
1336
|
+
Other must be parallel to this line.
|
|
1337
|
+
Returns null if there is no overlap
|
|
1338
|
+
Clones the line, does not modify.
|
|
1339
|
+
|
|
1340
|
+
#### Defined in
|
|
1341
|
+
|
|
1342
|
+
[src/Line2D.ts:401](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L401)
|
|
1343
|
+
|
|
1344
|
+
___
|
|
1345
|
+
|
|
1346
|
+
### joinLines
|
|
1347
|
+
|
|
1348
|
+
▸ **joinLines**(`lines`): [`Line2D`](Line2D.md)[]
|
|
1349
|
+
|
|
1350
|
+
Joins provided lines into several joined lines.
|
|
1351
|
+
Lines must be parallel for joining.
|
|
1352
|
+
Clone the lines, does not modify.
|
|
1353
|
+
|
|
1354
|
+
#### Parameters
|
|
1355
|
+
|
|
1356
|
+
| Name | Type |
|
|
1357
|
+
| :------ | :------ |
|
|
1358
|
+
| `lines` | [`Line2D`](Line2D.md)[] |
|
|
1359
|
+
|
|
1360
|
+
#### Returns
|
|
1361
|
+
|
|
1362
|
+
[`Line2D`](Line2D.md)[]
|
|
1363
|
+
|
|
1364
|
+
#### Defined in
|
|
1365
|
+
|
|
1366
|
+
[src/Line2D.ts:418](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line2D.ts#L418)
|