@immugio/three-math-extensions 0.2.26 → 0.2.27
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 +9 -2
- package/cjs/Polygon.js +5 -0
- package/esm/Polygon.js +5 -0
- package/package.json +1 -1
- package/src/Polygon.ts +6 -0
- package/types/Polygon.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,7 @@ 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.27](https://github.com/Immugio/three-math-extensions/compare/16.15.10...0.2.27)
|
|
11
11
|
|
|
12
12
|
### Commits
|
|
13
13
|
|
|
@@ -36,6 +36,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
36
36
|
- Add Vec2.signedAngle [`863c8f2`](https://github.com/Immugio/three-math-extensions/commit/863c8f27f11288cbda535e21bb688206259269ed)
|
|
37
37
|
- Add parallelism check to Line2D [`18064ee`](https://github.com/Immugio/three-math-extensions/commit/18064ee35a28e2c4d656f3dfb543b545044167dd)
|
|
38
38
|
- Add Vec2.fromPoints to accept multiple points [`a261402`](https://github.com/Immugio/three-math-extensions/commit/a2614027cf5fb8263189b48f7e0bb9a23a552c15)
|
|
39
|
+
- Add Polygon.rotate [`4f2d581`](https://github.com/Immugio/three-math-extensions/commit/4f2d5814cdb3df067ab0a0cefcdfdb7a71696312)
|
|
39
40
|
- Add Vec2.parallelTo [`989874d`](https://github.com/Immugio/three-math-extensions/commit/989874dcfe122d3ee84d8d56d79cb88e4e441736)
|
|
40
41
|
- Line2D.intersect - enable line segments intersection only [`1f1470e`](https://github.com/Immugio/three-math-extensions/commit/1f1470e1cf00118e643f5c44a135e0baf6b76d41)
|
|
41
42
|
- Add Polygon.translate [`a77136a`](https://github.com/Immugio/three-math-extensions/commit/a77136aea1c2dbdbba725c14ba0bc2115ae56ffc)
|
|
@@ -62,7 +63,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
62
63
|
- Excluded files from build [`ec70614`](https://github.com/Immugio/three-math-extensions/commit/ec70614bc7df7a98f854c7a6693365118e04faf7)
|
|
63
64
|
- Correct test file extension [`91b5e2a`](https://github.com/Immugio/three-math-extensions/commit/91b5e2ad338e8404704381a36813dcce5f00d978)
|
|
64
65
|
|
|
65
|
-
## [16.15.10](https://github.com/Immugio/three-math-extensions/compare/0.2.
|
|
66
|
+
## [16.15.10](https://github.com/Immugio/three-math-extensions/compare/0.2.26...16.15.10) - 2023-01-02
|
|
67
|
+
|
|
68
|
+
## [0.2.26](https://github.com/Immugio/three-math-extensions/compare/0.2.25...0.2.26) - 2024-09-06
|
|
69
|
+
|
|
70
|
+
### Commits
|
|
71
|
+
|
|
72
|
+
- Add Polygon.translate [`a77136a`](https://github.com/Immugio/three-math-extensions/commit/a77136aea1c2dbdbba725c14ba0bc2115ae56ffc)
|
|
66
73
|
|
|
67
74
|
## [0.2.25](https://github.com/Immugio/three-math-extensions/compare/0.2.24...0.2.25) - 2024-07-11
|
|
68
75
|
|
package/cjs/Polygon.js
CHANGED
|
@@ -106,6 +106,11 @@ class Polygon {
|
|
|
106
106
|
this.holes?.forEach(hole => hole.forEach(p => p.add(translate)));
|
|
107
107
|
return this;
|
|
108
108
|
}
|
|
109
|
+
rotate(angle, center = this.center()) {
|
|
110
|
+
this.contour.forEach(p => p.rotateAround(center, angle));
|
|
111
|
+
this.holes?.forEach(hole => hole.forEach(p => p.rotateAround(center, angle)));
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
109
114
|
toRectangle() {
|
|
110
115
|
const bounding = this.boundingBox();
|
|
111
116
|
return new Rectangle_1.Rectangle(bounding.minX, bounding.maxX, bounding.minY, bounding.maxY);
|
package/esm/Polygon.js
CHANGED
|
@@ -103,6 +103,11 @@ export class Polygon {
|
|
|
103
103
|
this.holes?.forEach(hole => hole.forEach(p => p.add(translate)));
|
|
104
104
|
return this;
|
|
105
105
|
}
|
|
106
|
+
rotate(angle, center = this.center()) {
|
|
107
|
+
this.contour.forEach(p => p.rotateAround(center, angle));
|
|
108
|
+
this.holes?.forEach(hole => hole.forEach(p => p.rotateAround(center, angle)));
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
106
111
|
toRectangle() {
|
|
107
112
|
const bounding = this.boundingBox();
|
|
108
113
|
return new Rectangle(bounding.minX, bounding.maxX, bounding.minY, bounding.maxY);
|
package/package.json
CHANGED
package/src/Polygon.ts
CHANGED
|
@@ -123,6 +123,12 @@ export class Polygon {
|
|
|
123
123
|
return this;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
public rotate(angle: number, center = this.center()): this {
|
|
127
|
+
this.contour.forEach(p => p.rotateAround(center, angle));
|
|
128
|
+
this.holes?.forEach(hole => hole.forEach(p => p.rotateAround(center, angle)));
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
|
|
126
132
|
public toRectangle(): Rectangle {
|
|
127
133
|
const bounding = this.boundingBox();
|
|
128
134
|
return new Rectangle(bounding.minX, bounding.maxX, bounding.minY, bounding.maxY);
|
package/types/Polygon.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare class Polygon {
|
|
|
19
19
|
containsPoint(point: Vec2): boolean;
|
|
20
20
|
private flipSingle;
|
|
21
21
|
translate(translate: Vec2): this;
|
|
22
|
+
rotate(angle: number, center?: Vec2): this;
|
|
22
23
|
toRectangle(): Rectangle;
|
|
23
24
|
clone(): Polygon;
|
|
24
25
|
equals(other: Polygon): boolean;
|