@immugio/three-math-extensions 0.3.4 → 0.3.7
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 +23 -1
- package/cjs/Line2D.js +90 -13
- package/cjs/Polygon.js +3 -0
- 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/esm/Polygon.js +3 -0
- 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 +290 -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/Line3D.md
CHANGED
|
@@ -1,831 +1,831 @@
|
|
|
1
|
-
[@immugio/three-math-extensions](../../README.md) / [Exports](../modules.md) / Line3D
|
|
2
|
-
|
|
3
|
-
# Class: Line3D
|
|
4
|
-
|
|
5
|
-
## Hierarchy
|
|
6
|
-
|
|
7
|
-
- `Line3`
|
|
8
|
-
|
|
9
|
-
↳ **`Line3D`**
|
|
10
|
-
|
|
11
|
-
## Table of contents
|
|
12
|
-
|
|
13
|
-
### Constructors
|
|
14
|
-
|
|
15
|
-
- [constructor](Line3D.md#constructor)
|
|
16
|
-
|
|
17
|
-
### Properties
|
|
18
|
-
|
|
19
|
-
- [end](Line3D.md#end)
|
|
20
|
-
- [index](Line3D.md#index)
|
|
21
|
-
- [start](Line3D.md#start)
|
|
22
|
-
|
|
23
|
-
### Accessors
|
|
24
|
-
|
|
25
|
-
- [center](Line3D.md#center)
|
|
26
|
-
- [direction](Line3D.md#direction)
|
|
27
|
-
- [endpoints](Line3D.md#endpoints)
|
|
28
|
-
- [length](Line3D.md#length)
|
|
29
|
-
|
|
30
|
-
### Methods
|
|
31
|
-
|
|
32
|
-
- [chunk](Line3D.md#chunk)
|
|
33
|
-
- [clipLine](Line3D.md#clipline)
|
|
34
|
-
- [clipLines](Line3D.md#cliplines)
|
|
35
|
-
- [clone](Line3D.md#clone)
|
|
36
|
-
- [connectsTo](Line3D.md#connectsto)
|
|
37
|
-
- [containsPoint](Line3D.md#containspoint)
|
|
38
|
-
- [covers](Line3D.md#covers)
|
|
39
|
-
- [distanceToPoint](Line3D.md#distancetopoint)
|
|
40
|
-
- [equals](Line3D.md#equals)
|
|
41
|
-
- [getParallelLineInTheSameDirection](Line3D.md#getparallellineinthesamedirection)
|
|
42
|
-
- [intersect](Line3D.md#intersect)
|
|
43
|
-
- [isParallelTo](Line3D.md#isparallelto)
|
|
44
|
-
- [joinLine](Line3D.md#joinline)
|
|
45
|
-
- [moveEndPoint](Line3D.md#moveendpoint)
|
|
46
|
-
- [moveStartPoint](Line3D.md#movestartpoint)
|
|
47
|
-
- [onPlan](Line3D.md#onplan)
|
|
48
|
-
- [overlaps](Line3D.md#overlaps)
|
|
49
|
-
- [projectOn](Line3D.md#projecton)
|
|
50
|
-
- [resize](Line3D.md#resize)
|
|
51
|
-
- [setCenter](Line3D.md#setcenter)
|
|
52
|
-
- [setLength](Line3D.md#setlength)
|
|
53
|
-
- [toString](Line3D.md#tostring)
|
|
54
|
-
- [translate](Line3D.md#translate)
|
|
55
|
-
- [fromPoints](Line3D.md#frompoints)
|
|
56
|
-
- [fromPolygon](Line3D.md#frompolygon)
|
|
57
|
-
- [groupConnectedLines](Line3D.md#groupconnectedlines)
|
|
58
|
-
- [joinLines](Line3D.md#joinlines)
|
|
59
|
-
|
|
60
|
-
## Constructors
|
|
61
|
-
|
|
62
|
-
### constructor
|
|
63
|
-
|
|
64
|
-
• **new Line3D**(`start`, `end`, `index?`): [`Line3D`](Line3D.md)
|
|
65
|
-
|
|
66
|
-
#### Parameters
|
|
67
|
-
|
|
68
|
-
| Name | Type | Default value |
|
|
69
|
-
| :------ | :------ | :------ |
|
|
70
|
-
| `start` | [`Vec3`](Vec3.md) | `undefined` |
|
|
71
|
-
| `end` | [`Vec3`](Vec3.md) | `undefined` |
|
|
72
|
-
| `index` | `number` | `0` |
|
|
73
|
-
|
|
74
|
-
#### Returns
|
|
75
|
-
|
|
76
|
-
[`Line3D`](Line3D.md)
|
|
77
|
-
|
|
78
|
-
#### Overrides
|
|
79
|
-
|
|
80
|
-
Line3.constructor
|
|
81
|
-
|
|
82
|
-
#### Defined in
|
|
83
|
-
|
|
84
|
-
[src/Line3D.ts:13](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L13)
|
|
85
|
-
|
|
86
|
-
## Properties
|
|
87
|
-
|
|
88
|
-
### end
|
|
89
|
-
|
|
90
|
-
• **end**: [`Vec3`](Vec3.md)
|
|
91
|
-
|
|
92
|
-
#### Overrides
|
|
93
|
-
|
|
94
|
-
Line3.end
|
|
95
|
-
|
|
96
|
-
#### Defined in
|
|
97
|
-
|
|
98
|
-
[src/Line3D.ts:9](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L9)
|
|
99
|
-
|
|
100
|
-
___
|
|
101
|
-
|
|
102
|
-
### index
|
|
103
|
-
|
|
104
|
-
• **index**: `number` = `0`
|
|
105
|
-
|
|
106
|
-
#### Defined in
|
|
107
|
-
|
|
108
|
-
[src/Line3D.ts:13](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L13)
|
|
109
|
-
|
|
110
|
-
___
|
|
111
|
-
|
|
112
|
-
### start
|
|
113
|
-
|
|
114
|
-
• **start**: [`Vec3`](Vec3.md)
|
|
115
|
-
|
|
116
|
-
#### Overrides
|
|
117
|
-
|
|
118
|
-
Line3.start
|
|
119
|
-
|
|
120
|
-
#### Defined in
|
|
121
|
-
|
|
122
|
-
[src/Line3D.ts:8](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L8)
|
|
123
|
-
|
|
124
|
-
## Accessors
|
|
125
|
-
|
|
126
|
-
### center
|
|
127
|
-
|
|
128
|
-
• `get` **center**(): [`Vec3`](Vec3.md)
|
|
129
|
-
|
|
130
|
-
Returns the center of this line
|
|
131
|
-
|
|
132
|
-
#### Returns
|
|
133
|
-
|
|
134
|
-
[`Vec3`](Vec3.md)
|
|
135
|
-
|
|
136
|
-
#### Defined in
|
|
137
|
-
|
|
138
|
-
[src/Line3D.ts:270](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L270)
|
|
139
|
-
|
|
140
|
-
___
|
|
141
|
-
|
|
142
|
-
### direction
|
|
143
|
-
|
|
144
|
-
• `get` **direction**(): [`Vec3`](Vec3.md)
|
|
145
|
-
|
|
146
|
-
Returns the direction of this line.
|
|
147
|
-
|
|
148
|
-
#### Returns
|
|
149
|
-
|
|
150
|
-
[`Vec3`](Vec3.md)
|
|
151
|
-
|
|
152
|
-
#### Defined in
|
|
153
|
-
|
|
154
|
-
[src/Line3D.ts:263](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L263)
|
|
155
|
-
|
|
156
|
-
___
|
|
157
|
-
|
|
158
|
-
### endpoints
|
|
159
|
-
|
|
160
|
-
• `get` **endpoints**(): [`Vec3`](Vec3.md)[]
|
|
161
|
-
|
|
162
|
-
Returns the start and end points of the line as an array.
|
|
163
|
-
|
|
164
|
-
#### Returns
|
|
165
|
-
|
|
166
|
-
[`Vec3`](Vec3.md)[]
|
|
167
|
-
|
|
168
|
-
#### Defined in
|
|
169
|
-
|
|
170
|
-
[src/Line3D.ts:293](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L293)
|
|
171
|
-
|
|
172
|
-
___
|
|
173
|
-
|
|
174
|
-
### length
|
|
175
|
-
|
|
176
|
-
• `get` **length**(): `number`
|
|
177
|
-
|
|
178
|
-
Returns this line's length.
|
|
179
|
-
|
|
180
|
-
#### Returns
|
|
181
|
-
|
|
182
|
-
`number`
|
|
183
|
-
|
|
184
|
-
#### Defined in
|
|
185
|
-
|
|
186
|
-
[src/Line3D.ts:247](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L247)
|
|
187
|
-
|
|
188
|
-
## Methods
|
|
189
|
-
|
|
190
|
-
### chunk
|
|
191
|
-
|
|
192
|
-
▸ **chunk**(`maxSegmentLength`): [`Line3D`](Line3D.md)[]
|
|
193
|
-
|
|
194
|
-
Divides the Line3D into a number of segments of the given length.
|
|
195
|
-
|
|
196
|
-
#### Parameters
|
|
197
|
-
|
|
198
|
-
| Name | Type | Description |
|
|
199
|
-
| :------ | :------ | :------ |
|
|
200
|
-
| `maxSegmentLength` | `number` | number |
|
|
201
|
-
|
|
202
|
-
#### Returns
|
|
203
|
-
|
|
204
|
-
[`Line3D`](Line3D.md)[]
|
|
205
|
-
|
|
206
|
-
#### Defined in
|
|
207
|
-
|
|
208
|
-
[src/Line3D.ts:405](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L405)
|
|
209
|
-
|
|
210
|
-
___
|
|
211
|
-
|
|
212
|
-
### clipLine
|
|
213
|
-
|
|
214
|
-
▸ **clipLine**(`other`, `parallelTolerance?`): [`Line3D`](Line3D.md)[]
|
|
215
|
-
|
|
216
|
-
Returns lines that are the result of clipping this line by the
|
|
217
|
-
|
|
218
|
-
#### Parameters
|
|
219
|
-
|
|
220
|
-
| Name | Type | Default value |
|
|
221
|
-
| :------ | :------ | :------ |
|
|
222
|
-
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
223
|
-
| `parallelTolerance` | `number` | `Number.EPSILON` |
|
|
224
|
-
|
|
225
|
-
#### Returns
|
|
226
|
-
|
|
227
|
-
[`Line3D`](Line3D.md)[]
|
|
228
|
-
|
|
229
|
-
**`Other`**
|
|
230
|
-
|
|
231
|
-
line.
|
|
232
|
-
Clips must be parallel to this line.
|
|
233
|
-
Clones the line, does not modify this.
|
|
234
|
-
|
|
235
|
-
#### Defined in
|
|
236
|
-
|
|
237
|
-
[src/Line3D.ts:51](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L51)
|
|
238
|
-
|
|
239
|
-
___
|
|
240
|
-
|
|
241
|
-
### clipLines
|
|
242
|
-
|
|
243
|
-
▸ **clipLines**(`clips`, `distanceTolerance?`, `parallelTolerance?`): [`Line3D`](Line3D.md)[]
|
|
244
|
-
|
|
245
|
-
Returns lines that are the result of clipping this line by the @clips.
|
|
246
|
-
Clips must be parallel to this line.
|
|
247
|
-
Clones the line, does not modify this.
|
|
248
|
-
|
|
249
|
-
#### Parameters
|
|
250
|
-
|
|
251
|
-
| Name | Type | Default value |
|
|
252
|
-
| :------ | :------ | :------ |
|
|
253
|
-
| `clips` | [`Line3D`](Line3D.md)[] | `undefined` |
|
|
254
|
-
| `distanceTolerance` | `number` | `0` |
|
|
255
|
-
| `parallelTolerance` | `number` | `Number.EPSILON` |
|
|
256
|
-
|
|
257
|
-
#### Returns
|
|
258
|
-
|
|
259
|
-
[`Line3D`](Line3D.md)[]
|
|
260
|
-
|
|
261
|
-
#### Defined in
|
|
262
|
-
|
|
263
|
-
[src/Line3D.ts:76](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L76)
|
|
264
|
-
|
|
265
|
-
___
|
|
266
|
-
|
|
267
|
-
### clone
|
|
268
|
-
|
|
269
|
-
▸ **clone**(): [`Line3D`](Line3D.md)
|
|
270
|
-
|
|
271
|
-
Deep clone of this line
|
|
272
|
-
|
|
273
|
-
#### Returns
|
|
274
|
-
|
|
275
|
-
[`Line3D`](Line3D.md)
|
|
276
|
-
|
|
277
|
-
#### Overrides
|
|
278
|
-
|
|
279
|
-
Line3.clone
|
|
280
|
-
|
|
281
|
-
#### Defined in
|
|
282
|
-
|
|
283
|
-
[src/Line3D.ts:577](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L577)
|
|
284
|
-
|
|
285
|
-
___
|
|
286
|
-
|
|
287
|
-
### connectsTo
|
|
288
|
-
|
|
289
|
-
▸ **connectsTo**(`other`, `tolerance?`, `breakpoints?`): `boolean`
|
|
290
|
-
|
|
291
|
-
Returns true if any endpoint of this line is within the tolerance of any
|
|
292
|
-
|
|
293
|
-
#### Parameters
|
|
294
|
-
|
|
295
|
-
| Name | Type | Default value |
|
|
296
|
-
| :------ | :------ | :------ |
|
|
297
|
-
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
298
|
-
| `tolerance` | `number` | `0` |
|
|
299
|
-
| `breakpoints` | [`Vec3`](Vec3.md)[] | `[]` |
|
|
300
|
-
|
|
301
|
-
#### Returns
|
|
302
|
-
|
|
303
|
-
`boolean`
|
|
304
|
-
|
|
305
|
-
**`Other`**
|
|
306
|
-
|
|
307
|
-
line's endpoints.
|
|
308
|
-
|
|
309
|
-
#### Defined in
|
|
310
|
-
|
|
311
|
-
[src/Line3D.ts:551](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L551)
|
|
312
|
-
|
|
313
|
-
___
|
|
314
|
-
|
|
315
|
-
### containsPoint
|
|
316
|
-
|
|
317
|
-
▸ **containsPoint**(`p`, `tolerance?`): `boolean`
|
|
318
|
-
|
|
319
|
-
Check that this line section contains provided point.
|
|
320
|
-
|
|
321
|
-
#### Parameters
|
|
322
|
-
|
|
323
|
-
| Name | Type | Default value |
|
|
324
|
-
| :------ | :------ | :------ |
|
|
325
|
-
| `p` | `Vector3` | `undefined` |
|
|
326
|
-
| `tolerance` | `number` | `0` |
|
|
327
|
-
|
|
328
|
-
#### Returns
|
|
329
|
-
|
|
330
|
-
`boolean`
|
|
331
|
-
|
|
332
|
-
#### Defined in
|
|
333
|
-
|
|
334
|
-
[src/Line3D.ts:302](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L302)
|
|
335
|
-
|
|
336
|
-
___
|
|
337
|
-
|
|
338
|
-
### covers
|
|
339
|
-
|
|
340
|
-
▸ **covers**(`other`, `tolerance?`): `boolean`
|
|
341
|
-
|
|
342
|
-
Returns true if this line section completely overlaps the
|
|
343
|
-
|
|
344
|
-
#### Parameters
|
|
345
|
-
|
|
346
|
-
| Name | Type | Default value |
|
|
347
|
-
| :------ | :------ | :------ |
|
|
348
|
-
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
349
|
-
| `tolerance` | `number` | `0` |
|
|
350
|
-
|
|
351
|
-
#### Returns
|
|
352
|
-
|
|
353
|
-
`boolean`
|
|
354
|
-
|
|
355
|
-
**`Other`**
|
|
356
|
-
|
|
357
|
-
line section.
|
|
358
|
-
|
|
359
|
-
#### Defined in
|
|
360
|
-
|
|
361
|
-
[src/Line3D.ts:200](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L200)
|
|
362
|
-
|
|
363
|
-
___
|
|
364
|
-
|
|
365
|
-
### distanceToPoint
|
|
366
|
-
|
|
367
|
-
▸ **distanceToPoint**(`p`, `clampToLine?`): `number`
|
|
368
|
-
|
|
369
|
-
Distance from this line to the provided point.
|
|
370
|
-
|
|
371
|
-
#### Parameters
|
|
372
|
-
|
|
373
|
-
| Name | Type | Default value |
|
|
374
|
-
| :------ | :------ | :------ |
|
|
375
|
-
| `p` | `Vector3` | `undefined` |
|
|
376
|
-
| `clampToLine` | `boolean` | `true` |
|
|
377
|
-
|
|
378
|
-
#### Returns
|
|
379
|
-
|
|
380
|
-
`number`
|
|
381
|
-
|
|
382
|
-
#### Defined in
|
|
383
|
-
|
|
384
|
-
[src/Line3D.ts:312](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L312)
|
|
385
|
-
|
|
386
|
-
___
|
|
387
|
-
|
|
388
|
-
### equals
|
|
389
|
-
|
|
390
|
-
▸ **equals**(`other`, `tolerance?`): `boolean`
|
|
391
|
-
|
|
392
|
-
Equals with tolerance
|
|
393
|
-
|
|
394
|
-
#### Parameters
|
|
395
|
-
|
|
396
|
-
| Name | Type | Default value |
|
|
397
|
-
| :------ | :------ | :------ |
|
|
398
|
-
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
399
|
-
| `tolerance` | `number` | `0` |
|
|
400
|
-
|
|
401
|
-
#### Returns
|
|
402
|
-
|
|
403
|
-
`boolean`
|
|
404
|
-
|
|
405
|
-
#### Overrides
|
|
406
|
-
|
|
407
|
-
Line3.equals
|
|
408
|
-
|
|
409
|
-
#### Defined in
|
|
410
|
-
|
|
411
|
-
[src/Line3D.ts:570](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L570)
|
|
412
|
-
|
|
413
|
-
___
|
|
414
|
-
|
|
415
|
-
### getParallelLineInTheSameDirection
|
|
416
|
-
|
|
417
|
-
▸ **getParallelLineInTheSameDirection**(`other`, `tolerance?`): [`Line3D`](Line3D.md)
|
|
418
|
-
|
|
419
|
-
Returns a copy of
|
|
420
|
-
|
|
421
|
-
#### Parameters
|
|
422
|
-
|
|
423
|
-
| Name | Type | Default value |
|
|
424
|
-
| :------ | :------ | :------ |
|
|
425
|
-
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
426
|
-
| `tolerance` | `number` | `Number.EPSILON` |
|
|
427
|
-
|
|
428
|
-
#### Returns
|
|
429
|
-
|
|
430
|
-
[`Line3D`](Line3D.md)
|
|
431
|
-
|
|
432
|
-
**`Other`**
|
|
433
|
-
|
|
434
|
-
line, the direction of
|
|
435
|
-
|
|
436
|
-
**`Other`**
|
|
437
|
-
|
|
438
|
-
is reversed if needed.
|
|
439
|
-
Returns null if lines are not parallel.
|
|
440
|
-
|
|
441
|
-
#### Defined in
|
|
442
|
-
|
|
443
|
-
[src/Line3D.ts:323](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L323)
|
|
444
|
-
|
|
445
|
-
___
|
|
446
|
-
|
|
447
|
-
### intersect
|
|
448
|
-
|
|
449
|
-
▸ **intersect**(`other`): [`Line3D`](Line3D.md)
|
|
450
|
-
|
|
451
|
-
Calculates the intersection between this and `other` line. The lines are assumed to be infinite.
|
|
452
|
-
In a lot of cases, an actual intersection cannot be calculated due to rounding errors.
|
|
453
|
-
Therefore, the intersection calculated by this method comes in the form of the shorted possible line segment connecting the two lines.
|
|
454
|
-
Sources:
|
|
455
|
-
http://paulbourke.net/geometry/pointlineplane/
|
|
456
|
-
https://stackoverflow.com/questions/2316490/the-algorithm-to-find-the-point-of-intersection-of-two-3d-line-segment/2316934#2316934
|
|
457
|
-
|
|
458
|
-
#### Parameters
|
|
459
|
-
|
|
460
|
-
| Name | Type |
|
|
461
|
-
| :------ | :------ |
|
|
462
|
-
| `other` | [`Line3D`](Line3D.md) |
|
|
463
|
-
|
|
464
|
-
#### Returns
|
|
465
|
-
|
|
466
|
-
[`Line3D`](Line3D.md)
|
|
467
|
-
|
|
468
|
-
#### Defined in
|
|
469
|
-
|
|
470
|
-
[src/Line3D.ts:456](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L456)
|
|
471
|
-
|
|
472
|
-
___
|
|
473
|
-
|
|
474
|
-
### isParallelTo
|
|
475
|
-
|
|
476
|
-
▸ **isParallelTo**(`other`, `angleTolerance?`): `boolean`
|
|
477
|
-
|
|
478
|
-
Check if
|
|
479
|
-
|
|
480
|
-
#### Parameters
|
|
481
|
-
|
|
482
|
-
| Name | Type | Default value |
|
|
483
|
-
| :------ | :------ | :------ |
|
|
484
|
-
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
485
|
-
| `angleTolerance` | `number` | `Number.EPSILON` |
|
|
486
|
-
|
|
487
|
-
#### Returns
|
|
488
|
-
|
|
489
|
-
`boolean`
|
|
490
|
-
|
|
491
|
-
**`Other`**
|
|
492
|
-
|
|
493
|
-
is parallel to this line.
|
|
494
|
-
|
|
495
|
-
#### Defined in
|
|
496
|
-
|
|
497
|
-
[src/Line3D.ts:344](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L344)
|
|
498
|
-
|
|
499
|
-
___
|
|
500
|
-
|
|
501
|
-
### joinLine
|
|
502
|
-
|
|
503
|
-
▸ **joinLine**(`other`, `distanceTolerance?`, `parallelTolerance?`): [`Line3D`](Line3D.md)
|
|
504
|
-
|
|
505
|
-
Joins a copy of this line with the
|
|
506
|
-
|
|
507
|
-
#### Parameters
|
|
508
|
-
|
|
509
|
-
| Name | Type | Default value |
|
|
510
|
-
| :------ | :------ | :------ |
|
|
511
|
-
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
512
|
-
| `distanceTolerance` | `number` | `0` |
|
|
513
|
-
| `parallelTolerance` | `number` | `Number.EPSILON` |
|
|
514
|
-
|
|
515
|
-
#### Returns
|
|
516
|
-
|
|
517
|
-
[`Line3D`](Line3D.md)
|
|
518
|
-
|
|
519
|
-
**`Other`**
|
|
520
|
-
|
|
521
|
-
line.
|
|
522
|
-
Other must be parallel to this line.
|
|
523
|
-
Returns null if there is no overlap
|
|
524
|
-
Clones the line, does not modify this.
|
|
525
|
-
|
|
526
|
-
#### Defined in
|
|
527
|
-
|
|
528
|
-
[src/Line3D.ts:111](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L111)
|
|
529
|
-
|
|
530
|
-
___
|
|
531
|
-
|
|
532
|
-
### moveEndPoint
|
|
533
|
-
|
|
534
|
-
▸ **moveEndPoint**(`amount`): [`Line3D`](Line3D.md)
|
|
535
|
-
|
|
536
|
-
#### Parameters
|
|
537
|
-
|
|
538
|
-
| Name | Type |
|
|
539
|
-
| :------ | :------ |
|
|
540
|
-
| `amount` | `number` |
|
|
541
|
-
|
|
542
|
-
#### Returns
|
|
543
|
-
|
|
544
|
-
[`Line3D`](Line3D.md)
|
|
545
|
-
|
|
546
|
-
#### Defined in
|
|
547
|
-
|
|
548
|
-
[src/Line3D.ts:380](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L380)
|
|
549
|
-
|
|
550
|
-
___
|
|
551
|
-
|
|
552
|
-
### moveStartPoint
|
|
553
|
-
|
|
554
|
-
▸ **moveStartPoint**(`amount`): [`Line3D`](Line3D.md)
|
|
555
|
-
|
|
556
|
-
#### Parameters
|
|
557
|
-
|
|
558
|
-
| Name | Type |
|
|
559
|
-
| :------ | :------ |
|
|
560
|
-
| `amount` | `number` |
|
|
561
|
-
|
|
562
|
-
#### Returns
|
|
563
|
-
|
|
564
|
-
[`Line3D`](Line3D.md)
|
|
565
|
-
|
|
566
|
-
#### Defined in
|
|
567
|
-
|
|
568
|
-
[src/Line3D.ts:368](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L368)
|
|
569
|
-
|
|
570
|
-
___
|
|
571
|
-
|
|
572
|
-
### onPlan
|
|
573
|
-
|
|
574
|
-
▸ **onPlan**(): [`Line2D`](Line2D.md)
|
|
575
|
-
|
|
576
|
-
Project the line to 2D space, Y value is dropped
|
|
577
|
-
|
|
578
|
-
#### Returns
|
|
579
|
-
|
|
580
|
-
[`Line2D`](Line2D.md)
|
|
581
|
-
|
|
582
|
-
#### Defined in
|
|
583
|
-
|
|
584
|
-
[src/Line3D.ts:563](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L563)
|
|
585
|
-
|
|
586
|
-
___
|
|
587
|
-
|
|
588
|
-
### overlaps
|
|
589
|
-
|
|
590
|
-
▸ **overlaps**(`other`, `distanceTolerance?`, `parallelTolerance?`): `boolean`
|
|
591
|
-
|
|
592
|
-
Returns true if there is any overlap between this line and the
|
|
593
|
-
|
|
594
|
-
#### Parameters
|
|
595
|
-
|
|
596
|
-
| Name | Type | Default value |
|
|
597
|
-
| :------ | :------ | :------ |
|
|
598
|
-
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
599
|
-
| `distanceTolerance` | `number` | `0` |
|
|
600
|
-
| `parallelTolerance` | `number` | `Number.EPSILON` |
|
|
601
|
-
|
|
602
|
-
#### Returns
|
|
603
|
-
|
|
604
|
-
`boolean`
|
|
605
|
-
|
|
606
|
-
**`Other`**
|
|
607
|
-
|
|
608
|
-
line section.
|
|
609
|
-
|
|
610
|
-
#### Defined in
|
|
611
|
-
|
|
612
|
-
[src/Line3D.ts:210](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L210)
|
|
613
|
-
|
|
614
|
-
___
|
|
615
|
-
|
|
616
|
-
### projectOn
|
|
617
|
-
|
|
618
|
-
▸ **projectOn**(`other`, `clampToLine`): [`Line3D`](Line3D.md)
|
|
619
|
-
|
|
620
|
-
Returns a new line that is the projection of this line onto @other. Uses `closestPointToPoint` to find the projection.
|
|
621
|
-
|
|
622
|
-
#### Parameters
|
|
623
|
-
|
|
624
|
-
| Name | Type |
|
|
625
|
-
| :------ | :------ |
|
|
626
|
-
| `other` | [`Line3D`](Line3D.md) |
|
|
627
|
-
| `clampToLine` | `boolean` |
|
|
628
|
-
|
|
629
|
-
#### Returns
|
|
630
|
-
|
|
631
|
-
[`Line3D`](Line3D.md)
|
|
632
|
-
|
|
633
|
-
#### Defined in
|
|
634
|
-
|
|
635
|
-
[src/Line3D.ts:394](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L394)
|
|
636
|
-
|
|
637
|
-
___
|
|
638
|
-
|
|
639
|
-
### resize
|
|
640
|
-
|
|
641
|
-
▸ **resize**(`amount`): [`Line3D`](Line3D.md)
|
|
642
|
-
|
|
643
|
-
#### Parameters
|
|
644
|
-
|
|
645
|
-
| Name | Type |
|
|
646
|
-
| :------ | :------ |
|
|
647
|
-
| `amount` | `number` |
|
|
648
|
-
|
|
649
|
-
#### Returns
|
|
650
|
-
|
|
651
|
-
[`Line3D`](Line3D.md)
|
|
652
|
-
|
|
653
|
-
#### Defined in
|
|
654
|
-
|
|
655
|
-
[src/Line3D.ts:359](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L359)
|
|
656
|
-
|
|
657
|
-
___
|
|
658
|
-
|
|
659
|
-
### setCenter
|
|
660
|
-
|
|
661
|
-
▸ **setCenter**(`value`): [`Line3D`](Line3D.md)
|
|
662
|
-
|
|
663
|
-
Set the center of the line to the provided point. Length and direction remain unchanged.
|
|
664
|
-
|
|
665
|
-
#### Parameters
|
|
666
|
-
|
|
667
|
-
| Name | Type |
|
|
668
|
-
| :------ | :------ |
|
|
669
|
-
| `value` | `Vector3` |
|
|
670
|
-
|
|
671
|
-
#### Returns
|
|
672
|
-
|
|
673
|
-
[`Line3D`](Line3D.md)
|
|
674
|
-
|
|
675
|
-
#### Defined in
|
|
676
|
-
|
|
677
|
-
[src/Line3D.ts:278](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L278)
|
|
678
|
-
|
|
679
|
-
___
|
|
680
|
-
|
|
681
|
-
### setLength
|
|
682
|
-
|
|
683
|
-
▸ **setLength**(`length`): [`Line3D`](Line3D.md)
|
|
684
|
-
|
|
685
|
-
Set the length of this line. Center and direction remain unchanged.
|
|
686
|
-
|
|
687
|
-
#### Parameters
|
|
688
|
-
|
|
689
|
-
| Name | Type |
|
|
690
|
-
| :------ | :------ |
|
|
691
|
-
| `length` | `number` |
|
|
692
|
-
|
|
693
|
-
#### Returns
|
|
694
|
-
|
|
695
|
-
[`Line3D`](Line3D.md)
|
|
696
|
-
|
|
697
|
-
#### Defined in
|
|
698
|
-
|
|
699
|
-
[src/Line3D.ts:255](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L255)
|
|
700
|
-
|
|
701
|
-
___
|
|
702
|
-
|
|
703
|
-
### toString
|
|
704
|
-
|
|
705
|
-
▸ **toString**(): `string`
|
|
706
|
-
|
|
707
|
-
#### Returns
|
|
708
|
-
|
|
709
|
-
`string`
|
|
710
|
-
|
|
711
|
-
#### Defined in
|
|
712
|
-
|
|
713
|
-
[src/Line3D.ts:581](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L581)
|
|
714
|
-
|
|
715
|
-
___
|
|
716
|
-
|
|
717
|
-
### translate
|
|
718
|
-
|
|
719
|
-
▸ **translate**(`p`): [`Line3D`](Line3D.md)
|
|
720
|
-
|
|
721
|
-
Move this line by the given vector.
|
|
722
|
-
|
|
723
|
-
#### Parameters
|
|
724
|
-
|
|
725
|
-
| Name | Type |
|
|
726
|
-
| :------ | :------ |
|
|
727
|
-
| `p` | `Vector3` |
|
|
728
|
-
|
|
729
|
-
#### Returns
|
|
730
|
-
|
|
731
|
-
[`Line3D`](Line3D.md)
|
|
732
|
-
|
|
733
|
-
#### Defined in
|
|
734
|
-
|
|
735
|
-
[src/Line3D.ts:441](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L441)
|
|
736
|
-
|
|
737
|
-
___
|
|
738
|
-
|
|
739
|
-
### fromPoints
|
|
740
|
-
|
|
741
|
-
▸ **fromPoints**(`start`, `end`, `index?`): [`Line3D`](Line3D.md)
|
|
742
|
-
|
|
743
|
-
#### Parameters
|
|
744
|
-
|
|
745
|
-
| Name | Type | Default value |
|
|
746
|
-
| :------ | :------ | :------ |
|
|
747
|
-
| `start` | [`Point3`](../interfaces/Point3.md) | `undefined` |
|
|
748
|
-
| `end` | [`Point3`](../interfaces/Point3.md) | `undefined` |
|
|
749
|
-
| `index` | `number` | `0` |
|
|
750
|
-
|
|
751
|
-
#### Returns
|
|
752
|
-
|
|
753
|
-
[`Line3D`](Line3D.md)
|
|
754
|
-
|
|
755
|
-
#### Defined in
|
|
756
|
-
|
|
757
|
-
[src/Line3D.ts:18](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L18)
|
|
758
|
-
|
|
759
|
-
___
|
|
760
|
-
|
|
761
|
-
### fromPolygon
|
|
762
|
-
|
|
763
|
-
▸ **fromPolygon**(`polygon`, `forceClosedPolygon?`): [`Line3D`](Line3D.md)[]
|
|
764
|
-
|
|
765
|
-
Creates a polygon formed by an array of lines from points provided.
|
|
766
|
-
The polygon will only be closed if either
|
|
767
|
-
1) the first and last points are the same or 2) `forceClosedPolygon` is true.
|
|
768
|
-
|
|
769
|
-
#### Parameters
|
|
770
|
-
|
|
771
|
-
| Name | Type | Default value |
|
|
772
|
-
| :------ | :------ | :------ |
|
|
773
|
-
| `polygon` | [`Point3`](../interfaces/Point3.md)[] | `undefined` |
|
|
774
|
-
| `forceClosedPolygon` | `boolean` | `false` |
|
|
775
|
-
|
|
776
|
-
#### Returns
|
|
777
|
-
|
|
778
|
-
[`Line3D`](Line3D.md)[]
|
|
779
|
-
|
|
780
|
-
#### Defined in
|
|
781
|
-
|
|
782
|
-
[src/Line3D.ts:27](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L27)
|
|
783
|
-
|
|
784
|
-
___
|
|
785
|
-
|
|
786
|
-
### groupConnectedLines
|
|
787
|
-
|
|
788
|
-
▸ **groupConnectedLines**(`lines`, `tolerance?`, `breakpoints?`): [`Line3D`](Line3D.md)[][]
|
|
789
|
-
|
|
790
|
-
Accepts an array of Line3D and groups them into arrays of connected lines
|
|
791
|
-
|
|
792
|
-
#### Parameters
|
|
793
|
-
|
|
794
|
-
| Name | Type | Default value | Description |
|
|
795
|
-
| :------ | :------ | :------ | :------ |
|
|
796
|
-
| `lines` | [`Line3D`](Line3D.md)[] | `undefined` | Lines to be grouped |
|
|
797
|
-
| `tolerance` | `number` | `0` | Tolerance for considering lines as connected |
|
|
798
|
-
| `breakpoints` | [`Vec3`](Vec3.md)[] | `[]` | |
|
|
799
|
-
|
|
800
|
-
#### Returns
|
|
801
|
-
|
|
802
|
-
[`Line3D`](Line3D.md)[][]
|
|
803
|
-
|
|
804
|
-
#### Defined in
|
|
805
|
-
|
|
806
|
-
[src/Line3D.ts:511](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L511)
|
|
807
|
-
|
|
808
|
-
___
|
|
809
|
-
|
|
810
|
-
### joinLines
|
|
811
|
-
|
|
812
|
-
▸ **joinLines**(`lines`, `distanceTolerance?`, `parallelTolerance?`): [`Line3D`](Line3D.md)[]
|
|
813
|
-
|
|
814
|
-
Joins provided lines into several joined lines.
|
|
815
|
-
Lines must be parallel for joining.
|
|
816
|
-
|
|
817
|
-
#### Parameters
|
|
818
|
-
|
|
819
|
-
| Name | Type | Default value |
|
|
820
|
-
| :------ | :------ | :------ |
|
|
821
|
-
| `lines` | [`Line3D`](Line3D.md)[] | `undefined` |
|
|
822
|
-
| `distanceTolerance` | `number` | `0` |
|
|
823
|
-
| `parallelTolerance` | `number` | `Number.EPSILON` |
|
|
824
|
-
|
|
825
|
-
#### Returns
|
|
826
|
-
|
|
827
|
-
[`Line3D`](Line3D.md)[]
|
|
828
|
-
|
|
829
|
-
#### Defined in
|
|
830
|
-
|
|
831
|
-
[src/Line3D.ts:165](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L165)
|
|
1
|
+
[@immugio/three-math-extensions](../../README.md) / [Exports](../modules.md) / Line3D
|
|
2
|
+
|
|
3
|
+
# Class: Line3D
|
|
4
|
+
|
|
5
|
+
## Hierarchy
|
|
6
|
+
|
|
7
|
+
- `Line3`
|
|
8
|
+
|
|
9
|
+
↳ **`Line3D`**
|
|
10
|
+
|
|
11
|
+
## Table of contents
|
|
12
|
+
|
|
13
|
+
### Constructors
|
|
14
|
+
|
|
15
|
+
- [constructor](Line3D.md#constructor)
|
|
16
|
+
|
|
17
|
+
### Properties
|
|
18
|
+
|
|
19
|
+
- [end](Line3D.md#end)
|
|
20
|
+
- [index](Line3D.md#index)
|
|
21
|
+
- [start](Line3D.md#start)
|
|
22
|
+
|
|
23
|
+
### Accessors
|
|
24
|
+
|
|
25
|
+
- [center](Line3D.md#center)
|
|
26
|
+
- [direction](Line3D.md#direction)
|
|
27
|
+
- [endpoints](Line3D.md#endpoints)
|
|
28
|
+
- [length](Line3D.md#length)
|
|
29
|
+
|
|
30
|
+
### Methods
|
|
31
|
+
|
|
32
|
+
- [chunk](Line3D.md#chunk)
|
|
33
|
+
- [clipLine](Line3D.md#clipline)
|
|
34
|
+
- [clipLines](Line3D.md#cliplines)
|
|
35
|
+
- [clone](Line3D.md#clone)
|
|
36
|
+
- [connectsTo](Line3D.md#connectsto)
|
|
37
|
+
- [containsPoint](Line3D.md#containspoint)
|
|
38
|
+
- [covers](Line3D.md#covers)
|
|
39
|
+
- [distanceToPoint](Line3D.md#distancetopoint)
|
|
40
|
+
- [equals](Line3D.md#equals)
|
|
41
|
+
- [getParallelLineInTheSameDirection](Line3D.md#getparallellineinthesamedirection)
|
|
42
|
+
- [intersect](Line3D.md#intersect)
|
|
43
|
+
- [isParallelTo](Line3D.md#isparallelto)
|
|
44
|
+
- [joinLine](Line3D.md#joinline)
|
|
45
|
+
- [moveEndPoint](Line3D.md#moveendpoint)
|
|
46
|
+
- [moveStartPoint](Line3D.md#movestartpoint)
|
|
47
|
+
- [onPlan](Line3D.md#onplan)
|
|
48
|
+
- [overlaps](Line3D.md#overlaps)
|
|
49
|
+
- [projectOn](Line3D.md#projecton)
|
|
50
|
+
- [resize](Line3D.md#resize)
|
|
51
|
+
- [setCenter](Line3D.md#setcenter)
|
|
52
|
+
- [setLength](Line3D.md#setlength)
|
|
53
|
+
- [toString](Line3D.md#tostring)
|
|
54
|
+
- [translate](Line3D.md#translate)
|
|
55
|
+
- [fromPoints](Line3D.md#frompoints)
|
|
56
|
+
- [fromPolygon](Line3D.md#frompolygon)
|
|
57
|
+
- [groupConnectedLines](Line3D.md#groupconnectedlines)
|
|
58
|
+
- [joinLines](Line3D.md#joinlines)
|
|
59
|
+
|
|
60
|
+
## Constructors
|
|
61
|
+
|
|
62
|
+
### constructor
|
|
63
|
+
|
|
64
|
+
• **new Line3D**(`start`, `end`, `index?`): [`Line3D`](Line3D.md)
|
|
65
|
+
|
|
66
|
+
#### Parameters
|
|
67
|
+
|
|
68
|
+
| Name | Type | Default value |
|
|
69
|
+
| :------ | :------ | :------ |
|
|
70
|
+
| `start` | [`Vec3`](Vec3.md) | `undefined` |
|
|
71
|
+
| `end` | [`Vec3`](Vec3.md) | `undefined` |
|
|
72
|
+
| `index` | `number` | `0` |
|
|
73
|
+
|
|
74
|
+
#### Returns
|
|
75
|
+
|
|
76
|
+
[`Line3D`](Line3D.md)
|
|
77
|
+
|
|
78
|
+
#### Overrides
|
|
79
|
+
|
|
80
|
+
Line3.constructor
|
|
81
|
+
|
|
82
|
+
#### Defined in
|
|
83
|
+
|
|
84
|
+
[src/Line3D.ts:13](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L13)
|
|
85
|
+
|
|
86
|
+
## Properties
|
|
87
|
+
|
|
88
|
+
### end
|
|
89
|
+
|
|
90
|
+
• **end**: [`Vec3`](Vec3.md)
|
|
91
|
+
|
|
92
|
+
#### Overrides
|
|
93
|
+
|
|
94
|
+
Line3.end
|
|
95
|
+
|
|
96
|
+
#### Defined in
|
|
97
|
+
|
|
98
|
+
[src/Line3D.ts:9](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L9)
|
|
99
|
+
|
|
100
|
+
___
|
|
101
|
+
|
|
102
|
+
### index
|
|
103
|
+
|
|
104
|
+
• **index**: `number` = `0`
|
|
105
|
+
|
|
106
|
+
#### Defined in
|
|
107
|
+
|
|
108
|
+
[src/Line3D.ts:13](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L13)
|
|
109
|
+
|
|
110
|
+
___
|
|
111
|
+
|
|
112
|
+
### start
|
|
113
|
+
|
|
114
|
+
• **start**: [`Vec3`](Vec3.md)
|
|
115
|
+
|
|
116
|
+
#### Overrides
|
|
117
|
+
|
|
118
|
+
Line3.start
|
|
119
|
+
|
|
120
|
+
#### Defined in
|
|
121
|
+
|
|
122
|
+
[src/Line3D.ts:8](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L8)
|
|
123
|
+
|
|
124
|
+
## Accessors
|
|
125
|
+
|
|
126
|
+
### center
|
|
127
|
+
|
|
128
|
+
• `get` **center**(): [`Vec3`](Vec3.md)
|
|
129
|
+
|
|
130
|
+
Returns the center of this line
|
|
131
|
+
|
|
132
|
+
#### Returns
|
|
133
|
+
|
|
134
|
+
[`Vec3`](Vec3.md)
|
|
135
|
+
|
|
136
|
+
#### Defined in
|
|
137
|
+
|
|
138
|
+
[src/Line3D.ts:270](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L270)
|
|
139
|
+
|
|
140
|
+
___
|
|
141
|
+
|
|
142
|
+
### direction
|
|
143
|
+
|
|
144
|
+
• `get` **direction**(): [`Vec3`](Vec3.md)
|
|
145
|
+
|
|
146
|
+
Returns the direction of this line.
|
|
147
|
+
|
|
148
|
+
#### Returns
|
|
149
|
+
|
|
150
|
+
[`Vec3`](Vec3.md)
|
|
151
|
+
|
|
152
|
+
#### Defined in
|
|
153
|
+
|
|
154
|
+
[src/Line3D.ts:263](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L263)
|
|
155
|
+
|
|
156
|
+
___
|
|
157
|
+
|
|
158
|
+
### endpoints
|
|
159
|
+
|
|
160
|
+
• `get` **endpoints**(): [`Vec3`](Vec3.md)[]
|
|
161
|
+
|
|
162
|
+
Returns the start and end points of the line as an array.
|
|
163
|
+
|
|
164
|
+
#### Returns
|
|
165
|
+
|
|
166
|
+
[`Vec3`](Vec3.md)[]
|
|
167
|
+
|
|
168
|
+
#### Defined in
|
|
169
|
+
|
|
170
|
+
[src/Line3D.ts:293](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L293)
|
|
171
|
+
|
|
172
|
+
___
|
|
173
|
+
|
|
174
|
+
### length
|
|
175
|
+
|
|
176
|
+
• `get` **length**(): `number`
|
|
177
|
+
|
|
178
|
+
Returns this line's length.
|
|
179
|
+
|
|
180
|
+
#### Returns
|
|
181
|
+
|
|
182
|
+
`number`
|
|
183
|
+
|
|
184
|
+
#### Defined in
|
|
185
|
+
|
|
186
|
+
[src/Line3D.ts:247](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L247)
|
|
187
|
+
|
|
188
|
+
## Methods
|
|
189
|
+
|
|
190
|
+
### chunk
|
|
191
|
+
|
|
192
|
+
▸ **chunk**(`maxSegmentLength`): [`Line3D`](Line3D.md)[]
|
|
193
|
+
|
|
194
|
+
Divides the Line3D into a number of segments of the given length.
|
|
195
|
+
|
|
196
|
+
#### Parameters
|
|
197
|
+
|
|
198
|
+
| Name | Type | Description |
|
|
199
|
+
| :------ | :------ | :------ |
|
|
200
|
+
| `maxSegmentLength` | `number` | number |
|
|
201
|
+
|
|
202
|
+
#### Returns
|
|
203
|
+
|
|
204
|
+
[`Line3D`](Line3D.md)[]
|
|
205
|
+
|
|
206
|
+
#### Defined in
|
|
207
|
+
|
|
208
|
+
[src/Line3D.ts:405](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L405)
|
|
209
|
+
|
|
210
|
+
___
|
|
211
|
+
|
|
212
|
+
### clipLine
|
|
213
|
+
|
|
214
|
+
▸ **clipLine**(`other`, `parallelTolerance?`): [`Line3D`](Line3D.md)[]
|
|
215
|
+
|
|
216
|
+
Returns lines that are the result of clipping this line by the
|
|
217
|
+
|
|
218
|
+
#### Parameters
|
|
219
|
+
|
|
220
|
+
| Name | Type | Default value |
|
|
221
|
+
| :------ | :------ | :------ |
|
|
222
|
+
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
223
|
+
| `parallelTolerance` | `number` | `Number.EPSILON` |
|
|
224
|
+
|
|
225
|
+
#### Returns
|
|
226
|
+
|
|
227
|
+
[`Line3D`](Line3D.md)[]
|
|
228
|
+
|
|
229
|
+
**`Other`**
|
|
230
|
+
|
|
231
|
+
line.
|
|
232
|
+
Clips must be parallel to this line.
|
|
233
|
+
Clones the line, does not modify this.
|
|
234
|
+
|
|
235
|
+
#### Defined in
|
|
236
|
+
|
|
237
|
+
[src/Line3D.ts:51](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L51)
|
|
238
|
+
|
|
239
|
+
___
|
|
240
|
+
|
|
241
|
+
### clipLines
|
|
242
|
+
|
|
243
|
+
▸ **clipLines**(`clips`, `distanceTolerance?`, `parallelTolerance?`): [`Line3D`](Line3D.md)[]
|
|
244
|
+
|
|
245
|
+
Returns lines that are the result of clipping this line by the @clips.
|
|
246
|
+
Clips must be parallel to this line.
|
|
247
|
+
Clones the line, does not modify this.
|
|
248
|
+
|
|
249
|
+
#### Parameters
|
|
250
|
+
|
|
251
|
+
| Name | Type | Default value |
|
|
252
|
+
| :------ | :------ | :------ |
|
|
253
|
+
| `clips` | [`Line3D`](Line3D.md)[] | `undefined` |
|
|
254
|
+
| `distanceTolerance` | `number` | `0` |
|
|
255
|
+
| `parallelTolerance` | `number` | `Number.EPSILON` |
|
|
256
|
+
|
|
257
|
+
#### Returns
|
|
258
|
+
|
|
259
|
+
[`Line3D`](Line3D.md)[]
|
|
260
|
+
|
|
261
|
+
#### Defined in
|
|
262
|
+
|
|
263
|
+
[src/Line3D.ts:76](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L76)
|
|
264
|
+
|
|
265
|
+
___
|
|
266
|
+
|
|
267
|
+
### clone
|
|
268
|
+
|
|
269
|
+
▸ **clone**(): [`Line3D`](Line3D.md)
|
|
270
|
+
|
|
271
|
+
Deep clone of this line
|
|
272
|
+
|
|
273
|
+
#### Returns
|
|
274
|
+
|
|
275
|
+
[`Line3D`](Line3D.md)
|
|
276
|
+
|
|
277
|
+
#### Overrides
|
|
278
|
+
|
|
279
|
+
Line3.clone
|
|
280
|
+
|
|
281
|
+
#### Defined in
|
|
282
|
+
|
|
283
|
+
[src/Line3D.ts:577](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L577)
|
|
284
|
+
|
|
285
|
+
___
|
|
286
|
+
|
|
287
|
+
### connectsTo
|
|
288
|
+
|
|
289
|
+
▸ **connectsTo**(`other`, `tolerance?`, `breakpoints?`): `boolean`
|
|
290
|
+
|
|
291
|
+
Returns true if any endpoint of this line is within the tolerance of any
|
|
292
|
+
|
|
293
|
+
#### Parameters
|
|
294
|
+
|
|
295
|
+
| Name | Type | Default value |
|
|
296
|
+
| :------ | :------ | :------ |
|
|
297
|
+
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
298
|
+
| `tolerance` | `number` | `0` |
|
|
299
|
+
| `breakpoints` | [`Vec3`](Vec3.md)[] | `[]` |
|
|
300
|
+
|
|
301
|
+
#### Returns
|
|
302
|
+
|
|
303
|
+
`boolean`
|
|
304
|
+
|
|
305
|
+
**`Other`**
|
|
306
|
+
|
|
307
|
+
line's endpoints.
|
|
308
|
+
|
|
309
|
+
#### Defined in
|
|
310
|
+
|
|
311
|
+
[src/Line3D.ts:551](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L551)
|
|
312
|
+
|
|
313
|
+
___
|
|
314
|
+
|
|
315
|
+
### containsPoint
|
|
316
|
+
|
|
317
|
+
▸ **containsPoint**(`p`, `tolerance?`): `boolean`
|
|
318
|
+
|
|
319
|
+
Check that this line section contains provided point.
|
|
320
|
+
|
|
321
|
+
#### Parameters
|
|
322
|
+
|
|
323
|
+
| Name | Type | Default value |
|
|
324
|
+
| :------ | :------ | :------ |
|
|
325
|
+
| `p` | `Vector3` | `undefined` |
|
|
326
|
+
| `tolerance` | `number` | `0` |
|
|
327
|
+
|
|
328
|
+
#### Returns
|
|
329
|
+
|
|
330
|
+
`boolean`
|
|
331
|
+
|
|
332
|
+
#### Defined in
|
|
333
|
+
|
|
334
|
+
[src/Line3D.ts:302](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L302)
|
|
335
|
+
|
|
336
|
+
___
|
|
337
|
+
|
|
338
|
+
### covers
|
|
339
|
+
|
|
340
|
+
▸ **covers**(`other`, `tolerance?`): `boolean`
|
|
341
|
+
|
|
342
|
+
Returns true if this line section completely overlaps the
|
|
343
|
+
|
|
344
|
+
#### Parameters
|
|
345
|
+
|
|
346
|
+
| Name | Type | Default value |
|
|
347
|
+
| :------ | :------ | :------ |
|
|
348
|
+
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
349
|
+
| `tolerance` | `number` | `0` |
|
|
350
|
+
|
|
351
|
+
#### Returns
|
|
352
|
+
|
|
353
|
+
`boolean`
|
|
354
|
+
|
|
355
|
+
**`Other`**
|
|
356
|
+
|
|
357
|
+
line section.
|
|
358
|
+
|
|
359
|
+
#### Defined in
|
|
360
|
+
|
|
361
|
+
[src/Line3D.ts:200](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L200)
|
|
362
|
+
|
|
363
|
+
___
|
|
364
|
+
|
|
365
|
+
### distanceToPoint
|
|
366
|
+
|
|
367
|
+
▸ **distanceToPoint**(`p`, `clampToLine?`): `number`
|
|
368
|
+
|
|
369
|
+
Distance from this line to the provided point.
|
|
370
|
+
|
|
371
|
+
#### Parameters
|
|
372
|
+
|
|
373
|
+
| Name | Type | Default value |
|
|
374
|
+
| :------ | :------ | :------ |
|
|
375
|
+
| `p` | `Vector3` | `undefined` |
|
|
376
|
+
| `clampToLine` | `boolean` | `true` |
|
|
377
|
+
|
|
378
|
+
#### Returns
|
|
379
|
+
|
|
380
|
+
`number`
|
|
381
|
+
|
|
382
|
+
#### Defined in
|
|
383
|
+
|
|
384
|
+
[src/Line3D.ts:312](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L312)
|
|
385
|
+
|
|
386
|
+
___
|
|
387
|
+
|
|
388
|
+
### equals
|
|
389
|
+
|
|
390
|
+
▸ **equals**(`other`, `tolerance?`): `boolean`
|
|
391
|
+
|
|
392
|
+
Equals with tolerance
|
|
393
|
+
|
|
394
|
+
#### Parameters
|
|
395
|
+
|
|
396
|
+
| Name | Type | Default value |
|
|
397
|
+
| :------ | :------ | :------ |
|
|
398
|
+
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
399
|
+
| `tolerance` | `number` | `0` |
|
|
400
|
+
|
|
401
|
+
#### Returns
|
|
402
|
+
|
|
403
|
+
`boolean`
|
|
404
|
+
|
|
405
|
+
#### Overrides
|
|
406
|
+
|
|
407
|
+
Line3.equals
|
|
408
|
+
|
|
409
|
+
#### Defined in
|
|
410
|
+
|
|
411
|
+
[src/Line3D.ts:570](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L570)
|
|
412
|
+
|
|
413
|
+
___
|
|
414
|
+
|
|
415
|
+
### getParallelLineInTheSameDirection
|
|
416
|
+
|
|
417
|
+
▸ **getParallelLineInTheSameDirection**(`other`, `tolerance?`): [`Line3D`](Line3D.md)
|
|
418
|
+
|
|
419
|
+
Returns a copy of
|
|
420
|
+
|
|
421
|
+
#### Parameters
|
|
422
|
+
|
|
423
|
+
| Name | Type | Default value |
|
|
424
|
+
| :------ | :------ | :------ |
|
|
425
|
+
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
426
|
+
| `tolerance` | `number` | `Number.EPSILON` |
|
|
427
|
+
|
|
428
|
+
#### Returns
|
|
429
|
+
|
|
430
|
+
[`Line3D`](Line3D.md)
|
|
431
|
+
|
|
432
|
+
**`Other`**
|
|
433
|
+
|
|
434
|
+
line, the direction of
|
|
435
|
+
|
|
436
|
+
**`Other`**
|
|
437
|
+
|
|
438
|
+
is reversed if needed.
|
|
439
|
+
Returns null if lines are not parallel.
|
|
440
|
+
|
|
441
|
+
#### Defined in
|
|
442
|
+
|
|
443
|
+
[src/Line3D.ts:323](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L323)
|
|
444
|
+
|
|
445
|
+
___
|
|
446
|
+
|
|
447
|
+
### intersect
|
|
448
|
+
|
|
449
|
+
▸ **intersect**(`other`): [`Line3D`](Line3D.md)
|
|
450
|
+
|
|
451
|
+
Calculates the intersection between this and `other` line. The lines are assumed to be infinite.
|
|
452
|
+
In a lot of cases, an actual intersection cannot be calculated due to rounding errors.
|
|
453
|
+
Therefore, the intersection calculated by this method comes in the form of the shorted possible line segment connecting the two lines.
|
|
454
|
+
Sources:
|
|
455
|
+
http://paulbourke.net/geometry/pointlineplane/
|
|
456
|
+
https://stackoverflow.com/questions/2316490/the-algorithm-to-find-the-point-of-intersection-of-two-3d-line-segment/2316934#2316934
|
|
457
|
+
|
|
458
|
+
#### Parameters
|
|
459
|
+
|
|
460
|
+
| Name | Type |
|
|
461
|
+
| :------ | :------ |
|
|
462
|
+
| `other` | [`Line3D`](Line3D.md) |
|
|
463
|
+
|
|
464
|
+
#### Returns
|
|
465
|
+
|
|
466
|
+
[`Line3D`](Line3D.md)
|
|
467
|
+
|
|
468
|
+
#### Defined in
|
|
469
|
+
|
|
470
|
+
[src/Line3D.ts:456](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L456)
|
|
471
|
+
|
|
472
|
+
___
|
|
473
|
+
|
|
474
|
+
### isParallelTo
|
|
475
|
+
|
|
476
|
+
▸ **isParallelTo**(`other`, `angleTolerance?`): `boolean`
|
|
477
|
+
|
|
478
|
+
Check if
|
|
479
|
+
|
|
480
|
+
#### Parameters
|
|
481
|
+
|
|
482
|
+
| Name | Type | Default value |
|
|
483
|
+
| :------ | :------ | :------ |
|
|
484
|
+
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
485
|
+
| `angleTolerance` | `number` | `Number.EPSILON` |
|
|
486
|
+
|
|
487
|
+
#### Returns
|
|
488
|
+
|
|
489
|
+
`boolean`
|
|
490
|
+
|
|
491
|
+
**`Other`**
|
|
492
|
+
|
|
493
|
+
is parallel to this line.
|
|
494
|
+
|
|
495
|
+
#### Defined in
|
|
496
|
+
|
|
497
|
+
[src/Line3D.ts:344](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L344)
|
|
498
|
+
|
|
499
|
+
___
|
|
500
|
+
|
|
501
|
+
### joinLine
|
|
502
|
+
|
|
503
|
+
▸ **joinLine**(`other`, `distanceTolerance?`, `parallelTolerance?`): [`Line3D`](Line3D.md)
|
|
504
|
+
|
|
505
|
+
Joins a copy of this line with the
|
|
506
|
+
|
|
507
|
+
#### Parameters
|
|
508
|
+
|
|
509
|
+
| Name | Type | Default value |
|
|
510
|
+
| :------ | :------ | :------ |
|
|
511
|
+
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
512
|
+
| `distanceTolerance` | `number` | `0` |
|
|
513
|
+
| `parallelTolerance` | `number` | `Number.EPSILON` |
|
|
514
|
+
|
|
515
|
+
#### Returns
|
|
516
|
+
|
|
517
|
+
[`Line3D`](Line3D.md)
|
|
518
|
+
|
|
519
|
+
**`Other`**
|
|
520
|
+
|
|
521
|
+
line.
|
|
522
|
+
Other must be parallel to this line.
|
|
523
|
+
Returns null if there is no overlap
|
|
524
|
+
Clones the line, does not modify this.
|
|
525
|
+
|
|
526
|
+
#### Defined in
|
|
527
|
+
|
|
528
|
+
[src/Line3D.ts:111](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L111)
|
|
529
|
+
|
|
530
|
+
___
|
|
531
|
+
|
|
532
|
+
### moveEndPoint
|
|
533
|
+
|
|
534
|
+
▸ **moveEndPoint**(`amount`): [`Line3D`](Line3D.md)
|
|
535
|
+
|
|
536
|
+
#### Parameters
|
|
537
|
+
|
|
538
|
+
| Name | Type |
|
|
539
|
+
| :------ | :------ |
|
|
540
|
+
| `amount` | `number` |
|
|
541
|
+
|
|
542
|
+
#### Returns
|
|
543
|
+
|
|
544
|
+
[`Line3D`](Line3D.md)
|
|
545
|
+
|
|
546
|
+
#### Defined in
|
|
547
|
+
|
|
548
|
+
[src/Line3D.ts:380](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L380)
|
|
549
|
+
|
|
550
|
+
___
|
|
551
|
+
|
|
552
|
+
### moveStartPoint
|
|
553
|
+
|
|
554
|
+
▸ **moveStartPoint**(`amount`): [`Line3D`](Line3D.md)
|
|
555
|
+
|
|
556
|
+
#### Parameters
|
|
557
|
+
|
|
558
|
+
| Name | Type |
|
|
559
|
+
| :------ | :------ |
|
|
560
|
+
| `amount` | `number` |
|
|
561
|
+
|
|
562
|
+
#### Returns
|
|
563
|
+
|
|
564
|
+
[`Line3D`](Line3D.md)
|
|
565
|
+
|
|
566
|
+
#### Defined in
|
|
567
|
+
|
|
568
|
+
[src/Line3D.ts:368](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L368)
|
|
569
|
+
|
|
570
|
+
___
|
|
571
|
+
|
|
572
|
+
### onPlan
|
|
573
|
+
|
|
574
|
+
▸ **onPlan**(): [`Line2D`](Line2D.md)
|
|
575
|
+
|
|
576
|
+
Project the line to 2D space, Y value is dropped
|
|
577
|
+
|
|
578
|
+
#### Returns
|
|
579
|
+
|
|
580
|
+
[`Line2D`](Line2D.md)
|
|
581
|
+
|
|
582
|
+
#### Defined in
|
|
583
|
+
|
|
584
|
+
[src/Line3D.ts:563](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L563)
|
|
585
|
+
|
|
586
|
+
___
|
|
587
|
+
|
|
588
|
+
### overlaps
|
|
589
|
+
|
|
590
|
+
▸ **overlaps**(`other`, `distanceTolerance?`, `parallelTolerance?`): `boolean`
|
|
591
|
+
|
|
592
|
+
Returns true if there is any overlap between this line and the
|
|
593
|
+
|
|
594
|
+
#### Parameters
|
|
595
|
+
|
|
596
|
+
| Name | Type | Default value |
|
|
597
|
+
| :------ | :------ | :------ |
|
|
598
|
+
| `other` | [`Line3D`](Line3D.md) | `undefined` |
|
|
599
|
+
| `distanceTolerance` | `number` | `0` |
|
|
600
|
+
| `parallelTolerance` | `number` | `Number.EPSILON` |
|
|
601
|
+
|
|
602
|
+
#### Returns
|
|
603
|
+
|
|
604
|
+
`boolean`
|
|
605
|
+
|
|
606
|
+
**`Other`**
|
|
607
|
+
|
|
608
|
+
line section.
|
|
609
|
+
|
|
610
|
+
#### Defined in
|
|
611
|
+
|
|
612
|
+
[src/Line3D.ts:210](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L210)
|
|
613
|
+
|
|
614
|
+
___
|
|
615
|
+
|
|
616
|
+
### projectOn
|
|
617
|
+
|
|
618
|
+
▸ **projectOn**(`other`, `clampToLine`): [`Line3D`](Line3D.md)
|
|
619
|
+
|
|
620
|
+
Returns a new line that is the projection of this line onto @other. Uses `closestPointToPoint` to find the projection.
|
|
621
|
+
|
|
622
|
+
#### Parameters
|
|
623
|
+
|
|
624
|
+
| Name | Type |
|
|
625
|
+
| :------ | :------ |
|
|
626
|
+
| `other` | [`Line3D`](Line3D.md) |
|
|
627
|
+
| `clampToLine` | `boolean` |
|
|
628
|
+
|
|
629
|
+
#### Returns
|
|
630
|
+
|
|
631
|
+
[`Line3D`](Line3D.md)
|
|
632
|
+
|
|
633
|
+
#### Defined in
|
|
634
|
+
|
|
635
|
+
[src/Line3D.ts:394](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L394)
|
|
636
|
+
|
|
637
|
+
___
|
|
638
|
+
|
|
639
|
+
### resize
|
|
640
|
+
|
|
641
|
+
▸ **resize**(`amount`): [`Line3D`](Line3D.md)
|
|
642
|
+
|
|
643
|
+
#### Parameters
|
|
644
|
+
|
|
645
|
+
| Name | Type |
|
|
646
|
+
| :------ | :------ |
|
|
647
|
+
| `amount` | `number` |
|
|
648
|
+
|
|
649
|
+
#### Returns
|
|
650
|
+
|
|
651
|
+
[`Line3D`](Line3D.md)
|
|
652
|
+
|
|
653
|
+
#### Defined in
|
|
654
|
+
|
|
655
|
+
[src/Line3D.ts:359](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L359)
|
|
656
|
+
|
|
657
|
+
___
|
|
658
|
+
|
|
659
|
+
### setCenter
|
|
660
|
+
|
|
661
|
+
▸ **setCenter**(`value`): [`Line3D`](Line3D.md)
|
|
662
|
+
|
|
663
|
+
Set the center of the line to the provided point. Length and direction remain unchanged.
|
|
664
|
+
|
|
665
|
+
#### Parameters
|
|
666
|
+
|
|
667
|
+
| Name | Type |
|
|
668
|
+
| :------ | :------ |
|
|
669
|
+
| `value` | `Vector3` |
|
|
670
|
+
|
|
671
|
+
#### Returns
|
|
672
|
+
|
|
673
|
+
[`Line3D`](Line3D.md)
|
|
674
|
+
|
|
675
|
+
#### Defined in
|
|
676
|
+
|
|
677
|
+
[src/Line3D.ts:278](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L278)
|
|
678
|
+
|
|
679
|
+
___
|
|
680
|
+
|
|
681
|
+
### setLength
|
|
682
|
+
|
|
683
|
+
▸ **setLength**(`length`): [`Line3D`](Line3D.md)
|
|
684
|
+
|
|
685
|
+
Set the length of this line. Center and direction remain unchanged.
|
|
686
|
+
|
|
687
|
+
#### Parameters
|
|
688
|
+
|
|
689
|
+
| Name | Type |
|
|
690
|
+
| :------ | :------ |
|
|
691
|
+
| `length` | `number` |
|
|
692
|
+
|
|
693
|
+
#### Returns
|
|
694
|
+
|
|
695
|
+
[`Line3D`](Line3D.md)
|
|
696
|
+
|
|
697
|
+
#### Defined in
|
|
698
|
+
|
|
699
|
+
[src/Line3D.ts:255](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L255)
|
|
700
|
+
|
|
701
|
+
___
|
|
702
|
+
|
|
703
|
+
### toString
|
|
704
|
+
|
|
705
|
+
▸ **toString**(): `string`
|
|
706
|
+
|
|
707
|
+
#### Returns
|
|
708
|
+
|
|
709
|
+
`string`
|
|
710
|
+
|
|
711
|
+
#### Defined in
|
|
712
|
+
|
|
713
|
+
[src/Line3D.ts:581](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L581)
|
|
714
|
+
|
|
715
|
+
___
|
|
716
|
+
|
|
717
|
+
### translate
|
|
718
|
+
|
|
719
|
+
▸ **translate**(`p`): [`Line3D`](Line3D.md)
|
|
720
|
+
|
|
721
|
+
Move this line by the given vector.
|
|
722
|
+
|
|
723
|
+
#### Parameters
|
|
724
|
+
|
|
725
|
+
| Name | Type |
|
|
726
|
+
| :------ | :------ |
|
|
727
|
+
| `p` | `Vector3` |
|
|
728
|
+
|
|
729
|
+
#### Returns
|
|
730
|
+
|
|
731
|
+
[`Line3D`](Line3D.md)
|
|
732
|
+
|
|
733
|
+
#### Defined in
|
|
734
|
+
|
|
735
|
+
[src/Line3D.ts:441](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L441)
|
|
736
|
+
|
|
737
|
+
___
|
|
738
|
+
|
|
739
|
+
### fromPoints
|
|
740
|
+
|
|
741
|
+
▸ **fromPoints**(`start`, `end`, `index?`): [`Line3D`](Line3D.md)
|
|
742
|
+
|
|
743
|
+
#### Parameters
|
|
744
|
+
|
|
745
|
+
| Name | Type | Default value |
|
|
746
|
+
| :------ | :------ | :------ |
|
|
747
|
+
| `start` | [`Point3`](../interfaces/Point3.md) | `undefined` |
|
|
748
|
+
| `end` | [`Point3`](../interfaces/Point3.md) | `undefined` |
|
|
749
|
+
| `index` | `number` | `0` |
|
|
750
|
+
|
|
751
|
+
#### Returns
|
|
752
|
+
|
|
753
|
+
[`Line3D`](Line3D.md)
|
|
754
|
+
|
|
755
|
+
#### Defined in
|
|
756
|
+
|
|
757
|
+
[src/Line3D.ts:18](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L18)
|
|
758
|
+
|
|
759
|
+
___
|
|
760
|
+
|
|
761
|
+
### fromPolygon
|
|
762
|
+
|
|
763
|
+
▸ **fromPolygon**(`polygon`, `forceClosedPolygon?`): [`Line3D`](Line3D.md)[]
|
|
764
|
+
|
|
765
|
+
Creates a polygon formed by an array of lines from points provided.
|
|
766
|
+
The polygon will only be closed if either
|
|
767
|
+
1) the first and last points are the same or 2) `forceClosedPolygon` is true.
|
|
768
|
+
|
|
769
|
+
#### Parameters
|
|
770
|
+
|
|
771
|
+
| Name | Type | Default value |
|
|
772
|
+
| :------ | :------ | :------ |
|
|
773
|
+
| `polygon` | [`Point3`](../interfaces/Point3.md)[] | `undefined` |
|
|
774
|
+
| `forceClosedPolygon` | `boolean` | `false` |
|
|
775
|
+
|
|
776
|
+
#### Returns
|
|
777
|
+
|
|
778
|
+
[`Line3D`](Line3D.md)[]
|
|
779
|
+
|
|
780
|
+
#### Defined in
|
|
781
|
+
|
|
782
|
+
[src/Line3D.ts:27](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L27)
|
|
783
|
+
|
|
784
|
+
___
|
|
785
|
+
|
|
786
|
+
### groupConnectedLines
|
|
787
|
+
|
|
788
|
+
▸ **groupConnectedLines**(`lines`, `tolerance?`, `breakpoints?`): [`Line3D`](Line3D.md)[][]
|
|
789
|
+
|
|
790
|
+
Accepts an array of Line3D and groups them into arrays of connected lines
|
|
791
|
+
|
|
792
|
+
#### Parameters
|
|
793
|
+
|
|
794
|
+
| Name | Type | Default value | Description |
|
|
795
|
+
| :------ | :------ | :------ | :------ |
|
|
796
|
+
| `lines` | [`Line3D`](Line3D.md)[] | `undefined` | Lines to be grouped |
|
|
797
|
+
| `tolerance` | `number` | `0` | Tolerance for considering lines as connected |
|
|
798
|
+
| `breakpoints` | [`Vec3`](Vec3.md)[] | `[]` | |
|
|
799
|
+
|
|
800
|
+
#### Returns
|
|
801
|
+
|
|
802
|
+
[`Line3D`](Line3D.md)[][]
|
|
803
|
+
|
|
804
|
+
#### Defined in
|
|
805
|
+
|
|
806
|
+
[src/Line3D.ts:511](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L511)
|
|
807
|
+
|
|
808
|
+
___
|
|
809
|
+
|
|
810
|
+
### joinLines
|
|
811
|
+
|
|
812
|
+
▸ **joinLines**(`lines`, `distanceTolerance?`, `parallelTolerance?`): [`Line3D`](Line3D.md)[]
|
|
813
|
+
|
|
814
|
+
Joins provided lines into several joined lines.
|
|
815
|
+
Lines must be parallel for joining.
|
|
816
|
+
|
|
817
|
+
#### Parameters
|
|
818
|
+
|
|
819
|
+
| Name | Type | Default value |
|
|
820
|
+
| :------ | :------ | :------ |
|
|
821
|
+
| `lines` | [`Line3D`](Line3D.md)[] | `undefined` |
|
|
822
|
+
| `distanceTolerance` | `number` | `0` |
|
|
823
|
+
| `parallelTolerance` | `number` | `Number.EPSILON` |
|
|
824
|
+
|
|
825
|
+
#### Returns
|
|
826
|
+
|
|
827
|
+
[`Line3D`](Line3D.md)[]
|
|
828
|
+
|
|
829
|
+
#### Defined in
|
|
830
|
+
|
|
831
|
+
[src/Line3D.ts:165](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Line3D.ts#L165)
|