@immugio/three-math-extensions 0.2.21 → 0.2.23
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 +18 -96
- package/README.md +183 -1
- package/cjs/Line2D.js +79 -12
- package/cjs/Line3D.js +1 -1
- package/docs/classes/BoundingBox.md +13 -9
- package/docs/classes/Line2D.md +325 -80
- package/docs/classes/Line3D.md +155 -84
- package/docs/classes/Polygon.md +23 -19
- package/docs/classes/Rectangle.md +23 -19
- package/docs/classes/Size2.md +9 -5
- package/docs/classes/Vec2.md +62 -12
- package/docs/classes/Vec3.md +65 -15
- package/docs/interfaces/Point2.md +3 -3
- package/docs/interfaces/Point3.md +4 -4
- package/docs/modules.md +86 -5
- package/esm/Line2D.js +79 -12
- package/esm/Line3D.js +1 -1
- package/package.json +1 -1
- package/src/Line2D.ts +93 -12
- package/src/Line3D.ts +1 -1
- package/types/Line2D.d.ts +28 -2
- package/types/Line3D.d.ts +1 -1
- package/docs/README.md +0 -90
package/CHANGELOG.md
CHANGED
|
@@ -7,53 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
9
9
|
|
|
10
|
-
## [0.2.
|
|
10
|
+
## [0.2.23](https://github.com/Immugio/three-math-extensions/compare/0.2.22...0.2.23)
|
|
11
11
|
|
|
12
12
|
### Commits
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- Add
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- Line3D.groupConnectedLines added [`29f372b`](https://github.com/Immugio/three-math-extensions/commit/29f372bc984c06b00c50fcd9428ce9a7b9cab799)
|
|
27
|
-
- Dependencies update and remove now duplicate Vec2.angleTo implementation [`4774abb`](https://github.com/Immugio/three-math-extensions/commit/4774abb81d882082df0da606c79a3c7bd3aecc57)
|
|
28
|
-
- Line2D.isCloserToHorizontal [`b6f1429`](https://github.com/Immugio/three-math-extensions/commit/b6f14292d1d2765f7314c45e4c74be91280ac764)
|
|
29
|
-
- Add Vec2.angleTo and tests [`dcf1e53`](https://github.com/Immugio/three-math-extensions/commit/dcf1e531aecf8c115f323e14e5e44059e5c5d15c)
|
|
30
|
-
- Add Vec2.signedAngle [`863c8f2`](https://github.com/Immugio/three-math-extensions/commit/863c8f27f11288cbda535e21bb688206259269ed)
|
|
31
|
-
- Add parallelism check to Line2D [`18064ee`](https://github.com/Immugio/three-math-extensions/commit/18064ee35a28e2c4d656f3dfb543b545044167dd)
|
|
32
|
-
- Add Vec2.fromPoints to accept multiple points [`a261402`](https://github.com/Immugio/three-math-extensions/commit/a2614027cf5fb8263189b48f7e0bb9a23a552c15)
|
|
33
|
-
- Add Vec2.parallelTo [`989874d`](https://github.com/Immugio/three-math-extensions/commit/989874dcfe122d3ee84d8d56d79cb88e4e441736)
|
|
34
|
-
- Line2D.intersect - enable line segments intersection only [`1f1470e`](https://github.com/Immugio/three-math-extensions/commit/1f1470e1cf00118e643f5c44a135e0baf6b76d41)
|
|
35
|
-
- Line3D.groupConnectedLines now supports line breaks [`417a9ea`](https://github.com/Immugio/three-math-extensions/commit/417a9ea471bf4c539f73f5fb170c962a78ee4ab4)
|
|
36
|
-
- Add Line2D.projectOn [`4c52c5c`](https://github.com/Immugio/three-math-extensions/commit/4c52c5c2e649fbddb72ce3fca60cfd3f1319f72f)
|
|
37
|
-
- Add functionality for incrementing x, y, z coordinates [`b292dcc`](https://github.com/Immugio/three-math-extensions/commit/b292dcc4e8f7f0f2a63e1810c482d96ca6bebebe)
|
|
38
|
-
- Add Line3D.index [`7ed13d2`](https://github.com/Immugio/three-math-extensions/commit/7ed13d213748056c9dafd86288c3bcec9a28d1ba)
|
|
39
|
-
- Polygon from bounding size [`eae6701`](https://github.com/Immugio/three-math-extensions/commit/eae67012f57f426f8b5259b765000447ce06d608)
|
|
40
|
-
- Add Vec3.fromPoints [`62684d7`](https://github.com/Immugio/three-math-extensions/commit/62684d7f6dc1318d345ed74288bb6afd5394e1d3)
|
|
41
|
-
- Line2D and Line3D to return this instead of specific type [`761ef6a`](https://github.com/Immugio/three-math-extensions/commit/761ef6a9d8cc4e35120b666576794e521aa3b991)
|
|
42
|
-
- Line2D.in3DSpace added [`a6ce0ec`](https://github.com/Immugio/three-math-extensions/commit/a6ce0ecb67f5c7b2a75fcc283c28af626153a4af)
|
|
43
|
-
- Line3D.connectsTo added [`6d2cfa0`](https://github.com/Immugio/three-math-extensions/commit/6d2cfa0f5335c665f325a694a32c57b574ec326d)
|
|
44
|
-
- Line2D.hasIntersectionWithAngle to support optional tolerance [`b313bbe`](https://github.com/Immugio/three-math-extensions/commit/b313bbe118d435d53750deefd9a9e29ba6ec5c71)
|
|
45
|
-
- Line2D.hasIntersectionWithAngle - modulo all angles [`5409aa0`](https://github.com/Immugio/three-math-extensions/commit/5409aa0bc41510efa86d548e91837e44e5b6c343)
|
|
46
|
-
- Use Vec2 instead of Vector2 [`7e6a6ea`](https://github.com/Immugio/three-math-extensions/commit/7e6a6ea272f4441ef4bc78b3fdec23fc783fa1db)
|
|
47
|
-
- Update release instructions [`5b41a2e`](https://github.com/Immugio/three-math-extensions/commit/5b41a2ed7e15450dbb6088a7f7ed0031a013badc)
|
|
48
|
-
- Add Polygon to exports [`ed66775`](https://github.com/Immugio/three-math-extensions/commit/ed66775c33e961835b23843222b822cfd9c16b1d)
|
|
49
|
-
- Vec2.fromPoint and Vec3.fromPoint should accept null [`4b871af`](https://github.com/Immugio/three-math-extensions/commit/4b871af297bdcbe8584f1e2b99d602247b77687c)
|
|
50
|
-
- Add HalfPI [`7a6614c`](https://github.com/Immugio/three-math-extensions/commit/7a6614c3d6f59ac216e58986927112f94207a755)
|
|
51
|
-
- Dependencies update [`e8def7e`](https://github.com/Immugio/three-math-extensions/commit/e8def7e94575720cc25296681f844c4e53a9fc5c)
|
|
52
|
-
- Use double quotes [`c1f19db`](https://github.com/Immugio/three-math-extensions/commit/c1f19db2d0886a6ff5555bdbf353dfca20a70f0a)
|
|
53
|
-
- Documentation update [`d5c7a07`](https://github.com/Immugio/three-math-extensions/commit/d5c7a0765f6097f5d3a3be01967d4059f19682fb)
|
|
54
|
-
- Excluded files from build [`ec70614`](https://github.com/Immugio/three-math-extensions/commit/ec70614bc7df7a98f854c7a6693365118e04faf7)
|
|
14
|
+
- Add Line2D.getParallelLineInTheSameDirection [`d2e0846`](https://github.com/Immugio/three-math-extensions/commit/d2e0846024fbb29cf0a29bd5889f6e5c6811e4cb)
|
|
15
|
+
- Correct test file extension [`91b5e2a`](https://github.com/Immugio/three-math-extensions/commit/91b5e2ad338e8404704381a36813dcce5f00d978)
|
|
16
|
+
|
|
17
|
+
## [0.2.22](https://github.com/Immugio/three-math-extensions/compare/0.2.21...0.2.22) - 2024-04-15
|
|
18
|
+
|
|
19
|
+
### Commits
|
|
20
|
+
|
|
21
|
+
- Documentation update [`905d178`](https://github.com/Immugio/three-math-extensions/commit/905d1787ed7ffffa370b77454222ee04e76f35b5)
|
|
22
|
+
- Documentation update [`70a5f24`](https://github.com/Immugio/three-math-extensions/commit/70a5f243f8af83da3ad5d30e223788cbd877b5f0)
|
|
23
|
+
- Add Line2D.containsPoint, Line2D.covers, Improve Line2D.equals, Line2D.overlaps, add unit tests [`7b6daf7`](https://github.com/Immugio/three-math-extensions/commit/7b6daf7028303313b6937c16514838604d89515d)
|
|
24
|
+
|
|
25
|
+
## [0.2.21](https://github.com/Immugio/three-math-extensions/compare/0.2.20...0.2.21) - 2024-04-03
|
|
55
26
|
|
|
56
|
-
|
|
27
|
+
### Commits
|
|
28
|
+
|
|
29
|
+
- Three dependency update [`7cf5cf3`](https://github.com/Immugio/three-math-extensions/commit/7cf5cf3ece28c408b544d5dcc8626a9fe005b9a5)
|
|
57
30
|
|
|
58
31
|
## [0.2.20](https://github.com/Immugio/three-math-extensions/compare/0.2.19...0.2.20) - 2024-04-03
|
|
59
32
|
|
|
@@ -162,11 +135,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
162
135
|
- Improve documentation [`d0fcb51`](https://github.com/Immugio/three-math-extensions/commit/d0fcb5132f127b4382ac5f7291575a061b8ec121)
|
|
163
136
|
- Excluded files from build [`ec70614`](https://github.com/Immugio/three-math-extensions/commit/ec70614bc7df7a98f854c7a6693365118e04faf7)
|
|
164
137
|
|
|
165
|
-
## [0.2.5](https://github.com/Immugio/three-math-extensions/compare/0.2.
|
|
166
|
-
|
|
167
|
-
## [0.2.4](https://github.com/Immugio/three-math-extensions/compare/0.2.3...0.2.4) - 2023-04-11
|
|
168
|
-
|
|
169
|
-
## [0.2.3](https://github.com/Immugio/three-math-extensions/compare/0.2.2...0.2.3) - 2023-04-11
|
|
138
|
+
## [0.2.5](https://github.com/Immugio/three-math-extensions/compare/0.2.2...0.2.5) - 2023-04-11
|
|
170
139
|
|
|
171
140
|
### Commits
|
|
172
141
|
|
|
@@ -276,62 +245,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
276
245
|
|
|
277
246
|
## [0.0.7](https://github.com/Immugio/three-math-extensions/compare/0.0.6...0.0.7) - 2022-11-21
|
|
278
247
|
|
|
279
|
-
## [0.0.6](https://github.com/Immugio/three-math-extensions/compare/0.0.
|
|
280
|
-
|
|
281
|
-
## [0.0.5](https://github.com/Immugio/three-math-extensions/compare/0.0.4...0.0.5) - 2023-09-01
|
|
248
|
+
## [0.0.6](https://github.com/Immugio/three-math-extensions/compare/0.0.4...0.0.6) - 2022-11-24
|
|
282
249
|
|
|
283
250
|
### Commits
|
|
284
251
|
|
|
285
|
-
- Generate documentation using TSDoc [`304c3a8`](https://github.com/Immugio/three-math-extensions/commit/304c3a84b5dcc49183db57083f550d134ae641b2)
|
|
286
|
-
- Add eslint [`98e4912`](https://github.com/Immugio/three-math-extensions/commit/98e4912d637b42ba80e2f3267638b43296113019)
|
|
287
|
-
- Update jest packages [`af23b4f`](https://github.com/Immugio/three-math-extensions/commit/af23b4f08154bba3407f05b773865215e7e1cba8)
|
|
288
|
-
- Add Rectangle, update Polygon [`58ee875`](https://github.com/Immugio/three-math-extensions/commit/58ee87539af8f9ade186e5250cba9e01926da514)
|
|
289
|
-
- Add isPointInPolygon [`a59eb4b`](https://github.com/Immugio/three-math-extensions/commit/a59eb4be026f17a3106070ae626a0588cd4f4411)
|
|
290
|
-
- Improve Line2D.closestPointToPoint, add Vec2.signedAngle [`151f214`](https://github.com/Immugio/three-math-extensions/commit/151f21462e0358057ad8e9d75d5782563a1061f6)
|
|
291
|
-
- Improve documentation [`d0fcb51`](https://github.com/Immugio/three-math-extensions/commit/d0fcb5132f127b4382ac5f7291575a061b8ec121)
|
|
292
|
-
- Vec3, Line3D - update documentation [`67d9c32`](https://github.com/Immugio/three-math-extensions/commit/67d9c328e08cc0a5599932d2f0529e97f31c9213)
|
|
293
|
-
- Add Polygon [`629cff8`](https://github.com/Immugio/three-math-extensions/commit/629cff8ecbb963477e8ea76d7f8b16d95435cbad)
|
|
294
252
|
- Improve API, minor bug fix, improve test coverage [`881a5f0`](https://github.com/Immugio/three-math-extensions/commit/881a5f096823f0d5fd90faa76cd602f076291bc5)
|
|
295
|
-
- Line3D.groupConnectedLines added [`29f372b`](https://github.com/Immugio/three-math-extensions/commit/29f372bc984c06b00c50fcd9428ce9a7b9cab799)
|
|
296
|
-
- Dependencies update and remove now duplicate Vec2.angleTo implementation [`4774abb`](https://github.com/Immugio/three-math-extensions/commit/4774abb81d882082df0da606c79a3c7bd3aecc57)
|
|
297
|
-
- Line2D.isCloserToHorizontal [`b6f1429`](https://github.com/Immugio/three-math-extensions/commit/b6f14292d1d2765f7314c45e4c74be91280ac764)
|
|
298
|
-
- Add Vec2.angleTo and tests [`dcf1e53`](https://github.com/Immugio/three-math-extensions/commit/dcf1e531aecf8c115f323e14e5e44059e5c5d15c)
|
|
299
|
-
- Add Vec2.signedAngle [`863c8f2`](https://github.com/Immugio/three-math-extensions/commit/863c8f27f11288cbda535e21bb688206259269ed)
|
|
300
|
-
- Add intersect method to Line3D [`6fe47de`](https://github.com/Immugio/three-math-extensions/commit/6fe47de7caaa1807b47a4363e551510c463757d7)
|
|
301
|
-
- Add Line2D.extendToOrTrimAtIntersection [`ab82a36`](https://github.com/Immugio/three-math-extensions/commit/ab82a36db52b9ae83cf8bfb848362d295140d073)
|
|
302
|
-
- Add Vec2.fromPoints to accept multiple points [`a261402`](https://github.com/Immugio/three-math-extensions/commit/a2614027cf5fb8263189b48f7e0bb9a23a552c15)
|
|
303
|
-
- Improve documentation for Vec2 and Vec3 [`6a2373d`](https://github.com/Immugio/three-math-extensions/commit/6a2373d8b6754a87720dcaea5d98336bfa7bc5b5)
|
|
304
|
-
- Add Vec2.parallelTo [`989874d`](https://github.com/Immugio/three-math-extensions/commit/989874dcfe122d3ee84d8d56d79cb88e4e441736)
|
|
305
|
-
- Line2D.intersect - enable line segments intersection only [`1f1470e`](https://github.com/Immugio/three-math-extensions/commit/1f1470e1cf00118e643f5c44a135e0baf6b76d41)
|
|
306
|
-
- Line3D.groupConnectedLines now supports line breaks [`417a9ea`](https://github.com/Immugio/three-math-extensions/commit/417a9ea471bf4c539f73f5fb170c962a78ee4ab4)
|
|
307
|
-
- Add Line2D.projectOn [`4c52c5c`](https://github.com/Immugio/three-math-extensions/commit/4c52c5c2e649fbddb72ce3fca60cfd3f1319f72f)
|
|
308
|
-
- Added "isNear" to Vec2 & Vec3 as a shorthand for distanceTo <= maxDistance [`a27cff8`](https://github.com/Immugio/three-math-extensions/commit/a27cff8421472f625ed240439b9e6a7d2c430db8)
|
|
309
|
-
- Add Line3D.index [`7ed13d2`](https://github.com/Immugio/three-math-extensions/commit/7ed13d213748056c9dafd86288c3bcec9a28d1ba)
|
|
310
253
|
- Add .npmignore [`f58329a`](https://github.com/Immugio/three-math-extensions/commit/f58329a86b96589bb574d6ebed37d4cc4474663a)
|
|
311
|
-
- Polygon from bounding size [`eae6701`](https://github.com/Immugio/three-math-extensions/commit/eae67012f57f426f8b5259b765000447ce06d608)
|
|
312
|
-
- Add Vec2 documentation [`f625e66`](https://github.com/Immugio/three-math-extensions/commit/f625e66b60ee0d90c5c788a80989f64013d60265)
|
|
313
|
-
- Clean up documentation [`70c8d5e`](https://github.com/Immugio/three-math-extensions/commit/70c8d5efe8b7095d7a03af637df3af5d46615293)
|
|
314
|
-
- Line2D and Line3D to return this instead of specific type [`761ef6a`](https://github.com/Immugio/three-math-extensions/commit/761ef6a9d8cc4e35120b666576794e521aa3b991)
|
|
315
|
-
- Line2D.in3DSpace added [`a6ce0ec`](https://github.com/Immugio/three-math-extensions/commit/a6ce0ecb67f5c7b2a75fcc283c28af626153a4af)
|
|
316
|
-
- Line3D.connectsTo added [`6d2cfa0`](https://github.com/Immugio/three-math-extensions/commit/6d2cfa0f5335c665f325a694a32c57b574ec326d)
|
|
317
|
-
- Line2D.hasIntersectionWithAngle to support optional tolerance [`b313bbe`](https://github.com/Immugio/three-math-extensions/commit/b313bbe118d435d53750deefd9a9e29ba6ec5c71)
|
|
318
|
-
- Add Vec2.moveTowards [`b46ba12`](https://github.com/Immugio/three-math-extensions/commit/b46ba1286f9924cd9bfecfb37200664202e964ba)
|
|
319
|
-
- Line2D.hasIntersectionWithAngle - modulo all angles [`5409aa0`](https://github.com/Immugio/three-math-extensions/commit/5409aa0bc41510efa86d548e91837e44e5b6c343)
|
|
320
|
-
- Use Vec2 instead of Vector2 [`7e6a6ea`](https://github.com/Immugio/three-math-extensions/commit/7e6a6ea272f4441ef4bc78b3fdec23fc783fa1db)
|
|
321
|
-
- Add release instructions into README.md [`03653b1`](https://github.com/Immugio/three-math-extensions/commit/03653b1ffa55be606d3f9cd588e28a6084462c2e)
|
|
322
|
-
- Documentation improvements [`160db8b`](https://github.com/Immugio/three-math-extensions/commit/160db8ba6d6e5eb63a4e91ed9c40efd6fa70181a)
|
|
323
|
-
- Update release instructions [`5b41a2e`](https://github.com/Immugio/three-math-extensions/commit/5b41a2ed7e15450dbb6088a7f7ed0031a013badc)
|
|
324
|
-
- Add Polygon to exports [`ed66775`](https://github.com/Immugio/three-math-extensions/commit/ed66775c33e961835b23843222b822cfd9c16b1d)
|
|
325
|
-
- Vec2.fromPoint and Vec3.fromPoint should accept null [`4b871af`](https://github.com/Immugio/three-math-extensions/commit/4b871af297bdcbe8584f1e2b99d602247b77687c)
|
|
326
|
-
- Documentation improvements [`2f3e676`](https://github.com/Immugio/three-math-extensions/commit/2f3e6768b3b0139b60688fc151a4084f15566f8d)
|
|
327
|
-
- Documentation update [`d5c7a07`](https://github.com/Immugio/three-math-extensions/commit/d5c7a0765f6097f5d3a3be01967d4059f19682fb)
|
|
328
|
-
- Fix peer dependency version [`00dd116`](https://github.com/Immugio/three-math-extensions/commit/00dd1169f578d5769207031fa625f29c96a38c31)
|
|
329
|
-
- Add Line2D.extendToOrTrimAtIntersection [`b22aa12`](https://github.com/Immugio/three-math-extensions/commit/b22aa120b5eb02562cebc4573374ebb61e2dba14)
|
|
330
254
|
- Correct change log version [`c6244bf`](https://github.com/Immugio/three-math-extensions/commit/c6244bf1488ad21bcc5589d1dff62c41d8182d48)
|
|
331
255
|
- Release 0.0.4 - tag pattern 6 [`c1c5454`](https://github.com/Immugio/three-math-extensions/commit/c1c54541ed400e1ad49bf42fe8926cd5293efefd)
|
|
332
256
|
- Release 0.0.4 - tag pattern 5 [`5245eed`](https://github.com/Immugio/three-math-extensions/commit/5245eed60195103e989c0fadf9bd642f39ef4589)
|
|
333
|
-
- Excluded files from build [`ec70614`](https://github.com/Immugio/three-math-extensions/commit/ec70614bc7df7a98f854c7a6693365118e04faf7)
|
|
334
|
-
- Revert npm ignore [`590b26a`](https://github.com/Immugio/three-math-extensions/commit/590b26a9e57fc41466b51e711f3f5c648e2d56ed)
|
|
335
257
|
|
|
336
258
|
## 0.0.4 - 2022-11-21
|
|
337
259
|
|
package/README.md
CHANGED
|
@@ -6,4 +6,186 @@
|
|
|
6
6
|
|
|
7
7
|
# @immugio/three-math-extensions
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Table of contents
|
|
10
|
+
|
|
11
|
+
### Classes
|
|
12
|
+
|
|
13
|
+
- [BoundingBox](docs/classes/BoundingBox.md)
|
|
14
|
+
- [Line2D](docs/classes/Line2D.md)
|
|
15
|
+
- [Line3D](docs/classes/Line3D.md)
|
|
16
|
+
- [Polygon](docs/classes/Polygon.md)
|
|
17
|
+
- [Rectangle](docs/classes/Rectangle.md)
|
|
18
|
+
- [Size2](docs/classes/Size2.md)
|
|
19
|
+
- [Vec2](docs/classes/Vec2.md)
|
|
20
|
+
- [Vec3](docs/classes/Vec3.md)
|
|
21
|
+
|
|
22
|
+
### Interfaces
|
|
23
|
+
|
|
24
|
+
- [Point2](docs/interfaces/Point2.md)
|
|
25
|
+
- [Point3](docs/interfaces/Point3.md)
|
|
26
|
+
|
|
27
|
+
### Variables
|
|
28
|
+
|
|
29
|
+
- [HalfPI](docs/modules.md#halfpi)
|
|
30
|
+
- [TwoPI](docs/modules.md#twopi)
|
|
31
|
+
- [directions](docs/modules.md#directions)
|
|
32
|
+
- [directions2d](docs/modules.md#directions2d)
|
|
33
|
+
|
|
34
|
+
### Functions
|
|
35
|
+
|
|
36
|
+
- [isContinuousClosedShape](docs/modules.md#iscontinuousclosedshape)
|
|
37
|
+
- [isPointInPolygon](docs/modules.md#ispointinpolygon)
|
|
38
|
+
- [normalizeAngleDegrees](docs/modules.md#normalizeangledegrees)
|
|
39
|
+
- [normalizeAngleRadians](docs/modules.md#normalizeangleradians)
|
|
40
|
+
|
|
41
|
+
## Variables
|
|
42
|
+
|
|
43
|
+
### HalfPI
|
|
44
|
+
|
|
45
|
+
• `Const` **HalfPI**: `number`
|
|
46
|
+
|
|
47
|
+
#### Defined in
|
|
48
|
+
|
|
49
|
+
[src/MathConstants.ts:2](https://github.com/Immugio/three-math-extensions/blob/7b6daf7/src/MathConstants.ts#L2)
|
|
50
|
+
|
|
51
|
+
___
|
|
52
|
+
|
|
53
|
+
### TwoPI
|
|
54
|
+
|
|
55
|
+
• `Const` **TwoPI**: `number`
|
|
56
|
+
|
|
57
|
+
#### Defined in
|
|
58
|
+
|
|
59
|
+
[src/MathConstants.ts:1](https://github.com/Immugio/three-math-extensions/blob/7b6daf7/src/MathConstants.ts#L1)
|
|
60
|
+
|
|
61
|
+
___
|
|
62
|
+
|
|
63
|
+
### directions
|
|
64
|
+
|
|
65
|
+
• `Const` **directions**: `Object`
|
|
66
|
+
|
|
67
|
+
#### Type declaration
|
|
68
|
+
|
|
69
|
+
| Name | Type |
|
|
70
|
+
| :------ | :------ |
|
|
71
|
+
| `Down` | [`Vec3`](docs/classes/Vec3.md) |
|
|
72
|
+
| `East` | [`Vec3`](docs/classes/Vec3.md) |
|
|
73
|
+
| `North` | [`Vec3`](docs/classes/Vec3.md) |
|
|
74
|
+
| `South` | [`Vec3`](docs/classes/Vec3.md) |
|
|
75
|
+
| `Up` | [`Vec3`](docs/classes/Vec3.md) |
|
|
76
|
+
| `West` | [`Vec3`](docs/classes/Vec3.md) |
|
|
77
|
+
|
|
78
|
+
#### Defined in
|
|
79
|
+
|
|
80
|
+
[src/directions.ts:3](https://github.com/Immugio/three-math-extensions/blob/7b6daf7/src/directions.ts#L3)
|
|
81
|
+
|
|
82
|
+
___
|
|
83
|
+
|
|
84
|
+
### directions2d
|
|
85
|
+
|
|
86
|
+
• `Const` **directions2d**: `Object`
|
|
87
|
+
|
|
88
|
+
#### Type declaration
|
|
89
|
+
|
|
90
|
+
| Name | Type |
|
|
91
|
+
| :------ | :------ |
|
|
92
|
+
| `Down` | [`Vec2`](docs/classes/Vec2.md) |
|
|
93
|
+
| `Left` | [`Vec2`](docs/classes/Vec2.md) |
|
|
94
|
+
| `Right` | [`Vec2`](docs/classes/Vec2.md) |
|
|
95
|
+
| `Up` | [`Vec2`](docs/classes/Vec2.md) |
|
|
96
|
+
|
|
97
|
+
#### Defined in
|
|
98
|
+
|
|
99
|
+
[src/directions2d.ts:3](https://github.com/Immugio/three-math-extensions/blob/7b6daf7/src/directions2d.ts#L3)
|
|
100
|
+
|
|
101
|
+
## Functions
|
|
102
|
+
|
|
103
|
+
### isContinuousClosedShape
|
|
104
|
+
|
|
105
|
+
▸ **isContinuousClosedShape**\<`T`\>(`lines`, `tolerance?`): `boolean`
|
|
106
|
+
|
|
107
|
+
#### Type parameters
|
|
108
|
+
|
|
109
|
+
| Name | Type |
|
|
110
|
+
| :------ | :------ |
|
|
111
|
+
| `T` | extends [`Line3D`](docs/classes/Line3D.md) \| [`Line2D`](docs/classes/Line2D.md) |
|
|
112
|
+
|
|
113
|
+
#### Parameters
|
|
114
|
+
|
|
115
|
+
| Name | Type | Default value |
|
|
116
|
+
| :------ | :------ | :------ |
|
|
117
|
+
| `lines` | `T`[] | `undefined` |
|
|
118
|
+
| `tolerance` | `number` | `0` |
|
|
119
|
+
|
|
120
|
+
#### Returns
|
|
121
|
+
|
|
122
|
+
`boolean`
|
|
123
|
+
|
|
124
|
+
#### Defined in
|
|
125
|
+
|
|
126
|
+
[src/isContinuousClosedShape.ts:4](https://github.com/Immugio/three-math-extensions/blob/7b6daf7/src/isContinuousClosedShape.ts#L4)
|
|
127
|
+
|
|
128
|
+
___
|
|
129
|
+
|
|
130
|
+
### isPointInPolygon
|
|
131
|
+
|
|
132
|
+
▸ **isPointInPolygon**(`p`, `point`): `boolean`
|
|
133
|
+
|
|
134
|
+
#### Parameters
|
|
135
|
+
|
|
136
|
+
| Name | Type |
|
|
137
|
+
| :------ | :------ |
|
|
138
|
+
| `p` | [`Point2`](docs/interfaces/Point2.md)[] |
|
|
139
|
+
| `point` | [`Point2`](docs/interfaces/Point2.md) |
|
|
140
|
+
|
|
141
|
+
#### Returns
|
|
142
|
+
|
|
143
|
+
`boolean`
|
|
144
|
+
|
|
145
|
+
#### Defined in
|
|
146
|
+
|
|
147
|
+
[src/isPointInPolygon.ts:3](https://github.com/Immugio/three-math-extensions/blob/7b6daf7/src/isPointInPolygon.ts#L3)
|
|
148
|
+
|
|
149
|
+
___
|
|
150
|
+
|
|
151
|
+
### normalizeAngleDegrees
|
|
152
|
+
|
|
153
|
+
▸ **normalizeAngleDegrees**(`angle`): `number`
|
|
154
|
+
|
|
155
|
+
Normalizes an angle in degrees to the range [0, 360].
|
|
156
|
+
|
|
157
|
+
#### Parameters
|
|
158
|
+
|
|
159
|
+
| Name | Type | Description |
|
|
160
|
+
| :------ | :------ | :------ |
|
|
161
|
+
| `angle` | `number` | in degrees |
|
|
162
|
+
|
|
163
|
+
#### Returns
|
|
164
|
+
|
|
165
|
+
`number`
|
|
166
|
+
|
|
167
|
+
#### Defined in
|
|
168
|
+
|
|
169
|
+
[src/normalizeAngleDegrees.ts:5](https://github.com/Immugio/three-math-extensions/blob/7b6daf7/src/normalizeAngleDegrees.ts#L5)
|
|
170
|
+
|
|
171
|
+
___
|
|
172
|
+
|
|
173
|
+
### normalizeAngleRadians
|
|
174
|
+
|
|
175
|
+
▸ **normalizeAngleRadians**(`angle`): `number`
|
|
176
|
+
|
|
177
|
+
Normalize an angle in radians to the range of 0 to 2π.
|
|
178
|
+
|
|
179
|
+
#### Parameters
|
|
180
|
+
|
|
181
|
+
| Name | Type | Description |
|
|
182
|
+
| :------ | :------ | :------ |
|
|
183
|
+
| `angle` | `number` | in radians |
|
|
184
|
+
|
|
185
|
+
#### Returns
|
|
186
|
+
|
|
187
|
+
`number`
|
|
188
|
+
|
|
189
|
+
#### Defined in
|
|
190
|
+
|
|
191
|
+
[src/normalizeAngleRadians.ts:7](https://github.com/Immugio/three-math-extensions/blob/7b6daf7/src/normalizeAngleRadians.ts#L7)
|
package/cjs/Line2D.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Line2D = void 0;
|
|
4
4
|
const three_1 = require("three");
|
|
5
5
|
const Vec2_1 = require("./Vec2");
|
|
6
|
-
const three_2 = require("three");
|
|
7
6
|
const MathConstants_1 = require("./MathConstants");
|
|
8
7
|
const Line3D_1 = require("./Line3D");
|
|
9
8
|
const directions2d_1 = require("./directions2d");
|
|
@@ -13,6 +12,7 @@ class Line2D {
|
|
|
13
12
|
start;
|
|
14
13
|
end;
|
|
15
14
|
index;
|
|
15
|
+
#target = new Vec2_1.Vec2();
|
|
16
16
|
constructor(start, end, index = 0) {
|
|
17
17
|
this.start = start;
|
|
18
18
|
this.end = end;
|
|
@@ -141,6 +141,41 @@ class Line2D {
|
|
|
141
141
|
get endpoints() {
|
|
142
142
|
return [this.start, this.end];
|
|
143
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Check that this line segment contains provided point.
|
|
146
|
+
* @param p
|
|
147
|
+
* @param tolerance
|
|
148
|
+
*/
|
|
149
|
+
containsPoint(p, tolerance = 0) {
|
|
150
|
+
const closestPointToPoint = this.closestPointToPoint(p, true, this.#target);
|
|
151
|
+
return closestPointToPoint.distanceTo(p) <= tolerance;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Distance from this line to the provided point.
|
|
155
|
+
* @param param
|
|
156
|
+
* @param clampToLine
|
|
157
|
+
*/
|
|
158
|
+
distanceToPoint(p, clampToLine = true) {
|
|
159
|
+
const closestPointToPoint = this.closestPointToPoint(p, clampToLine, this.#target);
|
|
160
|
+
return closestPointToPoint.distanceTo(p);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Returns a copy of @other line, the direction of @other is reversed if needed.
|
|
164
|
+
* Returns null if lines are not parallel.
|
|
165
|
+
* @param other
|
|
166
|
+
* @param parallelTolerance
|
|
167
|
+
*/
|
|
168
|
+
getParallelLineInTheSameDirection(other, parallelTolerance = 0) {
|
|
169
|
+
const direction = this.direction;
|
|
170
|
+
if (direction.angleTo(other.direction) <= parallelTolerance) {
|
|
171
|
+
return other.clone();
|
|
172
|
+
}
|
|
173
|
+
const otherLineOppositeDirection = other.clone().flip();
|
|
174
|
+
if (otherLineOppositeDirection.direction.angleTo(direction) <= parallelTolerance) {
|
|
175
|
+
return otherLineOppositeDirection;
|
|
176
|
+
}
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
144
179
|
/**
|
|
145
180
|
* Returns the direction of this line.
|
|
146
181
|
*/
|
|
@@ -152,9 +187,9 @@ class Line2D {
|
|
|
152
187
|
* Modifies this line.
|
|
153
188
|
*/
|
|
154
189
|
flip() {
|
|
155
|
-
|
|
190
|
+
this.#target.copy(this.start);
|
|
156
191
|
this.start.copy(this.end);
|
|
157
|
-
this.end.copy(
|
|
192
|
+
this.end.copy(this.#target);
|
|
158
193
|
return this;
|
|
159
194
|
}
|
|
160
195
|
/**
|
|
@@ -248,14 +283,32 @@ class Line2D {
|
|
|
248
283
|
/**
|
|
249
284
|
* Returns true if there is any overlap between this line and the @other line section.
|
|
250
285
|
*/
|
|
251
|
-
overlaps(other) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
if (this.start.equals(other.start) && this.end.equals(other.end)) {
|
|
286
|
+
overlaps(other, distanceTolerance = 0, parallelTolerance = 0) {
|
|
287
|
+
// Special case
|
|
288
|
+
if (this.equals(other, distanceTolerance)) {
|
|
256
289
|
return true;
|
|
257
290
|
}
|
|
258
|
-
|
|
291
|
+
// Always have to be parallel
|
|
292
|
+
if (this.isParallelTo(other, parallelTolerance)) {
|
|
293
|
+
// To pass as overlapping, at least one point has to be within the other line, but they mush not be equal - "touching" is not considered overlapping
|
|
294
|
+
const otherStartEqualsToAnyOfThisPoint = other.start.distanceTo(this.start) <= distanceTolerance || other.start.distanceTo(this.end) <= distanceTolerance;
|
|
295
|
+
if (this.containsPoint(other.start, distanceTolerance) && !otherStartEqualsToAnyOfThisPoint) {
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
const otherEndEqualsToAnyOfThisPoint = other.end.distanceTo(this.start) <= distanceTolerance || other.end.distanceTo(this.end) <= distanceTolerance;
|
|
299
|
+
if (this.containsPoint(other.end, distanceTolerance) && !otherEndEqualsToAnyOfThisPoint) {
|
|
300
|
+
return true;
|
|
301
|
+
}
|
|
302
|
+
const thisStartEqualsToAnyOfOtherPoint = this.start.distanceTo(other.start) <= distanceTolerance || this.start.distanceTo(other.end) <= distanceTolerance;
|
|
303
|
+
if (other.containsPoint(this.start, distanceTolerance) && !thisStartEqualsToAnyOfOtherPoint) {
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
const thisEndEqualsToAnyOfOtherPoint = this.end.distanceTo(other.start) <= distanceTolerance || this.end.distanceTo(other.end) <= distanceTolerance;
|
|
307
|
+
if (other.containsPoint(this.end, distanceTolerance) && !thisEndEqualsToAnyOfOtherPoint) {
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return false;
|
|
259
312
|
}
|
|
260
313
|
/**
|
|
261
314
|
* Logical AND of this and the other line section.
|
|
@@ -327,6 +380,17 @@ class Line2D {
|
|
|
327
380
|
}
|
|
328
381
|
return result;
|
|
329
382
|
}
|
|
383
|
+
/**
|
|
384
|
+
* Checks if the current line covers another line.
|
|
385
|
+
* 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.
|
|
386
|
+
* Both distance and angle tolerance can be provided.
|
|
387
|
+
*/
|
|
388
|
+
covers(other, tolerance = 0, parallelTolerance = 0) {
|
|
389
|
+
if (!this.isParallelTo(other, parallelTolerance)) {
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
return this.containsPoint(other.start, tolerance) && this.containsPoint(other.end, tolerance);
|
|
393
|
+
}
|
|
330
394
|
/**
|
|
331
395
|
* Returns a new line that is the projection of this line onto @other. Uses `closestPointToPoint` to find the projection.
|
|
332
396
|
* @param other
|
|
@@ -374,7 +438,7 @@ class Line2D {
|
|
|
374
438
|
const startEnd_startP = _startEnd.dot(_startP);
|
|
375
439
|
let t = startEnd_startP / startEnd2;
|
|
376
440
|
if (clampToLine) {
|
|
377
|
-
t =
|
|
441
|
+
t = three_1.MathUtils.clamp(t, 0, 1);
|
|
378
442
|
}
|
|
379
443
|
return t;
|
|
380
444
|
}
|
|
@@ -643,8 +707,11 @@ class Line2D {
|
|
|
643
707
|
in3DSpace(y = 0) {
|
|
644
708
|
return new Line3D_1.Line3D(this.start.in3DSpace(y), this.end.in3DSpace(y));
|
|
645
709
|
}
|
|
646
|
-
equals(other) {
|
|
647
|
-
|
|
710
|
+
equals(other, tolerance = 0) {
|
|
711
|
+
if (!tolerance) {
|
|
712
|
+
return !!other && this.start.equals(other.start) && this.end.equals(other.end);
|
|
713
|
+
}
|
|
714
|
+
return !!other && this.start.distanceTo(other.start) <= tolerance && this.end.distanceTo(other.end) <= tolerance;
|
|
648
715
|
}
|
|
649
716
|
/**
|
|
650
717
|
* Deep clone of this line
|
package/cjs/Line3D.js
CHANGED
|
@@ -253,7 +253,7 @@ class Line3D extends three_1.Line3 {
|
|
|
253
253
|
return closestPointToPoint.distanceTo(p) <= tolerance;
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
256
|
-
* Distance from this line to provided point.
|
|
256
|
+
* Distance from this line to the provided point.
|
|
257
257
|
* @param p
|
|
258
258
|
* @param clampToLine
|
|
259
259
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[@immugio/three-math-extensions](
|
|
1
|
+
[@immugio/three-math-extensions](../../README.md) / [Exports](../modules.md) / BoundingBox
|
|
2
2
|
|
|
3
3
|
# Class: BoundingBox
|
|
4
4
|
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
### constructor
|
|
29
29
|
|
|
30
|
-
• **new BoundingBox**(`minX`, `maxX`, `minY`, `maxY`)
|
|
30
|
+
• **new BoundingBox**(`minX`, `maxX`, `minY`, `maxY`): [`BoundingBox`](BoundingBox.md)
|
|
31
31
|
|
|
32
32
|
#### Parameters
|
|
33
33
|
|
|
@@ -38,9 +38,13 @@
|
|
|
38
38
|
| `minY` | `number` |
|
|
39
39
|
| `maxY` | `number` |
|
|
40
40
|
|
|
41
|
+
#### Returns
|
|
42
|
+
|
|
43
|
+
[`BoundingBox`](BoundingBox.md)
|
|
44
|
+
|
|
41
45
|
#### Defined in
|
|
42
46
|
|
|
43
|
-
[src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/
|
|
47
|
+
[src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/336678b/src/BoundingBox.ts#L4)
|
|
44
48
|
|
|
45
49
|
## Properties
|
|
46
50
|
|
|
@@ -50,7 +54,7 @@
|
|
|
50
54
|
|
|
51
55
|
#### Defined in
|
|
52
56
|
|
|
53
|
-
[src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/
|
|
57
|
+
[src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/336678b/src/BoundingBox.ts#L4)
|
|
54
58
|
|
|
55
59
|
___
|
|
56
60
|
|
|
@@ -60,7 +64,7 @@ ___
|
|
|
60
64
|
|
|
61
65
|
#### Defined in
|
|
62
66
|
|
|
63
|
-
[src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/
|
|
67
|
+
[src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/336678b/src/BoundingBox.ts#L4)
|
|
64
68
|
|
|
65
69
|
___
|
|
66
70
|
|
|
@@ -70,7 +74,7 @@ ___
|
|
|
70
74
|
|
|
71
75
|
#### Defined in
|
|
72
76
|
|
|
73
|
-
[src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/
|
|
77
|
+
[src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/336678b/src/BoundingBox.ts#L4)
|
|
74
78
|
|
|
75
79
|
___
|
|
76
80
|
|
|
@@ -80,7 +84,7 @@ ___
|
|
|
80
84
|
|
|
81
85
|
#### Defined in
|
|
82
86
|
|
|
83
|
-
[src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/
|
|
87
|
+
[src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/336678b/src/BoundingBox.ts#L4)
|
|
84
88
|
|
|
85
89
|
## Accessors
|
|
86
90
|
|
|
@@ -94,7 +98,7 @@ ___
|
|
|
94
98
|
|
|
95
99
|
#### Defined in
|
|
96
100
|
|
|
97
|
-
[src/BoundingBox.ts:11](https://github.com/Immugio/three-math-extensions/blob/
|
|
101
|
+
[src/BoundingBox.ts:11](https://github.com/Immugio/three-math-extensions/blob/336678b/src/BoundingBox.ts#L11)
|
|
98
102
|
|
|
99
103
|
## Methods
|
|
100
104
|
|
|
@@ -114,4 +118,4 @@ ___
|
|
|
114
118
|
|
|
115
119
|
#### Defined in
|
|
116
120
|
|
|
117
|
-
[src/BoundingBox.ts:7](https://github.com/Immugio/three-math-extensions/blob/
|
|
121
|
+
[src/BoundingBox.ts:7](https://github.com/Immugio/three-math-extensions/blob/336678b/src/BoundingBox.ts#L7)
|