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