@immugio/three-math-extensions 0.3.6 → 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 CHANGED
@@ -7,7 +7,13 @@ 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.3.6](https://github.com/Immugio/three-math-extensions/compare/0.3.5...0.3.6)
10
+ ## [0.3.7](https://github.com/Immugio/three-math-extensions/compare/0.3.6...0.3.7)
11
+
12
+ ### Commits
13
+
14
+ - Polygon - Account for empty contour when calculating bounding box [`56bb6a9`](https://github.com/Immugio/three-math-extensions/commit/56bb6a9577eea00b756779aa2a78688b3bb1f2b8)
15
+
16
+ ## [0.3.6](https://github.com/Immugio/three-math-extensions/compare/0.3.5...0.3.6) - 2026-01-13
11
17
 
12
18
  ### Commits
13
19
 
package/cjs/Polygon.js CHANGED
@@ -80,6 +80,9 @@ class Polygon {
80
80
  return (0, getPolygonArea_1.getPolygonArea)(this.contour);
81
81
  }
82
82
  boundingBox() {
83
+ if (!this.contour.length) {
84
+ return new BoundingBox_1.BoundingBox(0, 0, 0, 0);
85
+ }
83
86
  let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
84
87
  for (const p of this.contour) {
85
88
  if (minX > p.x)
package/esm/Polygon.js CHANGED
@@ -77,6 +77,9 @@ export class Polygon {
77
77
  return getPolygonArea(this.contour);
78
78
  }
79
79
  boundingBox() {
80
+ if (!this.contour.length) {
81
+ return new BoundingBox(0, 0, 0, 0);
82
+ }
80
83
  let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
81
84
  for (const p of this.contour) {
82
85
  if (minX > p.x)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@immugio/three-math-extensions",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Set of utilities for 2d and 3d line math built on top of three.js",
5
5
  "author": "Jan Mikeska <janmikeska@gmail.com>",
6
6
  "license": "ISC",
package/src/Polygon.ts CHANGED
@@ -97,6 +97,10 @@ export class Polygon {
97
97
  }
98
98
 
99
99
  public boundingBox(): BoundingBox {
100
+ if (!this.contour.length) {
101
+ return new BoundingBox(0, 0, 0, 0);
102
+ }
103
+
100
104
  let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
101
105
 
102
106
  for (const p of this.contour) {