@immugio/three-math-extensions 0.2.7 → 0.2.8
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 +13 -2
- package/cjs/Line2D.js +9 -0
- package/esm/Line2D.js +9 -0
- package/package.json +1 -1
- package/src/Line2D.ts +10 -0
- package/types/Line2D.d.ts +7 -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.8](https://github.com/Immugio/three-math-extensions/compare/16.15.10...0.2.8)
|
|
11
11
|
|
|
12
12
|
### Commits
|
|
13
13
|
|
|
@@ -21,13 +21,24 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
21
21
|
- Add Vec2.parallelTo [`989874d`](https://github.com/Immugio/three-math-extensions/commit/989874dcfe122d3ee84d8d56d79cb88e4e441736)
|
|
22
22
|
- Polygon from bounding size [`eae6701`](https://github.com/Immugio/three-math-extensions/commit/eae67012f57f426f8b5259b765000447ce06d608)
|
|
23
23
|
- Line2D and Line3D to return this instead of specific type [`761ef6a`](https://github.com/Immugio/three-math-extensions/commit/761ef6a9d8cc4e35120b666576794e521aa3b991)
|
|
24
|
+
- Line2D.in3DSpace added [`a6ce0ec`](https://github.com/Immugio/three-math-extensions/commit/a6ce0ecb67f5c7b2a75fcc283c28af626153a4af)
|
|
24
25
|
- Line2D.hasIntersectionWithAngle to support optional tolerance [`b313bbe`](https://github.com/Immugio/three-math-extensions/commit/b313bbe118d435d53750deefd9a9e29ba6ec5c71)
|
|
25
26
|
- Line2D.hasIntersectionWithAngle - modulo all angles [`5409aa0`](https://github.com/Immugio/three-math-extensions/commit/5409aa0bc41510efa86d548e91837e44e5b6c343)
|
|
27
|
+
- Update release instructions [`5b41a2e`](https://github.com/Immugio/three-math-extensions/commit/5b41a2ed7e15450dbb6088a7f7ed0031a013badc)
|
|
26
28
|
- Add Polygon to exports [`ed66775`](https://github.com/Immugio/three-math-extensions/commit/ed66775c33e961835b23843222b822cfd9c16b1d)
|
|
27
29
|
- Vec2.fromPoint and Vec3.fromPoint should accept null [`4b871af`](https://github.com/Immugio/three-math-extensions/commit/4b871af297bdcbe8584f1e2b99d602247b77687c)
|
|
28
30
|
- Excluded files from build [`ec70614`](https://github.com/Immugio/three-math-extensions/commit/ec70614bc7df7a98f854c7a6693365118e04faf7)
|
|
29
31
|
|
|
30
|
-
## [16.15.10](https://github.com/Immugio/three-math-extensions/compare/0.2.
|
|
32
|
+
## [16.15.10](https://github.com/Immugio/three-math-extensions/compare/0.2.7...16.15.10) - 2023-01-02
|
|
33
|
+
|
|
34
|
+
## [0.2.7](https://github.com/Immugio/three-math-extensions/compare/0.2.6...0.2.7) - 2023-04-26
|
|
35
|
+
|
|
36
|
+
### Commits
|
|
37
|
+
|
|
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.hasIntersectionWithAngle to support optional tolerance [`b313bbe`](https://github.com/Immugio/three-math-extensions/commit/b313bbe118d435d53750deefd9a9e29ba6ec5c71)
|
|
41
|
+
- Line2D.hasIntersectionWithAngle - modulo all angles [`5409aa0`](https://github.com/Immugio/three-math-extensions/commit/5409aa0bc41510efa86d548e91837e44e5b6c343)
|
|
31
42
|
|
|
32
43
|
## [0.2.6](https://github.com/Immugio/three-math-extensions/compare/0.2.5...0.2.6) - 2023-04-14
|
|
33
44
|
|
package/cjs/Line2D.js
CHANGED
|
@@ -5,6 +5,7 @@ const three_1 = require("three");
|
|
|
5
5
|
const Vec2_1 = require("./Vec2");
|
|
6
6
|
const three_2 = require("three");
|
|
7
7
|
const MathConstants_1 = require("./MathConstants");
|
|
8
|
+
const Line3D_1 = require("./Line3D");
|
|
8
9
|
const _startP = /*@__PURE__*/ new Vec2_1.Vec2();
|
|
9
10
|
const _startEnd = /*@__PURE__*/ new Vec2_1.Vec2();
|
|
10
11
|
class Line2D {
|
|
@@ -552,6 +553,14 @@ class Line2D {
|
|
|
552
553
|
}
|
|
553
554
|
return null;
|
|
554
555
|
}
|
|
556
|
+
/**
|
|
557
|
+
* Project the line to 2D space. For start and end points Vec2.y becomes Vec3.z. and Vec3.y is provided as an argument.
|
|
558
|
+
* @param y - The y value of the new Vec3 instance.
|
|
559
|
+
* @returns A new Line3D instance.
|
|
560
|
+
*/
|
|
561
|
+
in3DSpace(y = 0) {
|
|
562
|
+
return new Line3D_1.Line3D(this.start.in3DSpace(y), this.end.in3DSpace(y));
|
|
563
|
+
}
|
|
555
564
|
equals(other) {
|
|
556
565
|
return !!other && this.start.equals(other.start) && this.end.equals(other.end);
|
|
557
566
|
}
|
package/esm/Line2D.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Vector2 } from "three";
|
|
|
2
2
|
import { Vec2 } from "./Vec2";
|
|
3
3
|
import { MathUtils } from "three";
|
|
4
4
|
import { TwoPI } from "./MathConstants";
|
|
5
|
+
import { Line3D } from "./Line3D";
|
|
5
6
|
const _startP = /*@__PURE__*/ new Vec2();
|
|
6
7
|
const _startEnd = /*@__PURE__*/ new Vec2();
|
|
7
8
|
export class Line2D {
|
|
@@ -549,6 +550,14 @@ export class Line2D {
|
|
|
549
550
|
}
|
|
550
551
|
return null;
|
|
551
552
|
}
|
|
553
|
+
/**
|
|
554
|
+
* Project the line to 2D space. For start and end points Vec2.y becomes Vec3.z. and Vec3.y is provided as an argument.
|
|
555
|
+
* @param y - The y value of the new Vec3 instance.
|
|
556
|
+
* @returns A new Line3D instance.
|
|
557
|
+
*/
|
|
558
|
+
in3DSpace(y = 0) {
|
|
559
|
+
return new Line3D(this.start.in3DSpace(y), this.end.in3DSpace(y));
|
|
560
|
+
}
|
|
552
561
|
equals(other) {
|
|
553
562
|
return !!other && this.start.equals(other.start) && this.end.equals(other.end);
|
|
554
563
|
}
|
package/package.json
CHANGED
package/src/Line2D.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Vector2 } from "three";
|
|
|
3
3
|
import { Vec2 } from "./Vec2";
|
|
4
4
|
import { MathUtils } from "three";
|
|
5
5
|
import { TwoPI } from "./MathConstants";
|
|
6
|
+
import { Line3D } from "./Line3D";
|
|
6
7
|
|
|
7
8
|
const _startP = /*@__PURE__*/ new Vec2();
|
|
8
9
|
const _startEnd = /*@__PURE__*/ new Vec2();
|
|
@@ -649,6 +650,15 @@ export class Line2D {
|
|
|
649
650
|
return null;
|
|
650
651
|
}
|
|
651
652
|
|
|
653
|
+
/**
|
|
654
|
+
* Project the line to 2D space. For start and end points Vec2.y becomes Vec3.z. and Vec3.y is provided as an argument.
|
|
655
|
+
* @param y - The y value of the new Vec3 instance.
|
|
656
|
+
* @returns A new Line3D instance.
|
|
657
|
+
*/
|
|
658
|
+
public in3DSpace(y: number = 0): Line3D {
|
|
659
|
+
return new Line3D(this.start.in3DSpace(y), this.end.in3DSpace(y));
|
|
660
|
+
}
|
|
661
|
+
|
|
652
662
|
public equals(other: Line2D): boolean {
|
|
653
663
|
return !!other && this.start.equals(other.start) && this.end.equals(other.end);
|
|
654
664
|
}
|
package/types/Line2D.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Point2 } from "./Point2";
|
|
2
2
|
import { Vector2 } from "three";
|
|
3
3
|
import { Vec2 } from "./Vec2";
|
|
4
|
+
import { Line3D } from "./Line3D";
|
|
4
5
|
export declare class Line2D {
|
|
5
6
|
start: Vec2;
|
|
6
7
|
end: Vec2;
|
|
@@ -209,6 +210,12 @@ export declare class Line2D {
|
|
|
209
210
|
* @param distanceTolerance number
|
|
210
211
|
*/
|
|
211
212
|
hasIntersectionWithAngle(other: Line2D, expectedAngleInRads: number, angleTolerance?: number, distanceTolerance?: number): Vec2;
|
|
213
|
+
/**
|
|
214
|
+
* Project the line to 2D space. For start and end points Vec2.y becomes Vec3.z. and Vec3.y is provided as an argument.
|
|
215
|
+
* @param y - The y value of the new Vec3 instance.
|
|
216
|
+
* @returns A new Line3D instance.
|
|
217
|
+
*/
|
|
218
|
+
in3DSpace(y?: number): Line3D;
|
|
212
219
|
equals(other: Line2D): boolean;
|
|
213
220
|
/**
|
|
214
221
|
* Deep clone of this line
|