@immugio/three-math-extensions 0.2.20 → 0.2.22
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 +18 -2
- package/README.md +183 -1
- package/cjs/Line2D.js +59 -8
- package/cjs/Line3D.js +1 -1
- package/docs/classes/BoundingBox.md +13 -9
- package/docs/classes/Line2D.md +292 -80
- package/docs/classes/Line3D.md +155 -84
- package/docs/classes/Polygon.md +23 -19
- package/docs/classes/Rectangle.md +23 -19
- package/docs/classes/Size2.md +8 -4
- package/docs/classes/Vec2.md +62 -12
- package/docs/classes/Vec3.md +65 -15
- package/docs/interfaces/Point2.md +3 -3
- package/docs/interfaces/Point3.md +4 -4
- package/docs/modules.md +86 -5
- package/esm/Line2D.js +59 -8
- package/esm/Line3D.js +1 -1
- package/package.json +3 -3
- package/src/Line2D.ts +69 -8
- package/src/Line3D.ts +1 -1
- package/types/Line2D.d.ts +21 -2
- package/types/Line3D.d.ts +1 -1
- package/docs/README.md +0 -90
package/types/Line2D.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Vector2 } from "three";
|
|
|
3
3
|
import { Vec2 } from "./Vec2";
|
|
4
4
|
import { Line3D } from "./Line3D";
|
|
5
5
|
export declare class Line2D {
|
|
6
|
+
#private;
|
|
6
7
|
start: Vec2;
|
|
7
8
|
end: Vec2;
|
|
8
9
|
index: number;
|
|
@@ -55,6 +56,18 @@ export declare class Line2D {
|
|
|
55
56
|
* Endpoints are not cloned.
|
|
56
57
|
*/
|
|
57
58
|
get endpoints(): Vec2[];
|
|
59
|
+
/**
|
|
60
|
+
* Check that this line segment contains provided point.
|
|
61
|
+
* @param p
|
|
62
|
+
* @param tolerance
|
|
63
|
+
*/
|
|
64
|
+
containsPoint(p: Vector2, tolerance?: number): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Distance from this line to the provided point.
|
|
67
|
+
* @param param
|
|
68
|
+
* @param clampToLine
|
|
69
|
+
*/
|
|
70
|
+
distanceToPoint(p: Vector2, clampToLine?: boolean): number;
|
|
58
71
|
/**
|
|
59
72
|
* Returns the direction of this line.
|
|
60
73
|
*/
|
|
@@ -117,7 +130,7 @@ export declare class Line2D {
|
|
|
117
130
|
/**
|
|
118
131
|
* Returns true if there is any overlap between this line and the @other line section.
|
|
119
132
|
*/
|
|
120
|
-
overlaps(other: Line2D): boolean;
|
|
133
|
+
overlaps(other: Line2D, distanceTolerance?: number, parallelTolerance?: number): boolean;
|
|
121
134
|
/**
|
|
122
135
|
* Logical AND of this and the other line section.
|
|
123
136
|
* @param other
|
|
@@ -139,6 +152,12 @@ export declare class Line2D {
|
|
|
139
152
|
* @param lines
|
|
140
153
|
*/
|
|
141
154
|
static joinLines(lines: Line2D[]): Line2D[];
|
|
155
|
+
/**
|
|
156
|
+
* Checks if the current line covers another line.
|
|
157
|
+
* A line is considered to cover another line if they are parallel and both the start and end points of the other line are contained within the current line.
|
|
158
|
+
* Both distance and angle tolerance can be provided.
|
|
159
|
+
*/
|
|
160
|
+
covers(other: Line2D, tolerance?: number, parallelTolerance?: number): boolean;
|
|
142
161
|
/**
|
|
143
162
|
* Returns a new line that is the projection of this line onto @other. Uses `closestPointToPoint` to find the projection.
|
|
144
163
|
* @param other
|
|
@@ -241,7 +260,7 @@ export declare class Line2D {
|
|
|
241
260
|
* @returns A new Line3D instance.
|
|
242
261
|
*/
|
|
243
262
|
in3DSpace(y?: number): Line3D;
|
|
244
|
-
equals(other: Line2D): boolean;
|
|
263
|
+
equals(other: Line2D, tolerance?: number): boolean;
|
|
245
264
|
/**
|
|
246
265
|
* Deep clone of this line
|
|
247
266
|
*/
|
package/types/Line3D.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ export declare class Line3D extends Line3 {
|
|
|
94
94
|
*/
|
|
95
95
|
containsPoint(p: Vector3, tolerance?: number): boolean;
|
|
96
96
|
/**
|
|
97
|
-
* Distance from this line to provided point.
|
|
97
|
+
* Distance from this line to the provided point.
|
|
98
98
|
* @param p
|
|
99
99
|
* @param clampToLine
|
|
100
100
|
*/
|
package/docs/README.md
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
@immugio/three-math-extensions / [Exports](modules.md)
|
|
2
|
-
|
|
3
|
-
# Set of utilities for 2d and 3d math built on top of three.js
|
|
4
|
-
|
|
5
|
-
[](https://github.com/Immugio/three-math-extensions/actions/workflows/build.yml)
|
|
6
|
-
|
|
7
|
-
[@immugio/three-math-extensions](README.md) / Exports
|
|
8
|
-
|
|
9
|
-
# @immugio/three-math-extensions
|
|
10
|
-
|
|
11
|
-
## Table of contents
|
|
12
|
-
|
|
13
|
-
### Classes
|
|
14
|
-
|
|
15
|
-
- [BoundingBox](docs/classes/BoundingBox.md)
|
|
16
|
-
- [Line2D](docs/classes/Line2D.md)
|
|
17
|
-
- [Line3D](docs/classes/Line3D.md)
|
|
18
|
-
- [Polygon](docs/classes/Polygon.md)
|
|
19
|
-
- [Rectangle](docs/classes/Rectangle.md)
|
|
20
|
-
- [Size2](docs/classes/Size2.md)
|
|
21
|
-
- [Vec2](docs/classes/Vec2.md)
|
|
22
|
-
- [Vec3](docs/classes/Vec3.md)
|
|
23
|
-
|
|
24
|
-
### Interfaces
|
|
25
|
-
|
|
26
|
-
- [Point2](docs/interfaces/Point2.md)
|
|
27
|
-
- [Point3](docs/interfaces/Point3.md)
|
|
28
|
-
|
|
29
|
-
### Variables
|
|
30
|
-
|
|
31
|
-
- [TwoPI](docs/modules.md#twopi)
|
|
32
|
-
|
|
33
|
-
### Functions
|
|
34
|
-
|
|
35
|
-
- [normalizeAngleDegrees](docs/modules.md#normalizeangledegrees)
|
|
36
|
-
- [normalizeAngleRadians](docs/modules.md#normalizeangleradians)
|
|
37
|
-
|
|
38
|
-
## Variables
|
|
39
|
-
|
|
40
|
-
### TwoPI
|
|
41
|
-
|
|
42
|
-
• `Const` **TwoPI**: `number`
|
|
43
|
-
|
|
44
|
-
#### Defined in
|
|
45
|
-
|
|
46
|
-
[src/MathConstants.ts:1](https://github.com/Immugio/three-math-extensions/blob/151f214/src/MathConstants.ts#L1)
|
|
47
|
-
|
|
48
|
-
## Functions
|
|
49
|
-
|
|
50
|
-
### normalizeAngleDegrees
|
|
51
|
-
|
|
52
|
-
▸ **normalizeAngleDegrees**(`angle`): `number`
|
|
53
|
-
|
|
54
|
-
Normalizes an angle in degrees to the range [0, 360].
|
|
55
|
-
|
|
56
|
-
#### Parameters
|
|
57
|
-
|
|
58
|
-
| Name | Type | Description |
|
|
59
|
-
| :------ | :------ | :------ |
|
|
60
|
-
| `angle` | `number` | in degrees |
|
|
61
|
-
|
|
62
|
-
#### Returns
|
|
63
|
-
|
|
64
|
-
`number`
|
|
65
|
-
|
|
66
|
-
#### Defined in
|
|
67
|
-
|
|
68
|
-
[src/normalizeAngleDegrees.ts:5](https://github.com/Immugio/three-math-extensions/blob/151f214/src/normalizeAngleDegrees.ts#L5)
|
|
69
|
-
|
|
70
|
-
___
|
|
71
|
-
|
|
72
|
-
### normalizeAngleRadians
|
|
73
|
-
|
|
74
|
-
▸ **normalizeAngleRadians**(`angle`): `number`
|
|
75
|
-
|
|
76
|
-
Normalize an angle in radians to the range of 0 to 2π.
|
|
77
|
-
|
|
78
|
-
#### Parameters
|
|
79
|
-
|
|
80
|
-
| Name | Type | Description |
|
|
81
|
-
| :------ | :------ | :------ |
|
|
82
|
-
| `angle` | `number` | in radians |
|
|
83
|
-
|
|
84
|
-
#### Returns
|
|
85
|
-
|
|
86
|
-
`number`
|
|
87
|
-
|
|
88
|
-
#### Defined in
|
|
89
|
-
|
|
90
|
-
[src/normalizeAngleRadians.ts:7](https://github.com/Immugio/three-math-extensions/blob/151f214/src/normalizeAngleRadians.ts#L7)
|