@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.
- package/CHANGELOG.md +23 -1
- package/cjs/Line2D.js +90 -13
- package/cjs/Polygon.js +3 -0
- package/docs/classes/BoundingBox.md +121 -121
- package/docs/classes/Line2D.md +1366 -1366
- package/docs/classes/Line3D.md +831 -831
- package/docs/classes/Polygon.md +297 -297
- package/docs/classes/Rectangle.md +291 -291
- package/docs/classes/Size2.md +55 -55
- package/docs/classes/Vec2.md +282 -282
- package/docs/classes/Vec3.md +338 -338
- package/docs/interfaces/Point2.md +30 -30
- package/docs/interfaces/Point3.md +41 -41
- package/docs/modules.md +209 -209
- package/eslint.config.mjs +111 -111
- package/esm/Line2D.js +90 -13
- package/esm/Polygon.js +3 -0
- package/package.json +62 -62
- package/src/BoundingBox.ts +13 -13
- package/src/Line2D.ts +951 -857
- package/src/Line3D.ts +586 -586
- package/src/MathConstants.ts +1 -1
- package/src/Point2.ts +3 -3
- package/src/Point3.ts +4 -4
- package/src/Polygon.ts +290 -286
- package/src/Rectangle.ts +92 -92
- package/src/Size2.ts +3 -3
- package/src/Vec2.ts +124 -124
- package/src/Vec3.ts +167 -167
- package/src/containsPoint.ts +65 -65
- package/src/directions.ts +9 -9
- package/src/directions2d.ts +7 -7
- package/src/ensurePolygonClockwise.ts +9 -9
- package/src/extendOrTrimPolylinesAtIntersections.ts +10 -10
- package/src/getPolygonArea.ts +21 -21
- package/src/index.ts +24 -24
- package/src/isContinuousClosedShape.ts +24 -24
- package/src/isPointInPolygon.ts +23 -23
- package/src/isPolygonClockwise.ts +15 -15
- package/src/normalizeAngleDegrees.ts +6 -6
- package/src/normalizeAngleRadians.ts +14 -14
- package/src/offsetPolyline.ts +26 -26
- package/src/polygonPerimeter.ts +13 -13
- package/src/sortLinesByConnections.ts +45 -45
- package/types/Line2D.d.ts +12 -5
package/docs/classes/Polygon.md
CHANGED
|
@@ -1,297 +1,297 @@
|
|
|
1
|
-
[@immugio/three-math-extensions](../../README.md) / [Exports](../modules.md) / Polygon
|
|
2
|
-
|
|
3
|
-
# Class: Polygon
|
|
4
|
-
|
|
5
|
-
## Table of contents
|
|
6
|
-
|
|
7
|
-
### Constructors
|
|
8
|
-
|
|
9
|
-
- [constructor](Polygon.md#constructor)
|
|
10
|
-
|
|
11
|
-
### Properties
|
|
12
|
-
|
|
13
|
-
- [contour](Polygon.md#contour)
|
|
14
|
-
- [holes](Polygon.md#holes)
|
|
15
|
-
|
|
16
|
-
### Accessors
|
|
17
|
-
|
|
18
|
-
- [size](Polygon.md#size)
|
|
19
|
-
|
|
20
|
-
### Methods
|
|
21
|
-
|
|
22
|
-
- [boundingBox](Polygon.md#boundingbox)
|
|
23
|
-
- [center](Polygon.md#center)
|
|
24
|
-
- [centerOnOrigin](Polygon.md#centeronorigin)
|
|
25
|
-
- [clone](Polygon.md#clone)
|
|
26
|
-
- [containsPoint](Polygon.md#containspoint)
|
|
27
|
-
- [ensureLastPoint](Polygon.md#ensurelastpoint)
|
|
28
|
-
- [equals](Polygon.md#equals)
|
|
29
|
-
- [flip](Polygon.md#flip)
|
|
30
|
-
- [perimeter](Polygon.md#perimeter)
|
|
31
|
-
- [toBoundingPolygon](Polygon.md#toboundingpolygon)
|
|
32
|
-
- [toRectangle](Polygon.md#torectangle)
|
|
33
|
-
- [fromPoints](Polygon.md#frompoints)
|
|
34
|
-
- [fromSize](Polygon.md#fromsize)
|
|
35
|
-
|
|
36
|
-
## Constructors
|
|
37
|
-
|
|
38
|
-
### constructor
|
|
39
|
-
|
|
40
|
-
• **new Polygon**(`contour`, `holes?`): [`Polygon`](Polygon.md)
|
|
41
|
-
|
|
42
|
-
#### Parameters
|
|
43
|
-
|
|
44
|
-
| Name | Type |
|
|
45
|
-
| :------ | :------ |
|
|
46
|
-
| `contour` | [`Vec2`](Vec2.md)[] |
|
|
47
|
-
| `holes?` | [`Vec2`](Vec2.md)[][] |
|
|
48
|
-
|
|
49
|
-
#### Returns
|
|
50
|
-
|
|
51
|
-
[`Polygon`](Polygon.md)
|
|
52
|
-
|
|
53
|
-
#### Defined in
|
|
54
|
-
|
|
55
|
-
[src/Polygon.ts:10](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L10)
|
|
56
|
-
|
|
57
|
-
## Properties
|
|
58
|
-
|
|
59
|
-
### contour
|
|
60
|
-
|
|
61
|
-
• **contour**: [`Vec2`](Vec2.md)[]
|
|
62
|
-
|
|
63
|
-
#### Defined in
|
|
64
|
-
|
|
65
|
-
[src/Polygon.ts:10](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L10)
|
|
66
|
-
|
|
67
|
-
___
|
|
68
|
-
|
|
69
|
-
### holes
|
|
70
|
-
|
|
71
|
-
• `Optional` **holes**: [`Vec2`](Vec2.md)[][]
|
|
72
|
-
|
|
73
|
-
#### Defined in
|
|
74
|
-
|
|
75
|
-
[src/Polygon.ts:10](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L10)
|
|
76
|
-
|
|
77
|
-
## Accessors
|
|
78
|
-
|
|
79
|
-
### size
|
|
80
|
-
|
|
81
|
-
• `get` **size**(): [`Vec2`](Vec2.md)
|
|
82
|
-
|
|
83
|
-
#### Returns
|
|
84
|
-
|
|
85
|
-
[`Vec2`](Vec2.md)
|
|
86
|
-
|
|
87
|
-
#### Defined in
|
|
88
|
-
|
|
89
|
-
[src/Polygon.ts:26](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L26)
|
|
90
|
-
|
|
91
|
-
## Methods
|
|
92
|
-
|
|
93
|
-
### boundingBox
|
|
94
|
-
|
|
95
|
-
▸ **boundingBox**(): [`BoundingBox`](BoundingBox.md)
|
|
96
|
-
|
|
97
|
-
#### Returns
|
|
98
|
-
|
|
99
|
-
[`BoundingBox`](BoundingBox.md)
|
|
100
|
-
|
|
101
|
-
#### Defined in
|
|
102
|
-
|
|
103
|
-
[src/Polygon.ts:75](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L75)
|
|
104
|
-
|
|
105
|
-
___
|
|
106
|
-
|
|
107
|
-
### center
|
|
108
|
-
|
|
109
|
-
▸ **center**(): [`Vec2`](Vec2.md)
|
|
110
|
-
|
|
111
|
-
#### Returns
|
|
112
|
-
|
|
113
|
-
[`Vec2`](Vec2.md)
|
|
114
|
-
|
|
115
|
-
#### Defined in
|
|
116
|
-
|
|
117
|
-
[src/Polygon.ts:50](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L50)
|
|
118
|
-
|
|
119
|
-
___
|
|
120
|
-
|
|
121
|
-
### centerOnOrigin
|
|
122
|
-
|
|
123
|
-
▸ **centerOnOrigin**(): [`Polygon`](Polygon.md)
|
|
124
|
-
|
|
125
|
-
#### Returns
|
|
126
|
-
|
|
127
|
-
[`Polygon`](Polygon.md)
|
|
128
|
-
|
|
129
|
-
#### Defined in
|
|
130
|
-
|
|
131
|
-
[src/Polygon.ts:31](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L31)
|
|
132
|
-
|
|
133
|
-
___
|
|
134
|
-
|
|
135
|
-
### clone
|
|
136
|
-
|
|
137
|
-
▸ **clone**(): [`Polygon`](Polygon.md)
|
|
138
|
-
|
|
139
|
-
#### Returns
|
|
140
|
-
|
|
141
|
-
[`Polygon`](Polygon.md)
|
|
142
|
-
|
|
143
|
-
#### Defined in
|
|
144
|
-
|
|
145
|
-
[src/Polygon.ts:125](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L125)
|
|
146
|
-
|
|
147
|
-
___
|
|
148
|
-
|
|
149
|
-
### containsPoint
|
|
150
|
-
|
|
151
|
-
▸ **containsPoint**(`point`): `boolean`
|
|
152
|
-
|
|
153
|
-
#### Parameters
|
|
154
|
-
|
|
155
|
-
| Name | Type |
|
|
156
|
-
| :------ | :------ |
|
|
157
|
-
| `point` | [`Vec2`](Vec2.md) |
|
|
158
|
-
|
|
159
|
-
#### Returns
|
|
160
|
-
|
|
161
|
-
`boolean`
|
|
162
|
-
|
|
163
|
-
#### Defined in
|
|
164
|
-
|
|
165
|
-
[src/Polygon.ts:109](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L109)
|
|
166
|
-
|
|
167
|
-
___
|
|
168
|
-
|
|
169
|
-
### ensureLastPoint
|
|
170
|
-
|
|
171
|
-
▸ **ensureLastPoint**(): [`Polygon`](Polygon.md)
|
|
172
|
-
|
|
173
|
-
#### Returns
|
|
174
|
-
|
|
175
|
-
[`Polygon`](Polygon.md)
|
|
176
|
-
|
|
177
|
-
#### Defined in
|
|
178
|
-
|
|
179
|
-
[src/Polygon.ts:59](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L59)
|
|
180
|
-
|
|
181
|
-
___
|
|
182
|
-
|
|
183
|
-
### equals
|
|
184
|
-
|
|
185
|
-
▸ **equals**(`other`): `boolean`
|
|
186
|
-
|
|
187
|
-
#### Parameters
|
|
188
|
-
|
|
189
|
-
| Name | Type |
|
|
190
|
-
| :------ | :------ |
|
|
191
|
-
| `other` | [`Polygon`](Polygon.md) |
|
|
192
|
-
|
|
193
|
-
#### Returns
|
|
194
|
-
|
|
195
|
-
`boolean`
|
|
196
|
-
|
|
197
|
-
#### Defined in
|
|
198
|
-
|
|
199
|
-
[src/Polygon.ts:129](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L129)
|
|
200
|
-
|
|
201
|
-
___
|
|
202
|
-
|
|
203
|
-
### flip
|
|
204
|
-
|
|
205
|
-
▸ **flip**(): [`Polygon`](Polygon.md)
|
|
206
|
-
|
|
207
|
-
#### Returns
|
|
208
|
-
|
|
209
|
-
[`Polygon`](Polygon.md)
|
|
210
|
-
|
|
211
|
-
#### Defined in
|
|
212
|
-
|
|
213
|
-
[src/Polygon.ts:98](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L98)
|
|
214
|
-
|
|
215
|
-
___
|
|
216
|
-
|
|
217
|
-
### perimeter
|
|
218
|
-
|
|
219
|
-
▸ **perimeter**(): `number`
|
|
220
|
-
|
|
221
|
-
#### Returns
|
|
222
|
-
|
|
223
|
-
`number`
|
|
224
|
-
|
|
225
|
-
#### Defined in
|
|
226
|
-
|
|
227
|
-
[src/Polygon.ts:105](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L105)
|
|
228
|
-
|
|
229
|
-
___
|
|
230
|
-
|
|
231
|
-
### toBoundingPolygon
|
|
232
|
-
|
|
233
|
-
▸ **toBoundingPolygon**(): [`Polygon`](Polygon.md)
|
|
234
|
-
|
|
235
|
-
#### Returns
|
|
236
|
-
|
|
237
|
-
[`Polygon`](Polygon.md)
|
|
238
|
-
|
|
239
|
-
#### Defined in
|
|
240
|
-
|
|
241
|
-
[src/Polygon.ts:88](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L88)
|
|
242
|
-
|
|
243
|
-
___
|
|
244
|
-
|
|
245
|
-
### toRectangle
|
|
246
|
-
|
|
247
|
-
▸ **toRectangle**(): [`Rectangle`](Rectangle.md)
|
|
248
|
-
|
|
249
|
-
#### Returns
|
|
250
|
-
|
|
251
|
-
[`Rectangle`](Rectangle.md)
|
|
252
|
-
|
|
253
|
-
#### Defined in
|
|
254
|
-
|
|
255
|
-
[src/Polygon.ts:120](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L120)
|
|
256
|
-
|
|
257
|
-
___
|
|
258
|
-
|
|
259
|
-
### fromPoints
|
|
260
|
-
|
|
261
|
-
▸ **fromPoints**(`contour`, `holes?`): [`Polygon`](Polygon.md)
|
|
262
|
-
|
|
263
|
-
#### Parameters
|
|
264
|
-
|
|
265
|
-
| Name | Type |
|
|
266
|
-
| :------ | :------ |
|
|
267
|
-
| `contour` | [`Point2`](../interfaces/Point2.md)[] |
|
|
268
|
-
| `holes?` | [`Point2`](../interfaces/Point2.md)[][] |
|
|
269
|
-
|
|
270
|
-
#### Returns
|
|
271
|
-
|
|
272
|
-
[`Polygon`](Polygon.md)
|
|
273
|
-
|
|
274
|
-
#### Defined in
|
|
275
|
-
|
|
276
|
-
[src/Polygon.ts:13](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L13)
|
|
277
|
-
|
|
278
|
-
___
|
|
279
|
-
|
|
280
|
-
### fromSize
|
|
281
|
-
|
|
282
|
-
▸ **fromSize**(`width`, `height`): [`Polygon`](Polygon.md)
|
|
283
|
-
|
|
284
|
-
#### Parameters
|
|
285
|
-
|
|
286
|
-
| Name | Type |
|
|
287
|
-
| :------ | :------ |
|
|
288
|
-
| `width` | `number` |
|
|
289
|
-
| `height` | `number` |
|
|
290
|
-
|
|
291
|
-
#### Returns
|
|
292
|
-
|
|
293
|
-
[`Polygon`](Polygon.md)
|
|
294
|
-
|
|
295
|
-
#### Defined in
|
|
296
|
-
|
|
297
|
-
[src/Polygon.ts:17](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L17)
|
|
1
|
+
[@immugio/three-math-extensions](../../README.md) / [Exports](../modules.md) / Polygon
|
|
2
|
+
|
|
3
|
+
# Class: Polygon
|
|
4
|
+
|
|
5
|
+
## Table of contents
|
|
6
|
+
|
|
7
|
+
### Constructors
|
|
8
|
+
|
|
9
|
+
- [constructor](Polygon.md#constructor)
|
|
10
|
+
|
|
11
|
+
### Properties
|
|
12
|
+
|
|
13
|
+
- [contour](Polygon.md#contour)
|
|
14
|
+
- [holes](Polygon.md#holes)
|
|
15
|
+
|
|
16
|
+
### Accessors
|
|
17
|
+
|
|
18
|
+
- [size](Polygon.md#size)
|
|
19
|
+
|
|
20
|
+
### Methods
|
|
21
|
+
|
|
22
|
+
- [boundingBox](Polygon.md#boundingbox)
|
|
23
|
+
- [center](Polygon.md#center)
|
|
24
|
+
- [centerOnOrigin](Polygon.md#centeronorigin)
|
|
25
|
+
- [clone](Polygon.md#clone)
|
|
26
|
+
- [containsPoint](Polygon.md#containspoint)
|
|
27
|
+
- [ensureLastPoint](Polygon.md#ensurelastpoint)
|
|
28
|
+
- [equals](Polygon.md#equals)
|
|
29
|
+
- [flip](Polygon.md#flip)
|
|
30
|
+
- [perimeter](Polygon.md#perimeter)
|
|
31
|
+
- [toBoundingPolygon](Polygon.md#toboundingpolygon)
|
|
32
|
+
- [toRectangle](Polygon.md#torectangle)
|
|
33
|
+
- [fromPoints](Polygon.md#frompoints)
|
|
34
|
+
- [fromSize](Polygon.md#fromsize)
|
|
35
|
+
|
|
36
|
+
## Constructors
|
|
37
|
+
|
|
38
|
+
### constructor
|
|
39
|
+
|
|
40
|
+
• **new Polygon**(`contour`, `holes?`): [`Polygon`](Polygon.md)
|
|
41
|
+
|
|
42
|
+
#### Parameters
|
|
43
|
+
|
|
44
|
+
| Name | Type |
|
|
45
|
+
| :------ | :------ |
|
|
46
|
+
| `contour` | [`Vec2`](Vec2.md)[] |
|
|
47
|
+
| `holes?` | [`Vec2`](Vec2.md)[][] |
|
|
48
|
+
|
|
49
|
+
#### Returns
|
|
50
|
+
|
|
51
|
+
[`Polygon`](Polygon.md)
|
|
52
|
+
|
|
53
|
+
#### Defined in
|
|
54
|
+
|
|
55
|
+
[src/Polygon.ts:10](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L10)
|
|
56
|
+
|
|
57
|
+
## Properties
|
|
58
|
+
|
|
59
|
+
### contour
|
|
60
|
+
|
|
61
|
+
• **contour**: [`Vec2`](Vec2.md)[]
|
|
62
|
+
|
|
63
|
+
#### Defined in
|
|
64
|
+
|
|
65
|
+
[src/Polygon.ts:10](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L10)
|
|
66
|
+
|
|
67
|
+
___
|
|
68
|
+
|
|
69
|
+
### holes
|
|
70
|
+
|
|
71
|
+
• `Optional` **holes**: [`Vec2`](Vec2.md)[][]
|
|
72
|
+
|
|
73
|
+
#### Defined in
|
|
74
|
+
|
|
75
|
+
[src/Polygon.ts:10](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L10)
|
|
76
|
+
|
|
77
|
+
## Accessors
|
|
78
|
+
|
|
79
|
+
### size
|
|
80
|
+
|
|
81
|
+
• `get` **size**(): [`Vec2`](Vec2.md)
|
|
82
|
+
|
|
83
|
+
#### Returns
|
|
84
|
+
|
|
85
|
+
[`Vec2`](Vec2.md)
|
|
86
|
+
|
|
87
|
+
#### Defined in
|
|
88
|
+
|
|
89
|
+
[src/Polygon.ts:26](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L26)
|
|
90
|
+
|
|
91
|
+
## Methods
|
|
92
|
+
|
|
93
|
+
### boundingBox
|
|
94
|
+
|
|
95
|
+
▸ **boundingBox**(): [`BoundingBox`](BoundingBox.md)
|
|
96
|
+
|
|
97
|
+
#### Returns
|
|
98
|
+
|
|
99
|
+
[`BoundingBox`](BoundingBox.md)
|
|
100
|
+
|
|
101
|
+
#### Defined in
|
|
102
|
+
|
|
103
|
+
[src/Polygon.ts:75](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L75)
|
|
104
|
+
|
|
105
|
+
___
|
|
106
|
+
|
|
107
|
+
### center
|
|
108
|
+
|
|
109
|
+
▸ **center**(): [`Vec2`](Vec2.md)
|
|
110
|
+
|
|
111
|
+
#### Returns
|
|
112
|
+
|
|
113
|
+
[`Vec2`](Vec2.md)
|
|
114
|
+
|
|
115
|
+
#### Defined in
|
|
116
|
+
|
|
117
|
+
[src/Polygon.ts:50](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L50)
|
|
118
|
+
|
|
119
|
+
___
|
|
120
|
+
|
|
121
|
+
### centerOnOrigin
|
|
122
|
+
|
|
123
|
+
▸ **centerOnOrigin**(): [`Polygon`](Polygon.md)
|
|
124
|
+
|
|
125
|
+
#### Returns
|
|
126
|
+
|
|
127
|
+
[`Polygon`](Polygon.md)
|
|
128
|
+
|
|
129
|
+
#### Defined in
|
|
130
|
+
|
|
131
|
+
[src/Polygon.ts:31](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L31)
|
|
132
|
+
|
|
133
|
+
___
|
|
134
|
+
|
|
135
|
+
### clone
|
|
136
|
+
|
|
137
|
+
▸ **clone**(): [`Polygon`](Polygon.md)
|
|
138
|
+
|
|
139
|
+
#### Returns
|
|
140
|
+
|
|
141
|
+
[`Polygon`](Polygon.md)
|
|
142
|
+
|
|
143
|
+
#### Defined in
|
|
144
|
+
|
|
145
|
+
[src/Polygon.ts:125](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L125)
|
|
146
|
+
|
|
147
|
+
___
|
|
148
|
+
|
|
149
|
+
### containsPoint
|
|
150
|
+
|
|
151
|
+
▸ **containsPoint**(`point`): `boolean`
|
|
152
|
+
|
|
153
|
+
#### Parameters
|
|
154
|
+
|
|
155
|
+
| Name | Type |
|
|
156
|
+
| :------ | :------ |
|
|
157
|
+
| `point` | [`Vec2`](Vec2.md) |
|
|
158
|
+
|
|
159
|
+
#### Returns
|
|
160
|
+
|
|
161
|
+
`boolean`
|
|
162
|
+
|
|
163
|
+
#### Defined in
|
|
164
|
+
|
|
165
|
+
[src/Polygon.ts:109](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L109)
|
|
166
|
+
|
|
167
|
+
___
|
|
168
|
+
|
|
169
|
+
### ensureLastPoint
|
|
170
|
+
|
|
171
|
+
▸ **ensureLastPoint**(): [`Polygon`](Polygon.md)
|
|
172
|
+
|
|
173
|
+
#### Returns
|
|
174
|
+
|
|
175
|
+
[`Polygon`](Polygon.md)
|
|
176
|
+
|
|
177
|
+
#### Defined in
|
|
178
|
+
|
|
179
|
+
[src/Polygon.ts:59](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L59)
|
|
180
|
+
|
|
181
|
+
___
|
|
182
|
+
|
|
183
|
+
### equals
|
|
184
|
+
|
|
185
|
+
▸ **equals**(`other`): `boolean`
|
|
186
|
+
|
|
187
|
+
#### Parameters
|
|
188
|
+
|
|
189
|
+
| Name | Type |
|
|
190
|
+
| :------ | :------ |
|
|
191
|
+
| `other` | [`Polygon`](Polygon.md) |
|
|
192
|
+
|
|
193
|
+
#### Returns
|
|
194
|
+
|
|
195
|
+
`boolean`
|
|
196
|
+
|
|
197
|
+
#### Defined in
|
|
198
|
+
|
|
199
|
+
[src/Polygon.ts:129](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L129)
|
|
200
|
+
|
|
201
|
+
___
|
|
202
|
+
|
|
203
|
+
### flip
|
|
204
|
+
|
|
205
|
+
▸ **flip**(): [`Polygon`](Polygon.md)
|
|
206
|
+
|
|
207
|
+
#### Returns
|
|
208
|
+
|
|
209
|
+
[`Polygon`](Polygon.md)
|
|
210
|
+
|
|
211
|
+
#### Defined in
|
|
212
|
+
|
|
213
|
+
[src/Polygon.ts:98](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L98)
|
|
214
|
+
|
|
215
|
+
___
|
|
216
|
+
|
|
217
|
+
### perimeter
|
|
218
|
+
|
|
219
|
+
▸ **perimeter**(): `number`
|
|
220
|
+
|
|
221
|
+
#### Returns
|
|
222
|
+
|
|
223
|
+
`number`
|
|
224
|
+
|
|
225
|
+
#### Defined in
|
|
226
|
+
|
|
227
|
+
[src/Polygon.ts:105](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L105)
|
|
228
|
+
|
|
229
|
+
___
|
|
230
|
+
|
|
231
|
+
### toBoundingPolygon
|
|
232
|
+
|
|
233
|
+
▸ **toBoundingPolygon**(): [`Polygon`](Polygon.md)
|
|
234
|
+
|
|
235
|
+
#### Returns
|
|
236
|
+
|
|
237
|
+
[`Polygon`](Polygon.md)
|
|
238
|
+
|
|
239
|
+
#### Defined in
|
|
240
|
+
|
|
241
|
+
[src/Polygon.ts:88](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L88)
|
|
242
|
+
|
|
243
|
+
___
|
|
244
|
+
|
|
245
|
+
### toRectangle
|
|
246
|
+
|
|
247
|
+
▸ **toRectangle**(): [`Rectangle`](Rectangle.md)
|
|
248
|
+
|
|
249
|
+
#### Returns
|
|
250
|
+
|
|
251
|
+
[`Rectangle`](Rectangle.md)
|
|
252
|
+
|
|
253
|
+
#### Defined in
|
|
254
|
+
|
|
255
|
+
[src/Polygon.ts:120](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L120)
|
|
256
|
+
|
|
257
|
+
___
|
|
258
|
+
|
|
259
|
+
### fromPoints
|
|
260
|
+
|
|
261
|
+
▸ **fromPoints**(`contour`, `holes?`): [`Polygon`](Polygon.md)
|
|
262
|
+
|
|
263
|
+
#### Parameters
|
|
264
|
+
|
|
265
|
+
| Name | Type |
|
|
266
|
+
| :------ | :------ |
|
|
267
|
+
| `contour` | [`Point2`](../interfaces/Point2.md)[] |
|
|
268
|
+
| `holes?` | [`Point2`](../interfaces/Point2.md)[][] |
|
|
269
|
+
|
|
270
|
+
#### Returns
|
|
271
|
+
|
|
272
|
+
[`Polygon`](Polygon.md)
|
|
273
|
+
|
|
274
|
+
#### Defined in
|
|
275
|
+
|
|
276
|
+
[src/Polygon.ts:13](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L13)
|
|
277
|
+
|
|
278
|
+
___
|
|
279
|
+
|
|
280
|
+
### fromSize
|
|
281
|
+
|
|
282
|
+
▸ **fromSize**(`width`, `height`): [`Polygon`](Polygon.md)
|
|
283
|
+
|
|
284
|
+
#### Parameters
|
|
285
|
+
|
|
286
|
+
| Name | Type |
|
|
287
|
+
| :------ | :------ |
|
|
288
|
+
| `width` | `number` |
|
|
289
|
+
| `height` | `number` |
|
|
290
|
+
|
|
291
|
+
#### Returns
|
|
292
|
+
|
|
293
|
+
[`Polygon`](Polygon.md)
|
|
294
|
+
|
|
295
|
+
#### Defined in
|
|
296
|
+
|
|
297
|
+
[src/Polygon.ts:17](https://github.com/Immugio/three-math-extensions/blob/e397290/src/Polygon.ts#L17)
|