plotboilerplate 1.23.2 → 1.24.0

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 (218) hide show
  1. package/README.md +6 -0
  2. package/dist/index.esm.js +8351 -6928
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.esm.min.js +1 -1
  5. package/dist/index.esm.min.js.map +1 -1
  6. package/dist/plotboilerplate.browser.min.js +1 -1
  7. package/dist/plotboilerplate.browser.min.js.map +1 -1
  8. package/dist/plotboilerplate.js +1590 -123
  9. package/dist/plotboilerplate.min.js +1 -1
  10. package/package.json +4 -2
  11. package/src/cjs/BezierPath.d.ts +41 -5
  12. package/src/cjs/BezierPath.js +52 -2
  13. package/src/cjs/BezierPath.js.map +1 -1
  14. package/src/cjs/Bounds.d.ts +67 -3
  15. package/src/cjs/Bounds.js +101 -3
  16. package/src/cjs/Bounds.js.map +1 -1
  17. package/src/cjs/Circle.d.ts +46 -4
  18. package/src/cjs/Circle.js +82 -3
  19. package/src/cjs/Circle.js.map +1 -1
  20. package/src/cjs/CircleSector.d.ts +51 -2
  21. package/src/cjs/CircleSector.js +112 -3
  22. package/src/cjs/CircleSector.js.map +1 -1
  23. package/src/cjs/CubicBezierCurve.d.ts +113 -7
  24. package/src/cjs/CubicBezierCurve.js +281 -33
  25. package/src/cjs/CubicBezierCurve.js.map +1 -1
  26. package/src/cjs/Line.d.ts +38 -3
  27. package/src/cjs/Line.js +64 -1
  28. package/src/cjs/Line.js.map +1 -1
  29. package/src/cjs/PlotBoilerplate.d.ts +4 -2
  30. package/src/cjs/PlotBoilerplate.js +9 -12
  31. package/src/cjs/PlotBoilerplate.js.map +1 -1
  32. package/src/cjs/Polygon.d.ts +153 -6
  33. package/src/cjs/Polygon.js +304 -23
  34. package/src/cjs/Polygon.js.map +1 -1
  35. package/src/cjs/Triangle.d.ts +73 -4
  36. package/src/cjs/Triangle.js +94 -2
  37. package/src/cjs/Triangle.js.map +1 -1
  38. package/src/cjs/VEllipse.d.ts +62 -3
  39. package/src/cjs/VEllipse.js +181 -17
  40. package/src/cjs/VEllipse.js.map +1 -1
  41. package/src/cjs/VEllipseSector.d.ts +86 -2
  42. package/src/cjs/VEllipseSector.js +148 -4
  43. package/src/cjs/VEllipseSector.js.map +1 -1
  44. package/src/cjs/Vector.d.ts +12 -2
  45. package/src/cjs/Vector.js +15 -2
  46. package/src/cjs/Vector.js.map +1 -1
  47. package/src/cjs/VertTuple.d.ts +39 -10
  48. package/src/cjs/VertTuple.js +49 -11
  49. package/src/cjs/VertTuple.js.map +1 -1
  50. package/src/cjs/Vertex.d.ts +18 -2
  51. package/src/cjs/Vertex.js +22 -2
  52. package/src/cjs/Vertex.js.map +1 -1
  53. package/src/cjs/draw.d.ts +1 -0
  54. package/src/cjs/draw.js +2 -1
  55. package/src/cjs/draw.js.map +1 -1
  56. package/src/cjs/drawutilssvg.js +24 -0
  57. package/src/cjs/drawutilssvg.js.map +1 -1
  58. package/src/cjs/geomutils.d.ts +32 -1
  59. package/src/cjs/geomutils.js +47 -1
  60. package/src/cjs/geomutils.js.map +1 -1
  61. package/src/cjs/interfaces/core.d.ts +39 -0
  62. package/src/cjs/interfaces/core.js +2 -0
  63. package/src/cjs/interfaces/core.js.map +1 -1
  64. package/src/cjs/utils/algorithms/PolygonInset.d.ts +184 -0
  65. package/src/cjs/utils/algorithms/PolygonInset.js +431 -0
  66. package/src/cjs/utils/algorithms/PolygonInset.js.map +1 -0
  67. package/src/cjs/utils/algorithms/clearDuplicateVertices.d.ts +5 -4
  68. package/src/cjs/utils/algorithms/clearDuplicateVertices.js +6 -3
  69. package/src/cjs/utils/algorithms/clearDuplicateVertices.js.map +1 -1
  70. package/src/cjs/utils/algorithms/convexPolygonIncircle.d.ts +2 -1
  71. package/src/cjs/utils/algorithms/convexPolygonIncircle.js +14 -6
  72. package/src/cjs/utils/algorithms/convexPolygonIncircle.js.map +1 -1
  73. package/src/cjs/utils/algorithms/findPolygonSelfIntersections.d.ts +2 -1
  74. package/src/cjs/utils/algorithms/findPolygonSelfIntersections.js +3 -3
  75. package/src/cjs/utils/algorithms/findPolygonSelfIntersections.js.map +1 -1
  76. package/src/cjs/utils/algorithms/splitPolygonToNonIntersecting.d.ts +3 -2
  77. package/src/cjs/utils/algorithms/splitPolygonToNonIntersecting.js +11 -9
  78. package/src/cjs/utils/algorithms/splitPolygonToNonIntersecting.js.map +1 -1
  79. package/src/cjs/utils/createRandomizedPolygon.d.ts +14 -0
  80. package/src/cjs/utils/createRandomizedPolygon.js +32 -0
  81. package/src/cjs/utils/createRandomizedPolygon.js.map +1 -0
  82. package/src/cjs/utils/detectDarkMode.js.map +1 -1
  83. package/src/cjs/utils/dom/guiSizeToggler.d.ts +2 -1
  84. package/src/cjs/utils/dom/guiSizeToggler.js +5 -3
  85. package/src/cjs/utils/dom/guiSizeToggler.js.map +1 -1
  86. package/src/cjs/utils/helpers/BezierPathInteractionHelper.d.ts +9 -7
  87. package/src/cjs/utils/helpers/BezierPathInteractionHelper.js +37 -23
  88. package/src/cjs/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
  89. package/src/cjs/utils/helpers/CircleSectorHelper.d.ts +10 -1
  90. package/src/cjs/utils/helpers/CircleSectorHelper.js +19 -20
  91. package/src/cjs/utils/helpers/CircleSectorHelper.js.map +1 -1
  92. package/src/cjs/utils/helpers/VEllipseHelper.d.ts +30 -0
  93. package/src/cjs/utils/helpers/VEllipseHelper.js +86 -0
  94. package/src/cjs/utils/helpers/VEllipseHelper.js.map +1 -0
  95. package/src/cjs/utils/helpers/VEllipseSectorHelper.d.ts +42 -3
  96. package/src/cjs/utils/helpers/VEllipseSectorHelper.js +107 -25
  97. package/src/cjs/utils/helpers/VEllipseSectorHelper.js.map +1 -1
  98. package/src/createDemoDrawables.js +3 -1
  99. package/src/esm/BezierPath.d.ts +41 -5
  100. package/src/esm/BezierPath.js +50 -2
  101. package/src/esm/BezierPath.js.map +1 -1
  102. package/src/esm/Bounds.d.ts +67 -3
  103. package/src/esm/Bounds.js +101 -3
  104. package/src/esm/Bounds.js.map +1 -1
  105. package/src/esm/Circle.d.ts +46 -4
  106. package/src/esm/Circle.js +79 -3
  107. package/src/esm/Circle.js.map +1 -1
  108. package/src/esm/CircleSector.d.ts +51 -2
  109. package/src/esm/CircleSector.js +108 -3
  110. package/src/esm/CircleSector.js.map +1 -1
  111. package/src/esm/CubicBezierCurve.d.ts +113 -7
  112. package/src/esm/CubicBezierCurve.js +277 -33
  113. package/src/esm/CubicBezierCurve.js.map +1 -1
  114. package/src/esm/Line.d.ts +38 -3
  115. package/src/esm/Line.js +62 -1
  116. package/src/esm/Line.js.map +1 -1
  117. package/src/esm/PlotBoilerplate.d.ts +4 -2
  118. package/src/esm/PlotBoilerplate.js +9 -12
  119. package/src/esm/PlotBoilerplate.js.map +1 -1
  120. package/src/esm/Polygon.d.ts +153 -6
  121. package/src/esm/Polygon.js +301 -23
  122. package/src/esm/Polygon.js.map +1 -1
  123. package/src/esm/Triangle.d.ts +73 -4
  124. package/src/esm/Triangle.js +91 -2
  125. package/src/esm/Triangle.js.map +1 -1
  126. package/src/esm/VEllipse.d.ts +62 -3
  127. package/src/esm/VEllipse.js +178 -17
  128. package/src/esm/VEllipse.js.map +1 -1
  129. package/src/esm/VEllipseSector.d.ts +86 -2
  130. package/src/esm/VEllipseSector.js +146 -7
  131. package/src/esm/VEllipseSector.js.map +1 -1
  132. package/src/esm/Vector.d.ts +12 -2
  133. package/src/esm/Vector.js +15 -2
  134. package/src/esm/Vector.js.map +1 -1
  135. package/src/esm/VertTuple.d.ts +39 -10
  136. package/src/esm/VertTuple.js +49 -11
  137. package/src/esm/VertTuple.js.map +1 -1
  138. package/src/esm/Vertex.d.ts +18 -2
  139. package/src/esm/Vertex.js +22 -2
  140. package/src/esm/Vertex.js.map +1 -1
  141. package/src/esm/draw.d.ts +1 -0
  142. package/src/esm/draw.js +2 -1
  143. package/src/esm/draw.js.map +1 -1
  144. package/src/esm/drawutilssvg.js +24 -0
  145. package/src/esm/drawutilssvg.js.map +1 -1
  146. package/src/esm/geomutils.d.ts +32 -1
  147. package/src/esm/geomutils.js +47 -1
  148. package/src/esm/geomutils.js.map +1 -1
  149. package/src/esm/interfaces/core.d.ts +39 -0
  150. package/src/esm/interfaces/core.js +2 -0
  151. package/src/esm/interfaces/core.js.map +1 -1
  152. package/src/esm/utils/algorithms/PolygonInset.d.ts +184 -0
  153. package/src/esm/utils/algorithms/PolygonInset.js +424 -0
  154. package/src/esm/utils/algorithms/PolygonInset.js.map +1 -0
  155. package/src/esm/utils/algorithms/clearDuplicateVertices.d.ts +5 -4
  156. package/src/esm/utils/algorithms/clearDuplicateVertices.js +6 -3
  157. package/src/esm/utils/algorithms/clearDuplicateVertices.js.map +1 -1
  158. package/src/esm/utils/algorithms/convexPolygonIncircle.d.ts +2 -1
  159. package/src/esm/utils/algorithms/convexPolygonIncircle.js +15 -7
  160. package/src/esm/utils/algorithms/convexPolygonIncircle.js.map +1 -1
  161. package/src/esm/utils/algorithms/createRandomizedPolygon.d.ts +14 -0
  162. package/src/esm/utils/algorithms/createRandomizedPolygon.js +28 -0
  163. package/src/esm/utils/algorithms/createRandomizedPolygon.js.map +1 -0
  164. package/src/esm/utils/algorithms/findPolygonSelfIntersections.d.ts +2 -1
  165. package/src/esm/utils/algorithms/findPolygonSelfIntersections.js +3 -3
  166. package/src/esm/utils/algorithms/findPolygonSelfIntersections.js.map +1 -1
  167. package/src/esm/utils/algorithms/splitPolygonToNonIntersecting.d.ts +3 -2
  168. package/src/esm/utils/algorithms/splitPolygonToNonIntersecting.js +11 -9
  169. package/src/esm/utils/algorithms/splitPolygonToNonIntersecting.js.map +1 -1
  170. package/src/esm/utils/createRandomizedPolygon.d.ts +14 -0
  171. package/src/esm/utils/createRandomizedPolygon.js +28 -0
  172. package/src/esm/utils/createRandomizedPolygon.js.map +1 -0
  173. package/src/esm/utils/detectDarkMode.js.map +1 -1
  174. package/src/esm/utils/dom/guiSizeToggler.d.ts +2 -1
  175. package/src/esm/utils/dom/guiSizeToggler.js +4 -2
  176. package/src/esm/utils/dom/guiSizeToggler.js.map +1 -1
  177. package/src/esm/utils/helpers/BezierPathInteractionHelper.d.ts +9 -7
  178. package/src/esm/utils/helpers/BezierPathInteractionHelper.js +35 -22
  179. package/src/esm/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
  180. package/src/esm/utils/helpers/CircleSectorHelper.d.ts +10 -1
  181. package/src/esm/utils/helpers/CircleSectorHelper.js +19 -20
  182. package/src/esm/utils/helpers/CircleSectorHelper.js.map +1 -1
  183. package/src/esm/utils/helpers/VEllipseHelper.d.ts +30 -0
  184. package/src/esm/utils/helpers/VEllipseHelper.js +81 -0
  185. package/src/esm/utils/helpers/VEllipseHelper.js.map +1 -0
  186. package/src/esm/utils/helpers/VEllipseSectorHelper.d.ts +42 -3
  187. package/src/esm/utils/helpers/VEllipseSectorHelper.js +106 -24
  188. package/src/esm/utils/helpers/VEllipseSectorHelper.js.map +1 -1
  189. package/src/ts/BezierPath.ts +58 -5
  190. package/src/ts/Bounds.ts +110 -6
  191. package/src/ts/Circle.ts +87 -5
  192. package/src/ts/CircleSector.ts +115 -5
  193. package/src/ts/CubicBezierCurve.ts +332 -42
  194. package/src/ts/Line.ts +66 -3
  195. package/src/ts/PlotBoilerplate.ts +10 -12
  196. package/src/ts/Polygon.ts +329 -27
  197. package/src/ts/Triangle.ts +101 -5
  198. package/src/ts/VEllipse.ts +214 -19
  199. package/src/ts/VEllipseSector.ts +154 -8
  200. package/src/ts/Vector.ts +16 -2
  201. package/src/ts/VertTuple.ts +53 -13
  202. package/src/ts/Vertex.ts +24 -3
  203. package/src/ts/draw.ts +2 -1
  204. package/src/ts/drawutilssvg.ts +29 -0
  205. package/src/ts/geomutils.ts +49 -1
  206. package/src/ts/interfaces/core.ts +42 -0
  207. package/src/ts/utils/algorithms/PolygonInset.ts +529 -0
  208. package/src/ts/utils/algorithms/clearDuplicateVertices.ts +11 -8
  209. package/src/ts/utils/algorithms/convexPolygonIncircle.ts +82 -78
  210. package/src/ts/utils/algorithms/findPolygonSelfIntersections.ts +25 -26
  211. package/src/ts/utils/algorithms/splitPolygonToNonIntersecting.ts +92 -99
  212. package/src/ts/utils/createRandomizedPolygon.ts +31 -0
  213. package/src/ts/utils/detectDarkMode.ts +1 -3
  214. package/src/ts/utils/dom/guiSizeToggler.ts +4 -2
  215. package/src/ts/utils/helpers/BezierPathInteractionHelper.ts +45 -29
  216. package/src/ts/utils/helpers/CircleSectorHelper.ts +115 -125
  217. package/src/ts/utils/helpers/VEllipseHelper.ts +113 -0
  218. package/src/ts/utils/helpers/VEllipseSectorHelper.ts +142 -25
@@ -28,16 +28,26 @@
28
28
  * @modified 2023-09-25 Added the `Polygon.lineIntersections(Line,boolean)` function.
29
29
  * @modified 2023-09-29 Added the `Polygon.closestLineIntersection(Line,boolean)` function.
30
30
  * @modified 2023-11-24 Added the `Polygon.containsPolygon(Polygon)' function.
31
- * @version 1.12.0
31
+ * @modified 2024-10-12 Added the `getEdgeAt` method.
32
+ * @modified 2024-10-30 Added the `getEdges` method.
33
+ * @modified 2024-12-02 Added the `elimitateColinearEdges` method.
34
+ * @modified 2025-02-12 Added the `containsVerts` method to test multiple vertices for containment.
35
+ * @modified 2025-03-28 Added the `Polygon.utils.locateLineIntersecion` static helper method.
36
+ * @modified 2025-03-28 Added the `Polygon.lineIntersectionTangents` method.
37
+ * @modified 2025-04-09 Added the `Polygon.getCentroid` method.
38
+ * @modified 2025-05-16 Class `Polygon` now implements `IBounded`.
39
+ * @version 1.15.0
32
40
  *
33
41
  * @file Polygon
34
42
  * @public
35
43
  **/
36
44
  import { BezierPath } from "./BezierPath";
37
45
  import { Bounds } from "./Bounds";
46
+ import { Line } from "./Line";
47
+ import { Vector } from "./Vector";
38
48
  import { VertTuple } from "./VertTuple";
39
49
  import { Vertex } from "./Vertex";
40
- import { XYCoords, SVGSerializable, UID } from "./interfaces";
50
+ import { XYCoords, SVGSerializable, UID, Intersectable, IBounded } from "./interfaces";
41
51
  /**
42
52
  * @classdesc A polygon class. Any polygon consists of an array of vertices; polygons can be open or closed.
43
53
  *
@@ -49,7 +59,7 @@ import { XYCoords, SVGSerializable, UID } from "./interfaces";
49
59
  * @requires Vertex
50
60
  * @requires XYCoords
51
61
  */
52
- export declare class Polygon implements SVGSerializable {
62
+ export declare class Polygon implements IBounded, Intersectable, SVGSerializable {
53
63
  /**
54
64
  * Required to generate proper CSS classes and other class related IDs.
55
65
  **/
@@ -96,12 +106,66 @@ export declare class Polygon implements SVGSerializable {
96
106
  /**
97
107
  * Add a vertex to the end of the `vertices` array.
98
108
  *
99
- * @method addVert
109
+ * @method addVertex
100
110
  * @param {Vertex} vert - The vertex to add.
101
111
  * @instance
102
112
  * @memberof Polygon
103
113
  **/
104
114
  addVertex(vert: Vertex): void;
115
+ /**
116
+ * Add a vertex at a particular position of the `vertices` array.
117
+ *
118
+ * @method addVertexAt
119
+ * @param {Vertex} vert - The vertex to add.
120
+ * @param {number} index - The position to add the vertex at. Will be handled modulo.
121
+ * @instance
122
+ * @memberof Polygon
123
+ **/
124
+ addVertexAt(vert: Vertex, index: number): void;
125
+ /**
126
+ * Get a new instance of the line at the given start index. The returned line will consist
127
+ * of the vertex at `vertIndex` and `vertIndex+1` (will be handled modulo).
128
+ *
129
+ * @method getEdgeAt
130
+ * @param {number} vertIndex - The vertex index of the line to start.
131
+ * @instance
132
+ * @memberof Polygon
133
+ * @return {Line}
134
+ **/
135
+ getEdgeAt(vertIndex: number): Line;
136
+ /**
137
+ * Converts this polygon into a sequence of lines. Please note that each time
138
+ * this method is called new lines are created. The underlying line vertices are no clones
139
+ * (instances).
140
+ *
141
+ * @method getEdges
142
+ * @instance
143
+ * @memberof Polygon
144
+ * @return {Array<Line>}
145
+ */
146
+ getEdges(): Array<Line>;
147
+ /**
148
+ * Checks if the angle at the given polygon vertex (index) is acute. Please not that this is
149
+ * only working for clockwise polygons. If this polygon is not clockwise please use the
150
+ * `isClockwise` method and reverse polygon vertices if needed.
151
+ *
152
+ * @method isAngleAcute
153
+ * @instance
154
+ * @memberof Polygon
155
+ * @param {number} vertIndex - The index of the polygon vertex to check.
156
+ * @returns {boolean} `true` is angle is acute, `false` is obtuse.
157
+ */
158
+ getInnerAngleAt(vertIndex: number): number;
159
+ /**
160
+ * Checks if the angle at the given polygon vertex (index) is acute.
161
+ *
162
+ * @method isAngleAcute
163
+ * @instance
164
+ * @memberof Polygon
165
+ * @param {number} vertIndex - The index of the polygon vertex to check.
166
+ * @returns {boolean} `true` is angle is acute, `false` is obtuse.
167
+ */
168
+ isAngleAcute(vertIndex: number): boolean;
105
169
  /**
106
170
  * Get the polygon vertex at the given position (index).
107
171
  *
@@ -112,7 +176,7 @@ export declare class Polygon implements SVGSerializable {
112
176
  * - getVertexAt( vertices.length + k ) == getVertexAt( k )
113
177
  * - getVertexAt( -k ) == getVertexAt( vertices.length -k )
114
178
  *
115
- * @metho getVertexAt
179
+ * @method getVertexAt
116
180
  * @param {number} index - The index of the desired vertex.
117
181
  * @instance
118
182
  * @memberof Polygon
@@ -136,12 +200,24 @@ export declare class Polygon implements SVGSerializable {
136
200
  * https://stackoverflow.com/questions/22521982/check-if-point-inside-a-polygon
137
201
  *
138
202
  * @method containsVert
139
- * @param {XYCoords} vert - The vertex to check. The new x-component.
203
+ * @param {XYCoords} vert - The vertex to check.
140
204
  * @return {boolean} True if the passed vertex is inside this polygon. The polygon is considered closed.
141
205
  * @instance
142
206
  * @memberof Polygon
143
207
  **/
144
208
  containsVert(vert: XYCoords): boolean;
209
+ /**
210
+ * Check if all given vertices are inside this polygon.<br>
211
+ * <br>
212
+ * This method just uses the `Polygon.containsVert` method.
213
+ *
214
+ * @method containsVerts
215
+ * @param {XYCoords[]} verts - The vertices to check.
216
+ * @return {boolean} True if all passed vertices are inside this polygon. The polygon is considered closed.
217
+ * @instance
218
+ * @memberof Polygon
219
+ **/
220
+ containsVerts(verts: XYCoords[]): boolean;
145
221
  /**
146
222
  * Check if the passed polygon is completly contained inside this polygon.
147
223
  *
@@ -218,9 +294,36 @@ export declare class Polygon implements SVGSerializable {
218
294
  * @return {Polygon} this, for chaining.
219
295
  **/
220
296
  rotate(angle: number, center: Vertex): Polygon;
297
+ /**
298
+ * Get the mean `center` of this polygon by calculating the mean value of all vertices.
299
+ *
300
+ * Mean: (v[0] + v[1] + ... v[n-1]) / n
301
+ *
302
+ * @method getMeanCenter
303
+ * @instance
304
+ * @memberof Polygon
305
+ * @return {Vertex|null} `null` is no vertices are available.
306
+ */
307
+ getMeanCenter(): Vertex | null;
308
+ /**
309
+ * Get centroid.
310
+ * Centroids define the barycenter of any non self-intersecting convex polygon.
311
+ *
312
+ * If the polygon is self intersecting or non konvex then the barycenter is not well defined.
313
+ *
314
+ * https://mathworld.wolfram.com/PolygonCentroid.html
315
+ *
316
+ * @method getCentroid
317
+ * @instance
318
+ * @memberof Polygon
319
+ * @returns {Vertex|null}
320
+ */
321
+ getCentroid(): Vertex | null;
221
322
  /**
222
323
  * Get all line intersections with this polygon.
223
324
  *
325
+ * This method returns all intersections (as vertices) with this shape. The returned array of vertices is in no specific order.
326
+ *
224
327
  * See demo `47-closest-vector-projection-on-polygon` for how it works.
225
328
  *
226
329
  * @param {VertTuple} line - The line to find intersections with.
@@ -228,6 +331,16 @@ export declare class Polygon implements SVGSerializable {
228
331
  * @returns {Array<Vertex>} - An array of all intersections within the polygon bounds.
229
332
  */
230
333
  lineIntersections(line: VertTuple<any>, inVectorBoundsOnly?: boolean): Array<Vertex>;
334
+ /**
335
+ * Get all line intersections of this polygon and their tangents along the shape.
336
+ *
337
+ * This method returns all intersection tangents (as vectors) with this shape. The returned array of vectors is in no specific order.
338
+ *
339
+ * @param line
340
+ * @param inVectorBoundsOnly
341
+ * @returns
342
+ */
343
+ lineIntersectionTangents(line: VertTuple<any>, inVectorBoundsOnly?: boolean): Array<Vector>;
231
344
  /**
232
345
  * Get the closest line-polygon-intersection point (closest the line point A).
233
346
  *
@@ -266,9 +379,29 @@ export declare class Polygon implements SVGSerializable {
266
379
  /**
267
380
  * Create a deep copy of this polygon.
268
381
  *
382
+ * @method clone
383
+ * @instance
384
+ * @memberof Polygon
269
385
  * @return {Polygon} The cloned polygon.
270
386
  */
271
387
  clone(): Polygon;
388
+ /**
389
+ * Create a new polygon without colinear adjacent edges. This method does not midify the current polygon
390
+ * but creates a new one.
391
+ *
392
+ * Please note that this method does NOT create deep clones of the vertices. Use Polygon.clone() if you need to.
393
+ *
394
+ * Please also note that the `tolerance` may become really large here, as the denominator of two closely
395
+ * parallel lines is usually pretty large. See the demo `57-eliminate-colinear-polygon-edges` to get
396
+ * an impression of how denominators work.
397
+ *
398
+ * @method elimitateColinearEdges
399
+ * @instance
400
+ * @memberof Polygon
401
+ * @param {number?} tolerance - (default is 1.0) The epsilon to detect co-linear edges.
402
+ * @return {Polygon} A new polygon without co-linear adjacent edges – respective the given epsilon.
403
+ */
404
+ elimitateColinearEdges(tolerance?: number): Polygon;
272
405
  /**
273
406
  * Convert this polygon to a sequence of quadratic Bézier curves.<br>
274
407
  * <br>
@@ -342,6 +475,7 @@ export declare class Polygon implements SVGSerializable {
342
475
  * @return {number}
343
476
  */
344
477
  area(vertices: Array<XYCoords>): number;
478
+ isClockwise(vertices: Array<XYCoords>): boolean;
345
479
  /**
346
480
  * Calulate the signed polyon area by interpreting the polygon as a matrix
347
481
  * and calculating its determinant.
@@ -350,5 +484,18 @@ export declare class Polygon implements SVGSerializable {
350
484
  * @return {number}
351
485
  */
352
486
  signedArea(vertices: Array<XYCoords>): number;
487
+ /**
488
+ * Find intersections of a line with a polygon (vertices).
489
+ *
490
+ * @param {VertTuple<any>} line - The line to find intersections with.
491
+ * @param {Array<Vertex>} vertices - The polygon's vertices.
492
+ * @param {boolean} isOpen - True if the polygon is open, false otherwise.
493
+ * @param {boolean} inVectorBoundsOnly - If only intersections in strict vector bounds should be returned.
494
+ * @returns
495
+ */
496
+ locateLineIntersecion(line: VertTuple<any>, vertices: Array<Vertex>, isOpen: boolean, inVectorBoundsOnly: boolean): Array<{
497
+ edgeIndex: number;
498
+ intersectionPoint: Vertex;
499
+ }>;
353
500
  };
354
501
  }