@immugio/three-math-extensions 0.2.23 → 0.2.25

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 CHANGED
@@ -7,7 +7,69 @@ 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.23](https://github.com/Immugio/three-math-extensions/compare/0.2.22...0.2.23)
10
+ ## [0.2.25](https://github.com/Immugio/three-math-extensions/compare/16.15.10...0.2.25)
11
+
12
+ ### Commits
13
+
14
+ - Three dependency update [`7cf5cf3`](https://github.com/Immugio/three-math-extensions/commit/7cf5cf3ece28c408b544d5dcc8626a9fe005b9a5)
15
+ - Packages update [`0d85b39`](https://github.com/Immugio/three-math-extensions/commit/0d85b392029f7bbaa5063cd0494e34f593d62ea5)
16
+ - Add eslint [`98e4912`](https://github.com/Immugio/three-math-extensions/commit/98e4912d637b42ba80e2f3267638b43296113019)
17
+ - Update jest packages [`af23b4f`](https://github.com/Immugio/three-math-extensions/commit/af23b4f08154bba3407f05b773865215e7e1cba8)
18
+ - Add Rectangle, update Polygon [`58ee875`](https://github.com/Immugio/three-math-extensions/commit/58ee87539af8f9ade186e5250cba9e01926da514)
19
+ - Documentation update [`905d178`](https://github.com/Immugio/three-math-extensions/commit/905d1787ed7ffffa370b77454222ee04e76f35b5)
20
+ - Documentation update [`70a5f24`](https://github.com/Immugio/three-math-extensions/commit/70a5f243f8af83da3ad5d30e223788cbd877b5f0)
21
+ - Add isPointInPolygon [`a59eb4b`](https://github.com/Immugio/three-math-extensions/commit/a59eb4be026f17a3106070ae626a0588cd4f4411)
22
+ - Packages update [`c2ef857`](https://github.com/Immugio/three-math-extensions/commit/c2ef857c01792e64c1558424fdd2f401f72720d0)
23
+ - Improve Line2D.closestPointToPoint, add Vec2.signedAngle [`151f214`](https://github.com/Immugio/three-math-extensions/commit/151f21462e0358057ad8e9d75d5782563a1061f6)
24
+ - Add Line2D.containsPoint, Line2D.covers, Improve Line2D.equals, Line2D.overlaps, add unit tests [`7b6daf7`](https://github.com/Immugio/three-math-extensions/commit/7b6daf7028303313b6937c16514838604d89515d)
25
+ - Add Line2D.getParallelLineInTheSameDirection [`d2e0846`](https://github.com/Immugio/three-math-extensions/commit/d2e0846024fbb29cf0a29bd5889f6e5c6811e4cb)
26
+ - Documentation update [`fc82582`](https://github.com/Immugio/three-math-extensions/commit/fc82582fa7d6042d51bf9ac5841cc94346211f3d)
27
+ - Improve documentation [`d0fcb51`](https://github.com/Immugio/three-math-extensions/commit/d0fcb5132f127b4382ac5f7291575a061b8ec121)
28
+ - Add isContinuousClosedShape, add Line2D.groupConnectedLines [`4ef8c2f`](https://github.com/Immugio/three-math-extensions/commit/4ef8c2fe83fdc71dd87fee4cbc478ddf0a086442)
29
+ - Vec3, Line3D - update documentation [`67d9c32`](https://github.com/Immugio/three-math-extensions/commit/67d9c328e08cc0a5599932d2f0529e97f31c9213)
30
+ - Add Polygon.containsPoint and Polygon.perimeter [`9bdf2dd`](https://github.com/Immugio/three-math-extensions/commit/9bdf2ddb5823878b5d41dadf14a225f7a1f0fd8f)
31
+ - Add Polygon [`629cff8`](https://github.com/Immugio/three-math-extensions/commit/629cff8ecbb963477e8ea76d7f8b16d95435cbad)
32
+ - Line3D.groupConnectedLines added [`29f372b`](https://github.com/Immugio/three-math-extensions/commit/29f372bc984c06b00c50fcd9428ce9a7b9cab799)
33
+ - Dependencies update and remove now duplicate Vec2.angleTo implementation [`4774abb`](https://github.com/Immugio/three-math-extensions/commit/4774abb81d882082df0da606c79a3c7bd3aecc57)
34
+ - Line2D.isCloserToHorizontal [`b6f1429`](https://github.com/Immugio/three-math-extensions/commit/b6f14292d1d2765f7314c45e4c74be91280ac764)
35
+ - Add Vec2.angleTo and tests [`dcf1e53`](https://github.com/Immugio/three-math-extensions/commit/dcf1e531aecf8c115f323e14e5e44059e5c5d15c)
36
+ - Add Vec2.signedAngle [`863c8f2`](https://github.com/Immugio/three-math-extensions/commit/863c8f27f11288cbda535e21bb688206259269ed)
37
+ - Add parallelism check to Line2D [`18064ee`](https://github.com/Immugio/three-math-extensions/commit/18064ee35a28e2c4d656f3dfb543b545044167dd)
38
+ - Add Vec2.fromPoints to accept multiple points [`a261402`](https://github.com/Immugio/three-math-extensions/commit/a2614027cf5fb8263189b48f7e0bb9a23a552c15)
39
+ - Add Vec2.parallelTo [`989874d`](https://github.com/Immugio/three-math-extensions/commit/989874dcfe122d3ee84d8d56d79cb88e4e441736)
40
+ - Line2D.intersect - enable line segments intersection only [`1f1470e`](https://github.com/Immugio/three-math-extensions/commit/1f1470e1cf00118e643f5c44a135e0baf6b76d41)
41
+ - Line3D.groupConnectedLines now supports line breaks [`417a9ea`](https://github.com/Immugio/three-math-extensions/commit/417a9ea471bf4c539f73f5fb170c962a78ee4ab4)
42
+ - Add Line2D.projectOn [`4c52c5c`](https://github.com/Immugio/three-math-extensions/commit/4c52c5c2e649fbddb72ce3fca60cfd3f1319f72f)
43
+ - Line2D.clipLines to support tolerances [`e397290`](https://github.com/Immugio/three-math-extensions/commit/e3972909339f01f0c018ad49e14b958d18e489e5)
44
+ - Add functionality for incrementing x, y, z coordinates [`b292dcc`](https://github.com/Immugio/three-math-extensions/commit/b292dcc4e8f7f0f2a63e1810c482d96ca6bebebe)
45
+ - Add Line3D.index [`7ed13d2`](https://github.com/Immugio/three-math-extensions/commit/7ed13d213748056c9dafd86288c3bcec9a28d1ba)
46
+ - Polygon from bounding size [`eae6701`](https://github.com/Immugio/three-math-extensions/commit/eae67012f57f426f8b5259b765000447ce06d608)
47
+ - Add Vec3.fromPoints [`62684d7`](https://github.com/Immugio/three-math-extensions/commit/62684d7f6dc1318d345ed74288bb6afd5394e1d3)
48
+ - Line2D and Line3D to return this instead of specific type [`761ef6a`](https://github.com/Immugio/three-math-extensions/commit/761ef6a9d8cc4e35120b666576794e521aa3b991)
49
+ - Line2D.in3DSpace added [`a6ce0ec`](https://github.com/Immugio/three-math-extensions/commit/a6ce0ecb67f5c7b2a75fcc283c28af626153a4af)
50
+ - Line3D.connectsTo added [`6d2cfa0`](https://github.com/Immugio/three-math-extensions/commit/6d2cfa0f5335c665f325a694a32c57b574ec326d)
51
+ - Line2D.hasIntersectionWithAngle to support optional tolerance [`b313bbe`](https://github.com/Immugio/three-math-extensions/commit/b313bbe118d435d53750deefd9a9e29ba6ec5c71)
52
+ - Line2D.hasIntersectionWithAngle - modulo all angles [`5409aa0`](https://github.com/Immugio/three-math-extensions/commit/5409aa0bc41510efa86d548e91837e44e5b6c343)
53
+ - Use Vec2 instead of Vector2 [`7e6a6ea`](https://github.com/Immugio/three-math-extensions/commit/7e6a6ea272f4441ef4bc78b3fdec23fc783fa1db)
54
+ - Update release instructions [`5b41a2e`](https://github.com/Immugio/three-math-extensions/commit/5b41a2ed7e15450dbb6088a7f7ed0031a013badc)
55
+ - Add Polygon to exports [`ed66775`](https://github.com/Immugio/three-math-extensions/commit/ed66775c33e961835b23843222b822cfd9c16b1d)
56
+ - Vec2.fromPoint and Vec3.fromPoint should accept null [`4b871af`](https://github.com/Immugio/three-math-extensions/commit/4b871af297bdcbe8584f1e2b99d602247b77687c)
57
+ - Add HalfPI [`7a6614c`](https://github.com/Immugio/three-math-extensions/commit/7a6614c3d6f59ac216e58986927112f94207a755)
58
+ - Dependencies update [`e8def7e`](https://github.com/Immugio/three-math-extensions/commit/e8def7e94575720cc25296681f844c4e53a9fc5c)
59
+ - Use double quotes [`c1f19db`](https://github.com/Immugio/three-math-extensions/commit/c1f19db2d0886a6ff5555bdbf353dfca20a70f0a)
60
+ - Documentation update [`d5c7a07`](https://github.com/Immugio/three-math-extensions/commit/d5c7a0765f6097f5d3a3be01967d4059f19682fb)
61
+ - Excluded files from build [`ec70614`](https://github.com/Immugio/three-math-extensions/commit/ec70614bc7df7a98f854c7a6693365118e04faf7)
62
+ - Correct test file extension [`91b5e2a`](https://github.com/Immugio/three-math-extensions/commit/91b5e2ad338e8404704381a36813dcce5f00d978)
63
+
64
+ ## [16.15.10](https://github.com/Immugio/three-math-extensions/compare/0.2.24...16.15.10) - 2023-01-02
65
+
66
+ ## [0.2.24](https://github.com/Immugio/three-math-extensions/compare/0.2.23...0.2.24) - 2024-05-10
67
+
68
+ ### Commits
69
+
70
+ - Add Polygon.containsPoint and Polygon.perimeter [`9bdf2dd`](https://github.com/Immugio/three-math-extensions/commit/9bdf2ddb5823878b5d41dadf14a225f7a1f0fd8f)
71
+
72
+ ## [0.2.23](https://github.com/Immugio/three-math-extensions/compare/0.2.22...0.2.23) - 2024-04-16
11
73
 
12
74
  ### Commits
13
75
 
@@ -135,7 +197,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
135
197
  - Improve documentation [`d0fcb51`](https://github.com/Immugio/three-math-extensions/commit/d0fcb5132f127b4382ac5f7291575a061b8ec121)
136
198
  - Excluded files from build [`ec70614`](https://github.com/Immugio/three-math-extensions/commit/ec70614bc7df7a98f854c7a6693365118e04faf7)
137
199
 
138
- ## [0.2.5](https://github.com/Immugio/three-math-extensions/compare/0.2.2...0.2.5) - 2023-04-11
200
+ ## [0.2.5](https://github.com/Immugio/three-math-extensions/compare/0.2.4...0.2.5) - 2023-04-11
201
+
202
+ ## [0.2.4](https://github.com/Immugio/three-math-extensions/compare/0.2.3...0.2.4) - 2023-04-11
203
+
204
+ ## [0.2.3](https://github.com/Immugio/three-math-extensions/compare/0.2.2...0.2.3) - 2023-04-11
139
205
 
140
206
  ### Commits
141
207
 
@@ -245,15 +311,62 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
245
311
 
246
312
  ## [0.0.7](https://github.com/Immugio/three-math-extensions/compare/0.0.6...0.0.7) - 2022-11-21
247
313
 
248
- ## [0.0.6](https://github.com/Immugio/three-math-extensions/compare/0.0.4...0.0.6) - 2022-11-24
314
+ ## [0.0.6](https://github.com/Immugio/three-math-extensions/compare/0.0.5...0.0.6) - 2022-11-24
315
+
316
+ ## [0.0.5](https://github.com/Immugio/three-math-extensions/compare/0.0.4...0.0.5) - 2023-09-01
249
317
 
250
318
  ### Commits
251
319
 
320
+ - Generate documentation using TSDoc [`304c3a8`](https://github.com/Immugio/three-math-extensions/commit/304c3a84b5dcc49183db57083f550d134ae641b2)
321
+ - Add eslint [`98e4912`](https://github.com/Immugio/three-math-extensions/commit/98e4912d637b42ba80e2f3267638b43296113019)
322
+ - Update jest packages [`af23b4f`](https://github.com/Immugio/three-math-extensions/commit/af23b4f08154bba3407f05b773865215e7e1cba8)
323
+ - Add Rectangle, update Polygon [`58ee875`](https://github.com/Immugio/three-math-extensions/commit/58ee87539af8f9ade186e5250cba9e01926da514)
324
+ - Add isPointInPolygon [`a59eb4b`](https://github.com/Immugio/three-math-extensions/commit/a59eb4be026f17a3106070ae626a0588cd4f4411)
325
+ - Improve Line2D.closestPointToPoint, add Vec2.signedAngle [`151f214`](https://github.com/Immugio/three-math-extensions/commit/151f21462e0358057ad8e9d75d5782563a1061f6)
326
+ - Improve documentation [`d0fcb51`](https://github.com/Immugio/three-math-extensions/commit/d0fcb5132f127b4382ac5f7291575a061b8ec121)
327
+ - Vec3, Line3D - update documentation [`67d9c32`](https://github.com/Immugio/three-math-extensions/commit/67d9c328e08cc0a5599932d2f0529e97f31c9213)
328
+ - Add Polygon [`629cff8`](https://github.com/Immugio/three-math-extensions/commit/629cff8ecbb963477e8ea76d7f8b16d95435cbad)
252
329
  - Improve API, minor bug fix, improve test coverage [`881a5f0`](https://github.com/Immugio/three-math-extensions/commit/881a5f096823f0d5fd90faa76cd602f076291bc5)
330
+ - Line3D.groupConnectedLines added [`29f372b`](https://github.com/Immugio/three-math-extensions/commit/29f372bc984c06b00c50fcd9428ce9a7b9cab799)
331
+ - Dependencies update and remove now duplicate Vec2.angleTo implementation [`4774abb`](https://github.com/Immugio/three-math-extensions/commit/4774abb81d882082df0da606c79a3c7bd3aecc57)
332
+ - Line2D.isCloserToHorizontal [`b6f1429`](https://github.com/Immugio/three-math-extensions/commit/b6f14292d1d2765f7314c45e4c74be91280ac764)
333
+ - Add Vec2.angleTo and tests [`dcf1e53`](https://github.com/Immugio/three-math-extensions/commit/dcf1e531aecf8c115f323e14e5e44059e5c5d15c)
334
+ - Add Vec2.signedAngle [`863c8f2`](https://github.com/Immugio/three-math-extensions/commit/863c8f27f11288cbda535e21bb688206259269ed)
335
+ - Add intersect method to Line3D [`6fe47de`](https://github.com/Immugio/three-math-extensions/commit/6fe47de7caaa1807b47a4363e551510c463757d7)
336
+ - Add Line2D.extendToOrTrimAtIntersection [`ab82a36`](https://github.com/Immugio/three-math-extensions/commit/ab82a36db52b9ae83cf8bfb848362d295140d073)
337
+ - Add Vec2.fromPoints to accept multiple points [`a261402`](https://github.com/Immugio/three-math-extensions/commit/a2614027cf5fb8263189b48f7e0bb9a23a552c15)
338
+ - Improve documentation for Vec2 and Vec3 [`6a2373d`](https://github.com/Immugio/three-math-extensions/commit/6a2373d8b6754a87720dcaea5d98336bfa7bc5b5)
339
+ - Add Vec2.parallelTo [`989874d`](https://github.com/Immugio/three-math-extensions/commit/989874dcfe122d3ee84d8d56d79cb88e4e441736)
340
+ - Line2D.intersect - enable line segments intersection only [`1f1470e`](https://github.com/Immugio/three-math-extensions/commit/1f1470e1cf00118e643f5c44a135e0baf6b76d41)
341
+ - Line3D.groupConnectedLines now supports line breaks [`417a9ea`](https://github.com/Immugio/three-math-extensions/commit/417a9ea471bf4c539f73f5fb170c962a78ee4ab4)
342
+ - Add Line2D.projectOn [`4c52c5c`](https://github.com/Immugio/three-math-extensions/commit/4c52c5c2e649fbddb72ce3fca60cfd3f1319f72f)
343
+ - Added "isNear" to Vec2 & Vec3 as a shorthand for distanceTo <= maxDistance [`a27cff8`](https://github.com/Immugio/three-math-extensions/commit/a27cff8421472f625ed240439b9e6a7d2c430db8)
344
+ - Add Line3D.index [`7ed13d2`](https://github.com/Immugio/three-math-extensions/commit/7ed13d213748056c9dafd86288c3bcec9a28d1ba)
253
345
  - Add .npmignore [`f58329a`](https://github.com/Immugio/three-math-extensions/commit/f58329a86b96589bb574d6ebed37d4cc4474663a)
346
+ - Polygon from bounding size [`eae6701`](https://github.com/Immugio/three-math-extensions/commit/eae67012f57f426f8b5259b765000447ce06d608)
347
+ - Add Vec2 documentation [`f625e66`](https://github.com/Immugio/three-math-extensions/commit/f625e66b60ee0d90c5c788a80989f64013d60265)
348
+ - Clean up documentation [`70c8d5e`](https://github.com/Immugio/three-math-extensions/commit/70c8d5efe8b7095d7a03af637df3af5d46615293)
349
+ - Line2D and Line3D to return this instead of specific type [`761ef6a`](https://github.com/Immugio/three-math-extensions/commit/761ef6a9d8cc4e35120b666576794e521aa3b991)
350
+ - Line2D.in3DSpace added [`a6ce0ec`](https://github.com/Immugio/three-math-extensions/commit/a6ce0ecb67f5c7b2a75fcc283c28af626153a4af)
351
+ - Line3D.connectsTo added [`6d2cfa0`](https://github.com/Immugio/three-math-extensions/commit/6d2cfa0f5335c665f325a694a32c57b574ec326d)
352
+ - Line2D.hasIntersectionWithAngle to support optional tolerance [`b313bbe`](https://github.com/Immugio/three-math-extensions/commit/b313bbe118d435d53750deefd9a9e29ba6ec5c71)
353
+ - Add Vec2.moveTowards [`b46ba12`](https://github.com/Immugio/three-math-extensions/commit/b46ba1286f9924cd9bfecfb37200664202e964ba)
354
+ - Line2D.hasIntersectionWithAngle - modulo all angles [`5409aa0`](https://github.com/Immugio/three-math-extensions/commit/5409aa0bc41510efa86d548e91837e44e5b6c343)
355
+ - Use Vec2 instead of Vector2 [`7e6a6ea`](https://github.com/Immugio/three-math-extensions/commit/7e6a6ea272f4441ef4bc78b3fdec23fc783fa1db)
356
+ - Add release instructions into README.md [`03653b1`](https://github.com/Immugio/three-math-extensions/commit/03653b1ffa55be606d3f9cd588e28a6084462c2e)
357
+ - Documentation improvements [`160db8b`](https://github.com/Immugio/three-math-extensions/commit/160db8ba6d6e5eb63a4e91ed9c40efd6fa70181a)
358
+ - Update release instructions [`5b41a2e`](https://github.com/Immugio/three-math-extensions/commit/5b41a2ed7e15450dbb6088a7f7ed0031a013badc)
359
+ - Add Polygon to exports [`ed66775`](https://github.com/Immugio/three-math-extensions/commit/ed66775c33e961835b23843222b822cfd9c16b1d)
360
+ - Vec2.fromPoint and Vec3.fromPoint should accept null [`4b871af`](https://github.com/Immugio/three-math-extensions/commit/4b871af297bdcbe8584f1e2b99d602247b77687c)
361
+ - Documentation improvements [`2f3e676`](https://github.com/Immugio/three-math-extensions/commit/2f3e6768b3b0139b60688fc151a4084f15566f8d)
362
+ - Documentation update [`d5c7a07`](https://github.com/Immugio/three-math-extensions/commit/d5c7a0765f6097f5d3a3be01967d4059f19682fb)
363
+ - Fix peer dependency version [`00dd116`](https://github.com/Immugio/three-math-extensions/commit/00dd1169f578d5769207031fa625f29c96a38c31)
364
+ - Add Line2D.extendToOrTrimAtIntersection [`b22aa12`](https://github.com/Immugio/three-math-extensions/commit/b22aa120b5eb02562cebc4573374ebb61e2dba14)
254
365
  - Correct change log version [`c6244bf`](https://github.com/Immugio/three-math-extensions/commit/c6244bf1488ad21bcc5589d1dff62c41d8182d48)
255
366
  - Release 0.0.4 - tag pattern 6 [`c1c5454`](https://github.com/Immugio/three-math-extensions/commit/c1c54541ed400e1ad49bf42fe8926cd5293efefd)
256
367
  - Release 0.0.4 - tag pattern 5 [`5245eed`](https://github.com/Immugio/three-math-extensions/commit/5245eed60195103e989c0fadf9bd642f39ef4589)
368
+ - Excluded files from build [`ec70614`](https://github.com/Immugio/three-math-extensions/commit/ec70614bc7df7a98f854c7a6693365118e04faf7)
369
+ - Revert npm ignore [`590b26a`](https://github.com/Immugio/three-math-extensions/commit/590b26a9e57fc41466b51e711f3f5c648e2d56ed)
257
370
 
258
371
  ## 0.0.4 - 2022-11-21
259
372
 
package/cjs/Line2D.js CHANGED
@@ -460,7 +460,7 @@ class Line2D {
460
460
  * @param source
461
461
  * @param clips
462
462
  */
463
- static clipLines(source, clips) {
463
+ static clipLines(source, clips, distanceTolerance = 0, parallelTolerance = 0) {
464
464
  if (!clips || clips.length === 0)
465
465
  return [source];
466
466
  clips = clips.map(c => {
@@ -476,7 +476,7 @@ class Line2D {
476
476
  let isFree = true;
477
477
  const tested = sources.pop();
478
478
  for (const cover of clips) {
479
- if (tested.overlaps(cover)) {
479
+ if (tested.overlaps(cover, distanceTolerance, parallelTolerance)) {
480
480
  isFree = false;
481
481
  const subtracted = this.subtractSingle(tested, cover);
482
482
  sources.push(...subtracted);
package/cjs/Polygon.js CHANGED
@@ -4,6 +4,8 @@ exports.Polygon = void 0;
4
4
  const Vec2_1 = require("./Vec2");
5
5
  const Rectangle_1 = require("./Rectangle");
6
6
  const BoundingBox_1 = require("./BoundingBox");
7
+ const polygonPerimeter_1 = require("./polygonPerimeter");
8
+ const isPointInPolygon_1 = require("./isPointInPolygon");
7
9
  class Polygon {
8
10
  contour;
9
11
  holes;
@@ -87,6 +89,12 @@ class Polygon {
87
89
  this.holes?.forEach(hole => this.flipSingle(centerX, hole));
88
90
  return this;
89
91
  }
92
+ perimeter() {
93
+ return (0, polygonPerimeter_1.polygonPerimeter)(this.contour);
94
+ }
95
+ containsPoint(point) {
96
+ return (0, isPointInPolygon_1.isPointInPolygon)(this.contour, point) && (this.holes || []).every(hole => !(0, isPointInPolygon_1.isPointInPolygon)(hole, point));
97
+ }
90
98
  flipSingle(centerX, poly) {
91
99
  for (const point of poly) {
92
100
  const xDistanceToCenter = Math.abs(centerX - point.x);
package/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isContinuousClosedShape = exports.directions2d = exports.directions = exports.isPointInPolygon = exports.HalfPI = exports.TwoPI = exports.normalizeAngleRadians = exports.normalizeAngleDegrees = exports.Rectangle = exports.BoundingBox = exports.Polygon = exports.Size2 = exports.Line3D = exports.Line2D = exports.Vec3 = exports.Vec2 = void 0;
3
+ exports.polygonPerimeter = exports.isContinuousClosedShape = exports.directions2d = exports.directions = exports.isPointInPolygon = exports.HalfPI = exports.TwoPI = exports.normalizeAngleRadians = exports.normalizeAngleDegrees = exports.Rectangle = exports.BoundingBox = exports.Polygon = exports.Size2 = exports.Line3D = exports.Line2D = exports.Vec3 = exports.Vec2 = void 0;
4
4
  var Vec2_1 = require("./Vec2");
5
5
  Object.defineProperty(exports, "Vec2", { enumerable: true, get: function () { return Vec2_1.Vec2; } });
6
6
  var Vec3_1 = require("./Vec3");
@@ -32,3 +32,5 @@ var directions2d_1 = require("./directions2d");
32
32
  Object.defineProperty(exports, "directions2d", { enumerable: true, get: function () { return directions2d_1.directions2d; } });
33
33
  var isContinuousClosedShape_1 = require("./isContinuousClosedShape");
34
34
  Object.defineProperty(exports, "isContinuousClosedShape", { enumerable: true, get: function () { return isContinuousClosedShape_1.isContinuousClosedShape; } });
35
+ var polygonPerimeter_1 = require("./polygonPerimeter");
36
+ Object.defineProperty(exports, "polygonPerimeter", { enumerable: true, get: function () { return polygonPerimeter_1.polygonPerimeter; } });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.polygonPerimeter = void 0;
4
+ function polygonPerimeter(polygon, forceClosedPolygon = false) {
5
+ if (forceClosedPolygon && !polygon[0].equals(polygon.at(-1))) {
6
+ polygon = [...polygon];
7
+ polygon.push(polygon[0].clone());
8
+ }
9
+ let length = 0;
10
+ for (let i = 0; i < polygon.length - 1; i++) {
11
+ length += polygon[i].distanceTo(polygon[i + 1]);
12
+ }
13
+ return length;
14
+ }
15
+ exports.polygonPerimeter = polygonPerimeter;
@@ -44,7 +44,7 @@
44
44
 
45
45
  #### Defined in
46
46
 
47
- [src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/336678b/src/BoundingBox.ts#L4)
47
+ [src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/e397290/src/BoundingBox.ts#L4)
48
48
 
49
49
  ## Properties
50
50
 
@@ -54,7 +54,7 @@
54
54
 
55
55
  #### Defined in
56
56
 
57
- [src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/336678b/src/BoundingBox.ts#L4)
57
+ [src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/e397290/src/BoundingBox.ts#L4)
58
58
 
59
59
  ___
60
60
 
@@ -64,7 +64,7 @@ ___
64
64
 
65
65
  #### Defined in
66
66
 
67
- [src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/336678b/src/BoundingBox.ts#L4)
67
+ [src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/e397290/src/BoundingBox.ts#L4)
68
68
 
69
69
  ___
70
70
 
@@ -74,7 +74,7 @@ ___
74
74
 
75
75
  #### Defined in
76
76
 
77
- [src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/336678b/src/BoundingBox.ts#L4)
77
+ [src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/e397290/src/BoundingBox.ts#L4)
78
78
 
79
79
  ___
80
80
 
@@ -84,7 +84,7 @@ ___
84
84
 
85
85
  #### Defined in
86
86
 
87
- [src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/336678b/src/BoundingBox.ts#L4)
87
+ [src/BoundingBox.ts:4](https://github.com/Immugio/three-math-extensions/blob/e397290/src/BoundingBox.ts#L4)
88
88
 
89
89
  ## Accessors
90
90
 
@@ -98,7 +98,7 @@ ___
98
98
 
99
99
  #### Defined in
100
100
 
101
- [src/BoundingBox.ts:11](https://github.com/Immugio/three-math-extensions/blob/336678b/src/BoundingBox.ts#L11)
101
+ [src/BoundingBox.ts:11](https://github.com/Immugio/three-math-extensions/blob/e397290/src/BoundingBox.ts#L11)
102
102
 
103
103
  ## Methods
104
104
 
@@ -118,4 +118,4 @@ ___
118
118
 
119
119
  #### Defined in
120
120
 
121
- [src/BoundingBox.ts:7](https://github.com/Immugio/three-math-extensions/blob/336678b/src/BoundingBox.ts#L7)
121
+ [src/BoundingBox.ts:7](https://github.com/Immugio/three-math-extensions/blob/e397290/src/BoundingBox.ts#L7)