@immugio/three-math-extensions 0.2.15 → 0.2.16

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,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.15](https://github.com/Immugio/three-math-extensions/compare/16.15.10...0.2.15)
10
+ ## [0.2.16](https://github.com/Immugio/three-math-extensions/compare/16.15.10...0.2.16)
11
11
 
12
12
  ### Commits
13
13
 
@@ -31,6 +31,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
31
31
  - Line2D.intersect - enable line segments intersection only [`1f1470e`](https://github.com/Immugio/three-math-extensions/commit/1f1470e1cf00118e643f5c44a135e0baf6b76d41)
32
32
  - Line3D.groupConnectedLines now supports line breaks [`417a9ea`](https://github.com/Immugio/three-math-extensions/commit/417a9ea471bf4c539f73f5fb170c962a78ee4ab4)
33
33
  - Add Line2D.projectOn [`4c52c5c`](https://github.com/Immugio/three-math-extensions/commit/4c52c5c2e649fbddb72ce3fca60cfd3f1319f72f)
34
+ - Add functionality for incrementing x, y, z coordinates [`b292dcc`](https://github.com/Immugio/three-math-extensions/commit/b292dcc4e8f7f0f2a63e1810c482d96ca6bebebe)
34
35
  - Add Line3D.index [`7ed13d2`](https://github.com/Immugio/three-math-extensions/commit/7ed13d213748056c9dafd86288c3bcec9a28d1ba)
35
36
  - Polygon from bounding size [`eae6701`](https://github.com/Immugio/three-math-extensions/commit/eae67012f57f426f8b5259b765000447ce06d608)
36
37
  - Line2D and Line3D to return this instead of specific type [`761ef6a`](https://github.com/Immugio/three-math-extensions/commit/761ef6a9d8cc4e35120b666576794e521aa3b991)
@@ -43,10 +44,19 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
43
44
  - Add Polygon to exports [`ed66775`](https://github.com/Immugio/three-math-extensions/commit/ed66775c33e961835b23843222b822cfd9c16b1d)
44
45
  - Vec2.fromPoint and Vec3.fromPoint should accept null [`4b871af`](https://github.com/Immugio/three-math-extensions/commit/4b871af297bdcbe8584f1e2b99d602247b77687c)
45
46
  - Add HalfPI [`7a6614c`](https://github.com/Immugio/three-math-extensions/commit/7a6614c3d6f59ac216e58986927112f94207a755)
47
+ - Use double quotes [`c1f19db`](https://github.com/Immugio/three-math-extensions/commit/c1f19db2d0886a6ff5555bdbf353dfca20a70f0a)
46
48
  - Documentation update [`d5c7a07`](https://github.com/Immugio/three-math-extensions/commit/d5c7a0765f6097f5d3a3be01967d4059f19682fb)
47
49
  - Excluded files from build [`ec70614`](https://github.com/Immugio/three-math-extensions/commit/ec70614bc7df7a98f854c7a6693365118e04faf7)
48
50
 
49
- ## [16.15.10](https://github.com/Immugio/three-math-extensions/compare/0.2.14...16.15.10) - 2023-01-02
51
+ ## [16.15.10](https://github.com/Immugio/three-math-extensions/compare/0.2.15...16.15.10) - 2023-01-02
52
+
53
+ ## [0.2.15](https://github.com/Immugio/three-math-extensions/compare/0.2.14...0.2.15) - 2023-10-12
54
+
55
+ ### Commits
56
+
57
+ - Packages update [`0d85b39`](https://github.com/Immugio/three-math-extensions/commit/0d85b392029f7bbaa5063cd0494e34f593d62ea5)
58
+ - Add isContinuousClosedShape, add Line2D.groupConnectedLines [`4ef8c2f`](https://github.com/Immugio/three-math-extensions/commit/4ef8c2fe83fdc71dd87fee4cbc478ddf0a086442)
59
+ - Add HalfPI [`7a6614c`](https://github.com/Immugio/three-math-extensions/commit/7a6614c3d6f59ac216e58986927112f94207a755)
50
60
 
51
61
  ## [0.2.14](https://github.com/Immugio/three-math-extensions/compare/0.2.13...0.2.14) - 2023-08-31
52
62
 
package/cjs/Vec2.js CHANGED
@@ -34,6 +34,22 @@ class Vec2 extends three_1.Vector2 {
34
34
  this.add(move);
35
35
  return this;
36
36
  }
37
+ /**
38
+ * Adds y amount to this Vec3 instance and return this
39
+ * @param y
40
+ */
41
+ addY(y) {
42
+ this.y += y;
43
+ return this;
44
+ }
45
+ /**
46
+ * Adds x amount to this Vec3 instance and return this
47
+ * @param x
48
+ */
49
+ addX(x) {
50
+ this.x += x;
51
+ return this;
52
+ }
37
53
  /**
38
54
  * Rounds the x and y values of this Vec2 instance if they are close to an integer value.
39
55
  * @param max - The maximum difference between the value and the nearest integer.
package/cjs/Vec3.js CHANGED
@@ -57,6 +57,14 @@ class Vec3 extends three_1.Vector3 {
57
57
  this.x += x;
58
58
  return this;
59
59
  }
60
+ /**
61
+ * Adds z amount to this Vec3 instance and return this
62
+ * @param z
63
+ */
64
+ addZ(z) {
65
+ this.z += z;
66
+ return this;
67
+ }
60
68
  /**
61
69
  * Returns a clone of the point closest to this from the given points.
62
70
  * @param points
package/esm/Vec2.js CHANGED
@@ -31,6 +31,22 @@ export class Vec2 extends Vector2 {
31
31
  this.add(move);
32
32
  return this;
33
33
  }
34
+ /**
35
+ * Adds y amount to this Vec3 instance and return this
36
+ * @param y
37
+ */
38
+ addY(y) {
39
+ this.y += y;
40
+ return this;
41
+ }
42
+ /**
43
+ * Adds x amount to this Vec3 instance and return this
44
+ * @param x
45
+ */
46
+ addX(x) {
47
+ this.x += x;
48
+ return this;
49
+ }
34
50
  /**
35
51
  * Rounds the x and y values of this Vec2 instance if they are close to an integer value.
36
52
  * @param max - The maximum difference between the value and the nearest integer.
package/esm/Vec3.js CHANGED
@@ -54,6 +54,14 @@ export class Vec3 extends Vector3 {
54
54
  this.x += x;
55
55
  return this;
56
56
  }
57
+ /**
58
+ * Adds z amount to this Vec3 instance and return this
59
+ * @param z
60
+ */
61
+ addZ(z) {
62
+ this.z += z;
63
+ return this;
64
+ }
57
65
  /**
58
66
  * Returns a clone of the point closest to this from the given points.
59
67
  * @param points
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@immugio/three-math-extensions",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
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/Vec2.ts CHANGED
@@ -31,12 +31,30 @@ export class Vec2 extends Vector2 {
31
31
  * @param amount - The distance to move.
32
32
  * @returns This Vec2 instance.
33
33
  */
34
- public moveTowards(target: Vector2, amount: number): Vec2 {
34
+ public moveTowards(target: Vector2, amount: number): this {
35
35
  const move = target.clone().sub(this).normalize().multiplyScalar(amount);
36
36
  this.add(move);
37
37
  return this;
38
38
  }
39
39
 
40
+ /**
41
+ * Adds y amount to this Vec3 instance and return this
42
+ * @param y
43
+ */
44
+ public addY(y: number): this {
45
+ this.y += y;
46
+ return this;
47
+ }
48
+
49
+ /**
50
+ * Adds x amount to this Vec3 instance and return this
51
+ * @param x
52
+ */
53
+ public addX(x: number): this {
54
+ this.x += x;
55
+ return this;
56
+ }
57
+
40
58
  /**
41
59
  * Rounds the x and y values of this Vec2 instance if they are close to an integer value.
42
60
  * @param max - The maximum difference between the value and the nearest integer.
package/src/Vec3.ts CHANGED
@@ -24,7 +24,7 @@ export class Vec3 extends Vector3 {
24
24
  * @param amount - The distance to move.
25
25
  * @returns This Vec3 instance.
26
26
  */
27
- public moveTowards(target: Vector3, amount: number): Vec3 {
27
+ public moveTowards(target: Vector3, amount: number): this {
28
28
  if (this.#target === undefined) {
29
29
  this.#target = new Vector3();
30
30
  }
@@ -40,7 +40,7 @@ export class Vec3 extends Vector3 {
40
40
  * @param target - The target Vec3.
41
41
  * @returns This Vec3 instance.
42
42
  */
43
- public moveHalfWayTowards(target: Vector3): Vec3 {
43
+ public moveHalfWayTowards(target: Vector3): this {
44
44
  if (this.#target === undefined) {
45
45
  this.#target = new Vector3();
46
46
  }
@@ -53,7 +53,7 @@ export class Vec3 extends Vector3 {
53
53
  * Adds y amount to this Vec3 instance and return this
54
54
  * @param y
55
55
  */
56
- public addY(y: number): Vec3 {
56
+ public addY(y: number): this {
57
57
  this.y += y;
58
58
  return this;
59
59
  }
@@ -62,11 +62,20 @@ export class Vec3 extends Vector3 {
62
62
  * Adds x amount to this Vec3 instance and return this
63
63
  * @param x
64
64
  */
65
- public addX(x: number): Vec3 {
65
+ public addX(x: number): this {
66
66
  this.x += x;
67
67
  return this;
68
68
  }
69
69
 
70
+ /**
71
+ * Adds z amount to this Vec3 instance and return this
72
+ * @param z
73
+ */
74
+ public addZ(z: number): this {
75
+ this.z += z;
76
+ return this;
77
+ }
78
+
70
79
  /**
71
80
  * Returns a clone of the point closest to this from the given points.
72
81
  * @param points
package/types/Vec2.d.ts CHANGED
@@ -22,7 +22,17 @@ export declare class Vec2 extends Vector2 {
22
22
  * @param amount - The distance to move.
23
23
  * @returns This Vec2 instance.
24
24
  */
25
- moveTowards(target: Vector2, amount: number): Vec2;
25
+ moveTowards(target: Vector2, amount: number): this;
26
+ /**
27
+ * Adds y amount to this Vec3 instance and return this
28
+ * @param y
29
+ */
30
+ addY(y: number): this;
31
+ /**
32
+ * Adds x amount to this Vec3 instance and return this
33
+ * @param x
34
+ */
35
+ addX(x: number): this;
26
36
  /**
27
37
  * Rounds the x and y values of this Vec2 instance if they are close to an integer value.
28
38
  * @param max - The maximum difference between the value and the nearest integer.
package/types/Vec3.d.ts CHANGED
@@ -18,23 +18,28 @@ export declare class Vec3 extends Vector3 {
18
18
  * @param amount - The distance to move.
19
19
  * @returns This Vec3 instance.
20
20
  */
21
- moveTowards(target: Vector3, amount: number): Vec3;
21
+ moveTowards(target: Vector3, amount: number): this;
22
22
  /**
23
23
  * Moves this Vec3 instance halfway towards the target Vec3 by the given amount.
24
24
  * @param target - The target Vec3.
25
25
  * @returns This Vec3 instance.
26
26
  */
27
- moveHalfWayTowards(target: Vector3): Vec3;
27
+ moveHalfWayTowards(target: Vector3): this;
28
28
  /**
29
29
  * Adds y amount to this Vec3 instance and return this
30
30
  * @param y
31
31
  */
32
- addY(y: number): Vec3;
32
+ addY(y: number): this;
33
33
  /**
34
34
  * Adds x amount to this Vec3 instance and return this
35
35
  * @param x
36
36
  */
37
- addX(x: number): Vec3;
37
+ addX(x: number): this;
38
+ /**
39
+ * Adds z amount to this Vec3 instance and return this
40
+ * @param z
41
+ */
42
+ addZ(z: number): this;
38
43
  /**
39
44
  * Returns a clone of the point closest to this from the given points.
40
45
  * @param points