@immugio/three-math-extensions 0.3.4 → 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.
Files changed (45) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/cjs/Line2D.js +90 -13
  3. package/cjs/Polygon.js +3 -0
  4. package/docs/classes/BoundingBox.md +121 -121
  5. package/docs/classes/Line2D.md +1366 -1366
  6. package/docs/classes/Line3D.md +831 -831
  7. package/docs/classes/Polygon.md +297 -297
  8. package/docs/classes/Rectangle.md +291 -291
  9. package/docs/classes/Size2.md +55 -55
  10. package/docs/classes/Vec2.md +282 -282
  11. package/docs/classes/Vec3.md +338 -338
  12. package/docs/interfaces/Point2.md +30 -30
  13. package/docs/interfaces/Point3.md +41 -41
  14. package/docs/modules.md +209 -209
  15. package/eslint.config.mjs +111 -111
  16. package/esm/Line2D.js +90 -13
  17. package/esm/Polygon.js +3 -0
  18. package/package.json +62 -62
  19. package/src/BoundingBox.ts +13 -13
  20. package/src/Line2D.ts +951 -857
  21. package/src/Line3D.ts +586 -586
  22. package/src/MathConstants.ts +1 -1
  23. package/src/Point2.ts +3 -3
  24. package/src/Point3.ts +4 -4
  25. package/src/Polygon.ts +290 -286
  26. package/src/Rectangle.ts +92 -92
  27. package/src/Size2.ts +3 -3
  28. package/src/Vec2.ts +124 -124
  29. package/src/Vec3.ts +167 -167
  30. package/src/containsPoint.ts +65 -65
  31. package/src/directions.ts +9 -9
  32. package/src/directions2d.ts +7 -7
  33. package/src/ensurePolygonClockwise.ts +9 -9
  34. package/src/extendOrTrimPolylinesAtIntersections.ts +10 -10
  35. package/src/getPolygonArea.ts +21 -21
  36. package/src/index.ts +24 -24
  37. package/src/isContinuousClosedShape.ts +24 -24
  38. package/src/isPointInPolygon.ts +23 -23
  39. package/src/isPolygonClockwise.ts +15 -15
  40. package/src/normalizeAngleDegrees.ts +6 -6
  41. package/src/normalizeAngleRadians.ts +14 -14
  42. package/src/offsetPolyline.ts +26 -26
  43. package/src/polygonPerimeter.ts +13 -13
  44. package/src/sortLinesByConnections.ts +45 -45
  45. package/types/Line2D.d.ts +12 -5
@@ -1,30 +1,30 @@
1
- [@immugio/three-math-extensions](../../README.md) / [Exports](../modules.md) / Point2
2
-
3
- # Interface: Point2
4
-
5
- ## Table of contents
6
-
7
- ### Properties
8
-
9
- - [x](Point2.md#x)
10
- - [y](Point2.md#y)
11
-
12
- ## Properties
13
-
14
- ### x
15
-
16
- • **x**: `number`
17
-
18
- #### Defined in
19
-
20
- [src/Point2.ts:2](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Point2.ts#L2)
21
-
22
- ___
23
-
24
- ### y
25
-
26
- • **y**: `number`
27
-
28
- #### Defined in
29
-
30
- [src/Point2.ts:3](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Point2.ts#L3)
1
+ [@immugio/three-math-extensions](../../README.md) / [Exports](../modules.md) / Point2
2
+
3
+ # Interface: Point2
4
+
5
+ ## Table of contents
6
+
7
+ ### Properties
8
+
9
+ - [x](Point2.md#x)
10
+ - [y](Point2.md#y)
11
+
12
+ ## Properties
13
+
14
+ ### x
15
+
16
+ • **x**: `number`
17
+
18
+ #### Defined in
19
+
20
+ [src/Point2.ts:2](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Point2.ts#L2)
21
+
22
+ ___
23
+
24
+ ### y
25
+
26
+ • **y**: `number`
27
+
28
+ #### Defined in
29
+
30
+ [src/Point2.ts:3](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Point2.ts#L3)
@@ -1,41 +1,41 @@
1
- [@immugio/three-math-extensions](../../README.md) / [Exports](../modules.md) / Point3
2
-
3
- # Interface: Point3
4
-
5
- ## Table of contents
6
-
7
- ### Properties
8
-
9
- - [x](Point3.md#x)
10
- - [y](Point3.md#y)
11
- - [z](Point3.md#z)
12
-
13
- ## Properties
14
-
15
- ### x
16
-
17
- • **x**: `number`
18
-
19
- #### Defined in
20
-
21
- [src/Point3.ts:2](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Point3.ts#L2)
22
-
23
- ___
24
-
25
- ### y
26
-
27
- • **y**: `number`
28
-
29
- #### Defined in
30
-
31
- [src/Point3.ts:3](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Point3.ts#L3)
32
-
33
- ___
34
-
35
- ### z
36
-
37
- • **z**: `number`
38
-
39
- #### Defined in
40
-
41
- [src/Point3.ts:4](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Point3.ts#L4)
1
+ [@immugio/three-math-extensions](../../README.md) / [Exports](../modules.md) / Point3
2
+
3
+ # Interface: Point3
4
+
5
+ ## Table of contents
6
+
7
+ ### Properties
8
+
9
+ - [x](Point3.md#x)
10
+ - [y](Point3.md#y)
11
+ - [z](Point3.md#z)
12
+
13
+ ## Properties
14
+
15
+ ### x
16
+
17
+ • **x**: `number`
18
+
19
+ #### Defined in
20
+
21
+ [src/Point3.ts:2](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Point3.ts#L2)
22
+
23
+ ___
24
+
25
+ ### y
26
+
27
+ • **y**: `number`
28
+
29
+ #### Defined in
30
+
31
+ [src/Point3.ts:3](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Point3.ts#L3)
32
+
33
+ ___
34
+
35
+ ### z
36
+
37
+ • **z**: `number`
38
+
39
+ #### Defined in
40
+
41
+ [src/Point3.ts:4](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Point3.ts#L4)
package/docs/modules.md CHANGED
@@ -1,209 +1,209 @@
1
- [@immugio/three-math-extensions](../README.md) / Exports
2
-
3
- # @immugio/three-math-extensions
4
-
5
- ## Table of contents
6
-
7
- ### Classes
8
-
9
- - [BoundingBox](classes/BoundingBox.md)
10
- - [Line2D](classes/Line2D.md)
11
- - [Line3D](classes/Line3D.md)
12
- - [Polygon](classes/Polygon.md)
13
- - [Rectangle](classes/Rectangle.md)
14
- - [Size2](classes/Size2.md)
15
- - [Vec2](classes/Vec2.md)
16
- - [Vec3](classes/Vec3.md)
17
-
18
- ### Interfaces
19
-
20
- - [Point2](interfaces/Point2.md)
21
- - [Point3](interfaces/Point3.md)
22
-
23
- ### Variables
24
-
25
- - [HalfPI](modules.md#halfpi)
26
- - [TwoPI](modules.md#twopi)
27
- - [directions](modules.md#directions)
28
- - [directions2d](modules.md#directions2d)
29
-
30
- ### Functions
31
-
32
- - [isContinuousClosedShape](modules.md#iscontinuousclosedshape)
33
- - [isPointInPolygon](modules.md#ispointinpolygon)
34
- - [normalizeAngleDegrees](modules.md#normalizeangledegrees)
35
- - [normalizeAngleRadians](modules.md#normalizeangleradians)
36
- - [polygonPerimeter](modules.md#polygonperimeter)
37
-
38
- ## Variables
39
-
40
- ### HalfPI
41
-
42
- • `Const` **HalfPI**: `number`
43
-
44
- #### Defined in
45
-
46
- [src/MathConstants.ts:2](https://github.com/Immugio/three-math-extensions/blob/e397290/src/MathConstants.ts#L2)
47
-
48
- ___
49
-
50
- ### TwoPI
51
-
52
- • `Const` **TwoPI**: `number`
53
-
54
- #### Defined in
55
-
56
- [src/MathConstants.ts:1](https://github.com/Immugio/three-math-extensions/blob/e397290/src/MathConstants.ts#L1)
57
-
58
- ___
59
-
60
- ### directions
61
-
62
- • `Const` **directions**: `Object`
63
-
64
- #### Type declaration
65
-
66
- | Name | Type |
67
- | :------ | :------ |
68
- | `Down` | [`Vec3`](classes/Vec3.md) |
69
- | `East` | [`Vec3`](classes/Vec3.md) |
70
- | `North` | [`Vec3`](classes/Vec3.md) |
71
- | `South` | [`Vec3`](classes/Vec3.md) |
72
- | `Up` | [`Vec3`](classes/Vec3.md) |
73
- | `West` | [`Vec3`](classes/Vec3.md) |
74
-
75
- #### Defined in
76
-
77
- [src/directions.ts:3](https://github.com/Immugio/three-math-extensions/blob/e397290/src/directions.ts#L3)
78
-
79
- ___
80
-
81
- ### directions2d
82
-
83
- • `Const` **directions2d**: `Object`
84
-
85
- #### Type declaration
86
-
87
- | Name | Type |
88
- | :------ | :------ |
89
- | `Down` | [`Vec2`](classes/Vec2.md) |
90
- | `Left` | [`Vec2`](classes/Vec2.md) |
91
- | `Right` | [`Vec2`](classes/Vec2.md) |
92
- | `Up` | [`Vec2`](classes/Vec2.md) |
93
-
94
- #### Defined in
95
-
96
- [src/directions2d.ts:3](https://github.com/Immugio/three-math-extensions/blob/e397290/src/directions2d.ts#L3)
97
-
98
- ## Functions
99
-
100
- ### isContinuousClosedShape
101
-
102
- ▸ **isContinuousClosedShape**\<`T`\>(`lines`, `tolerance?`): `boolean`
103
-
104
- #### Type parameters
105
-
106
- | Name | Type |
107
- | :------ | :------ |
108
- | `T` | extends [`Line3D`](classes/Line3D.md) \| [`Line2D`](classes/Line2D.md) |
109
-
110
- #### Parameters
111
-
112
- | Name | Type | Default value |
113
- | :------ | :------ | :------ |
114
- | `lines` | `T`[] | `undefined` |
115
- | `tolerance` | `number` | `0` |
116
-
117
- #### Returns
118
-
119
- `boolean`
120
-
121
- #### Defined in
122
-
123
- [src/isContinuousClosedShape.ts:4](https://github.com/Immugio/three-math-extensions/blob/e397290/src/isContinuousClosedShape.ts#L4)
124
-
125
- ___
126
-
127
- ### isPointInPolygon
128
-
129
- ▸ **isPointInPolygon**(`p`, `point`): `boolean`
130
-
131
- #### Parameters
132
-
133
- | Name | Type |
134
- | :------ | :------ |
135
- | `p` | [`Point2`](interfaces/Point2.md)[] |
136
- | `point` | [`Point2`](interfaces/Point2.md) |
137
-
138
- #### Returns
139
-
140
- `boolean`
141
-
142
- #### Defined in
143
-
144
- [src/isPointInPolygon.ts:3](https://github.com/Immugio/three-math-extensions/blob/e397290/src/isPointInPolygon.ts#L3)
145
-
146
- ___
147
-
148
- ### normalizeAngleDegrees
149
-
150
- ▸ **normalizeAngleDegrees**(`angle`): `number`
151
-
152
- Normalizes an angle in degrees to the range [0, 360].
153
-
154
- #### Parameters
155
-
156
- | Name | Type | Description |
157
- | :------ | :------ | :------ |
158
- | `angle` | `number` | in degrees |
159
-
160
- #### Returns
161
-
162
- `number`
163
-
164
- #### Defined in
165
-
166
- [src/normalizeAngleDegrees.ts:5](https://github.com/Immugio/three-math-extensions/blob/e397290/src/normalizeAngleDegrees.ts#L5)
167
-
168
- ___
169
-
170
- ### normalizeAngleRadians
171
-
172
- ▸ **normalizeAngleRadians**(`angle`): `number`
173
-
174
- Normalize an angle in radians to the range of 0 to 2π.
175
-
176
- #### Parameters
177
-
178
- | Name | Type | Description |
179
- | :------ | :------ | :------ |
180
- | `angle` | `number` | in radians |
181
-
182
- #### Returns
183
-
184
- `number`
185
-
186
- #### Defined in
187
-
188
- [src/normalizeAngleRadians.ts:7](https://github.com/Immugio/three-math-extensions/blob/e397290/src/normalizeAngleRadians.ts#L7)
189
-
190
- ___
191
-
192
- ### polygonPerimeter
193
-
194
- ▸ **polygonPerimeter**(`polygon`, `forceClosedPolygon?`): `number`
195
-
196
- #### Parameters
197
-
198
- | Name | Type | Default value |
199
- | :------ | :------ | :------ |
200
- | `polygon` | [`Vec2`](classes/Vec2.md)[] | `undefined` |
201
- | `forceClosedPolygon` | `boolean` | `false` |
202
-
203
- #### Returns
204
-
205
- `number`
206
-
207
- #### Defined in
208
-
209
- [src/polygonPerimeter.ts:3](https://github.com/Immugio/three-math-extensions/blob/e397290/src/polygonPerimeter.ts#L3)
1
+ [@immugio/three-math-extensions](../README.md) / Exports
2
+
3
+ # @immugio/three-math-extensions
4
+
5
+ ## Table of contents
6
+
7
+ ### Classes
8
+
9
+ - [BoundingBox](classes/BoundingBox.md)
10
+ - [Line2D](classes/Line2D.md)
11
+ - [Line3D](classes/Line3D.md)
12
+ - [Polygon](classes/Polygon.md)
13
+ - [Rectangle](classes/Rectangle.md)
14
+ - [Size2](classes/Size2.md)
15
+ - [Vec2](classes/Vec2.md)
16
+ - [Vec3](classes/Vec3.md)
17
+
18
+ ### Interfaces
19
+
20
+ - [Point2](interfaces/Point2.md)
21
+ - [Point3](interfaces/Point3.md)
22
+
23
+ ### Variables
24
+
25
+ - [HalfPI](modules.md#halfpi)
26
+ - [TwoPI](modules.md#twopi)
27
+ - [directions](modules.md#directions)
28
+ - [directions2d](modules.md#directions2d)
29
+
30
+ ### Functions
31
+
32
+ - [isContinuousClosedShape](modules.md#iscontinuousclosedshape)
33
+ - [isPointInPolygon](modules.md#ispointinpolygon)
34
+ - [normalizeAngleDegrees](modules.md#normalizeangledegrees)
35
+ - [normalizeAngleRadians](modules.md#normalizeangleradians)
36
+ - [polygonPerimeter](modules.md#polygonperimeter)
37
+
38
+ ## Variables
39
+
40
+ ### HalfPI
41
+
42
+ • `Const` **HalfPI**: `number`
43
+
44
+ #### Defined in
45
+
46
+ [src/MathConstants.ts:2](https://github.com/Immugio/three-math-extensions/blob/e397290/src/MathConstants.ts#L2)
47
+
48
+ ___
49
+
50
+ ### TwoPI
51
+
52
+ • `Const` **TwoPI**: `number`
53
+
54
+ #### Defined in
55
+
56
+ [src/MathConstants.ts:1](https://github.com/Immugio/three-math-extensions/blob/e397290/src/MathConstants.ts#L1)
57
+
58
+ ___
59
+
60
+ ### directions
61
+
62
+ • `Const` **directions**: `Object`
63
+
64
+ #### Type declaration
65
+
66
+ | Name | Type |
67
+ | :------ | :------ |
68
+ | `Down` | [`Vec3`](classes/Vec3.md) |
69
+ | `East` | [`Vec3`](classes/Vec3.md) |
70
+ | `North` | [`Vec3`](classes/Vec3.md) |
71
+ | `South` | [`Vec3`](classes/Vec3.md) |
72
+ | `Up` | [`Vec3`](classes/Vec3.md) |
73
+ | `West` | [`Vec3`](classes/Vec3.md) |
74
+
75
+ #### Defined in
76
+
77
+ [src/directions.ts:3](https://github.com/Immugio/three-math-extensions/blob/e397290/src/directions.ts#L3)
78
+
79
+ ___
80
+
81
+ ### directions2d
82
+
83
+ • `Const` **directions2d**: `Object`
84
+
85
+ #### Type declaration
86
+
87
+ | Name | Type |
88
+ | :------ | :------ |
89
+ | `Down` | [`Vec2`](classes/Vec2.md) |
90
+ | `Left` | [`Vec2`](classes/Vec2.md) |
91
+ | `Right` | [`Vec2`](classes/Vec2.md) |
92
+ | `Up` | [`Vec2`](classes/Vec2.md) |
93
+
94
+ #### Defined in
95
+
96
+ [src/directions2d.ts:3](https://github.com/Immugio/three-math-extensions/blob/e397290/src/directions2d.ts#L3)
97
+
98
+ ## Functions
99
+
100
+ ### isContinuousClosedShape
101
+
102
+ ▸ **isContinuousClosedShape**\<`T`\>(`lines`, `tolerance?`): `boolean`
103
+
104
+ #### Type parameters
105
+
106
+ | Name | Type |
107
+ | :------ | :------ |
108
+ | `T` | extends [`Line3D`](classes/Line3D.md) \| [`Line2D`](classes/Line2D.md) |
109
+
110
+ #### Parameters
111
+
112
+ | Name | Type | Default value |
113
+ | :------ | :------ | :------ |
114
+ | `lines` | `T`[] | `undefined` |
115
+ | `tolerance` | `number` | `0` |
116
+
117
+ #### Returns
118
+
119
+ `boolean`
120
+
121
+ #### Defined in
122
+
123
+ [src/isContinuousClosedShape.ts:4](https://github.com/Immugio/three-math-extensions/blob/e397290/src/isContinuousClosedShape.ts#L4)
124
+
125
+ ___
126
+
127
+ ### isPointInPolygon
128
+
129
+ ▸ **isPointInPolygon**(`p`, `point`): `boolean`
130
+
131
+ #### Parameters
132
+
133
+ | Name | Type |
134
+ | :------ | :------ |
135
+ | `p` | [`Point2`](interfaces/Point2.md)[] |
136
+ | `point` | [`Point2`](interfaces/Point2.md) |
137
+
138
+ #### Returns
139
+
140
+ `boolean`
141
+
142
+ #### Defined in
143
+
144
+ [src/isPointInPolygon.ts:3](https://github.com/Immugio/three-math-extensions/blob/e397290/src/isPointInPolygon.ts#L3)
145
+
146
+ ___
147
+
148
+ ### normalizeAngleDegrees
149
+
150
+ ▸ **normalizeAngleDegrees**(`angle`): `number`
151
+
152
+ Normalizes an angle in degrees to the range [0, 360].
153
+
154
+ #### Parameters
155
+
156
+ | Name | Type | Description |
157
+ | :------ | :------ | :------ |
158
+ | `angle` | `number` | in degrees |
159
+
160
+ #### Returns
161
+
162
+ `number`
163
+
164
+ #### Defined in
165
+
166
+ [src/normalizeAngleDegrees.ts:5](https://github.com/Immugio/three-math-extensions/blob/e397290/src/normalizeAngleDegrees.ts#L5)
167
+
168
+ ___
169
+
170
+ ### normalizeAngleRadians
171
+
172
+ ▸ **normalizeAngleRadians**(`angle`): `number`
173
+
174
+ Normalize an angle in radians to the range of 0 to 2π.
175
+
176
+ #### Parameters
177
+
178
+ | Name | Type | Description |
179
+ | :------ | :------ | :------ |
180
+ | `angle` | `number` | in radians |
181
+
182
+ #### Returns
183
+
184
+ `number`
185
+
186
+ #### Defined in
187
+
188
+ [src/normalizeAngleRadians.ts:7](https://github.com/Immugio/three-math-extensions/blob/e397290/src/normalizeAngleRadians.ts#L7)
189
+
190
+ ___
191
+
192
+ ### polygonPerimeter
193
+
194
+ ▸ **polygonPerimeter**(`polygon`, `forceClosedPolygon?`): `number`
195
+
196
+ #### Parameters
197
+
198
+ | Name | Type | Default value |
199
+ | :------ | :------ | :------ |
200
+ | `polygon` | [`Vec2`](classes/Vec2.md)[] | `undefined` |
201
+ | `forceClosedPolygon` | `boolean` | `false` |
202
+
203
+ #### Returns
204
+
205
+ `number`
206
+
207
+ #### Defined in
208
+
209
+ [src/polygonPerimeter.ts:3](https://github.com/Immugio/three-math-extensions/blob/e397290/src/polygonPerimeter.ts#L3)