plotboilerplate 1.20.2 → 1.22.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 (169) hide show
  1. package/dist/index.esm.js +2012 -1366
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.esm.min.js +1 -1
  4. package/dist/index.esm.min.js.map +1 -1
  5. package/dist/plotboilerplate.browser.min.js +1 -1
  6. package/dist/plotboilerplate.browser.min.js.map +1 -1
  7. package/dist/plotboilerplate.js +1199 -541
  8. package/dist/plotboilerplate.min.js +1 -1
  9. package/package.json +3 -2
  10. package/src/cjs/BezierPath.d.ts +27 -49
  11. package/src/cjs/BezierPath.js +67 -234
  12. package/src/cjs/BezierPath.js.map +1 -1
  13. package/src/cjs/Bounds.d.ts +14 -1
  14. package/src/cjs/Bounds.js +21 -1
  15. package/src/cjs/Bounds.js.map +1 -1
  16. package/src/cjs/CubicBezierCurve.d.ts +70 -1
  17. package/src/cjs/CubicBezierCurve.js +130 -12
  18. package/src/cjs/CubicBezierCurve.js.map +1 -1
  19. package/src/cjs/Line.d.ts +2 -1
  20. package/src/cjs/Line.js +1 -0
  21. package/src/cjs/Line.js.map +1 -1
  22. package/src/cjs/PBText.d.ts +2 -1
  23. package/src/cjs/PBText.js +10 -9
  24. package/src/cjs/PBText.js.map +1 -1
  25. package/src/cjs/PlotBoilerplate.d.ts +4 -13
  26. package/src/cjs/PlotBoilerplate.js +61 -15
  27. package/src/cjs/PlotBoilerplate.js.map +1 -1
  28. package/src/cjs/Polygon.d.ts +47 -1
  29. package/src/cjs/Polygon.js +116 -1
  30. package/src/cjs/Polygon.js.map +1 -1
  31. package/src/cjs/VEllipse.js +1 -1
  32. package/src/cjs/VEllipse.js.map +1 -1
  33. package/src/cjs/Vector.d.ts +4 -4
  34. package/src/cjs/Vector.js +2 -2
  35. package/src/cjs/Vector.js.map +1 -1
  36. package/src/cjs/VertTuple.d.ts +2 -1
  37. package/src/cjs/VertTuple.js +4 -3
  38. package/src/cjs/VertTuple.js.map +1 -1
  39. package/src/cjs/Vertex.d.ts +14 -3
  40. package/src/cjs/Vertex.js +18 -3
  41. package/src/cjs/Vertex.js.map +1 -1
  42. package/src/cjs/draw.d.ts +154 -75
  43. package/src/cjs/draw.js +308 -137
  44. package/src/cjs/draw.js.map +1 -1
  45. package/src/cjs/drawgl.d.ts +87 -50
  46. package/src/cjs/drawgl.js +86 -31
  47. package/src/cjs/drawgl.js.map +1 -1
  48. package/src/cjs/drawutilssvg.d.ts +226 -53
  49. package/src/cjs/drawutilssvg.js +374 -92
  50. package/src/cjs/drawutilssvg.js.map +1 -1
  51. package/src/cjs/interfaces/DrawLib.d.ts +157 -79
  52. package/src/cjs/interfaces/DrawLib.js +6 -0
  53. package/src/cjs/interfaces/DrawLib.js.map +1 -1
  54. package/src/cjs/interfaces/core.d.ts +13 -2
  55. package/src/cjs/interfaces/core.js +1 -0
  56. package/src/cjs/interfaces/core.js.map +1 -1
  57. package/src/cjs/utils/Params.d.ts +15 -0
  58. package/src/cjs/utils/Params.js +49 -0
  59. package/src/cjs/utils/Params.js.map +1 -0
  60. package/src/cjs/utils/algorithms/ContourLineDetection.d.ts +150 -0
  61. package/src/cjs/utils/algorithms/ContourLineDetection.js +367 -0
  62. package/src/cjs/utils/algorithms/ContourLineDetection.js.map +1 -0
  63. package/src/cjs/utils/algorithms/clearDuplicateVertices.d.ts +21 -0
  64. package/src/cjs/utils/algorithms/clearDuplicateVertices.js +48 -0
  65. package/src/cjs/utils/algorithms/clearDuplicateVertices.js.map +1 -0
  66. package/src/cjs/utils/creategui.js +16 -10
  67. package/src/cjs/utils/datastructures/DataGrid2d.d.ts +47 -0
  68. package/src/cjs/utils/datastructures/DataGrid2d.js +20 -0
  69. package/src/cjs/utils/datastructures/DataGrid2d.js.map +1 -0
  70. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.d.ts +65 -0
  71. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js +84 -0
  72. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
  73. package/src/cjs/utils/datastructures/GenericPath.d.ts +14 -3
  74. package/src/cjs/utils/datastructures/GenericPath.js +20 -3
  75. package/src/cjs/utils/datastructures/GenericPath.js.map +1 -1
  76. package/src/cjs/utils/detectDarkMode.d.ts +10 -0
  77. package/src/cjs/utils/detectDarkMode.js +32 -0
  78. package/src/cjs/utils/detectDarkMode.js.map +1 -0
  79. package/src/esm/BezierPath.d.ts +27 -49
  80. package/src/esm/BezierPath.js +67 -234
  81. package/src/esm/BezierPath.js.map +1 -1
  82. package/src/esm/Bounds.d.ts +14 -1
  83. package/src/esm/Bounds.js +19 -1
  84. package/src/esm/Bounds.js.map +1 -1
  85. package/src/esm/CubicBezierCurve.d.ts +70 -1
  86. package/src/esm/CubicBezierCurve.js +130 -12
  87. package/src/esm/CubicBezierCurve.js.map +1 -1
  88. package/src/esm/Line.d.ts +2 -1
  89. package/src/esm/Line.js +1 -0
  90. package/src/esm/Line.js.map +1 -1
  91. package/src/esm/PBText.d.ts +2 -1
  92. package/src/esm/PBText.js +10 -9
  93. package/src/esm/PBText.js.map +1 -1
  94. package/src/esm/PlotBoilerplate.d.ts +4 -13
  95. package/src/esm/PlotBoilerplate.js +62 -16
  96. package/src/esm/PlotBoilerplate.js.map +1 -1
  97. package/src/esm/Polygon.d.ts +47 -1
  98. package/src/esm/Polygon.js +114 -1
  99. package/src/esm/Polygon.js.map +1 -1
  100. package/src/esm/VEllipse.js +1 -1
  101. package/src/esm/VEllipse.js.map +1 -1
  102. package/src/esm/Vector.d.ts +4 -4
  103. package/src/esm/Vector.js +2 -2
  104. package/src/esm/Vector.js.map +1 -1
  105. package/src/esm/VertTuple.d.ts +2 -1
  106. package/src/esm/VertTuple.js +4 -3
  107. package/src/esm/VertTuple.js.map +1 -1
  108. package/src/esm/Vertex.d.ts +14 -3
  109. package/src/esm/Vertex.js +18 -3
  110. package/src/esm/Vertex.js.map +1 -1
  111. package/src/esm/draw.d.ts +154 -75
  112. package/src/esm/draw.js +304 -135
  113. package/src/esm/draw.js.map +1 -1
  114. package/src/esm/drawgl.d.ts +87 -50
  115. package/src/esm/drawgl.js +86 -31
  116. package/src/esm/drawgl.js.map +1 -1
  117. package/src/esm/drawutilssvg.d.ts +226 -53
  118. package/src/esm/drawutilssvg.js +369 -92
  119. package/src/esm/drawutilssvg.js.map +1 -1
  120. package/src/esm/interfaces/DrawLib.d.ts +157 -79
  121. package/src/esm/interfaces/DrawLib.js +6 -0
  122. package/src/esm/interfaces/DrawLib.js.map +1 -1
  123. package/src/esm/interfaces/core.d.ts +13 -2
  124. package/src/esm/interfaces/core.js +1 -0
  125. package/src/esm/interfaces/core.js.map +1 -1
  126. package/src/esm/utils/Params.d.ts +15 -0
  127. package/src/esm/utils/Params.js +44 -0
  128. package/src/esm/utils/Params.js.map +1 -0
  129. package/src/esm/utils/algorithms/ContourLineDetection.d.ts +150 -0
  130. package/src/esm/utils/algorithms/ContourLineDetection.js +362 -0
  131. package/src/esm/utils/algorithms/ContourLineDetection.js.map +1 -0
  132. package/src/esm/utils/algorithms/clearDuplicateVertices.d.ts +21 -0
  133. package/src/esm/utils/algorithms/clearDuplicateVertices.js +44 -0
  134. package/src/esm/utils/algorithms/clearDuplicateVertices.js.map +1 -0
  135. package/src/esm/utils/datastructures/DataGrid2d.d.ts +47 -0
  136. package/src/esm/utils/datastructures/DataGrid2d.js +19 -0
  137. package/src/esm/utils/datastructures/DataGrid2d.js.map +1 -0
  138. package/src/esm/utils/datastructures/DataGrid2dListAdapter.d.ts +65 -0
  139. package/src/esm/utils/datastructures/DataGrid2dListAdapter.js +79 -0
  140. package/src/esm/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
  141. package/src/esm/utils/datastructures/GenericPath.d.ts +14 -3
  142. package/src/esm/utils/datastructures/GenericPath.js +20 -3
  143. package/src/esm/utils/datastructures/GenericPath.js.map +1 -1
  144. package/src/esm/utils/detectDarkMode.d.ts +10 -0
  145. package/src/esm/utils/detectDarkMode.js +28 -0
  146. package/src/esm/utils/detectDarkMode.js.map +1 -0
  147. package/src/ts/BezierPath.ts +72 -241
  148. package/src/ts/Bounds.ts +25 -1
  149. package/src/ts/CubicBezierCurve.ts +139 -12
  150. package/src/ts/Line.ts +2 -1
  151. package/src/ts/PBText.ts +10 -9
  152. package/src/ts/PlotBoilerplate.ts +56 -19
  153. package/src/ts/Polygon.ts +121 -1
  154. package/src/ts/VEllipse.ts +2 -2
  155. package/src/ts/Vector.ts +4 -4
  156. package/src/ts/VertTuple.ts +4 -3
  157. package/src/ts/Vertex.ts +20 -4
  158. package/src/ts/draw.ts +311 -115
  159. package/src/ts/drawgl.ts +133 -71
  160. package/src/ts/drawutilssvg.ts +543 -121
  161. package/src/ts/interfaces/DrawLib.ts +219 -83
  162. package/src/ts/interfaces/core.ts +14 -2
  163. package/src/ts/utils/Params.ts +47 -0
  164. package/src/ts/utils/algorithms/ContourLineDetection.ts +485 -0
  165. package/src/ts/utils/algorithms/clearDuplicateVertices.ts +49 -0
  166. package/src/ts/utils/datastructures/DataGrid2d.ts +54 -0
  167. package/src/ts/utils/datastructures/DataGrid2dListAdapter.ts +121 -0
  168. package/src/ts/utils/datastructures/GenericPath.ts +21 -3
  169. package/src/ts/utils/detectDarkMode.ts +30 -0
@@ -0,0 +1,150 @@
1
+ /**
2
+ * A function to detect contour lines from 3D terrain data.
3
+ *
4
+ * For usage see demo `./demos/48-contour-plot`.
5
+ *
6
+ * @requires detectPaths
7
+ * @requires GenericPath
8
+ * @author Ikaros Kappler
9
+ * @date 2023-11-05
10
+ * @modified 2023-11-20 Addig path detection on a triangle based grid.
11
+ * @version 1.0.0
12
+ */
13
+ import { Line } from "../../Line";
14
+ import { IDataGrid2d } from "../datastructures/DataGrid2d";
15
+ import { GenericPath } from "../datastructures/GenericPath";
16
+ export declare class ContourLineDetection {
17
+ private dataGrid;
18
+ private rawLinearPathSegments;
19
+ static CLOSE_GAP_TYPE_NONE: number;
20
+ static CLOSE_GAP_TYPE_ABOVE: number;
21
+ static CLOSE_GAP_TYPE_BELOW: number;
22
+ debugMode: boolean;
23
+ /**
24
+ * Creates a new instance for calculating contour lines from the given data grid.
25
+ * @param {IDataGrid2d<number>} dataGrid - The data grid to use. Must not contain any NaN or null values.
26
+ * @param {boolean=?} debugMode - (optional) Pass `true` to log warnings on (rare) critical edge cases where the algorithm might fail.
27
+ */
28
+ constructor(dataGrid: IDataGrid2d<number>, debugMode?: boolean);
29
+ /**
30
+ * Detect contour paths from the underlying data source.
31
+ *
32
+ * @param {number} criticalHeightValue - The height value. If above data's maximum or below data's minimum then the result will be empty (no intersections).
33
+ * @param {number} options.closeGapType - `CLOSE_GAP_TYPE_NONE` or `CLOSE_GAP_TYPE_ABOVE` or `CLOSE_GAP_TYPE_BELOW`.
34
+ * @param {boolean=false} options.useTriangles - If set to true the detection will split each face3 quad into two triangle faces.
35
+ * @param {pathDetectEpsilon=0.000001} options.pathDetectEpsilon - (optional) The epsilon to tell if two points are located 'in the same place'. Used for connected path detection. If not specified the value `0.0000001` is used.
36
+ * @param {pointEliminationEpsilon=0.0000001} options.pointEliminationEpsilon - (optional) The epsilon for duplicate point elimination (default is 0.000001).
37
+ * @param {function?} onRawSegmentsDetected - (optional) Get the interim result of all detected single lines before path detection starts; DO NOT MODIFY the array.
38
+ * @returns {Array<GenericPath>} - A list of connected paths that resemble the contour lines of the data/terrain at the given height value.
39
+ */
40
+ detectContourPaths(criticalHeightValue: number, options?: {
41
+ closeGapType: number;
42
+ useTriangles?: boolean;
43
+ pointEliminationEpsilon?: number;
44
+ pathDetectEpsilon?: number;
45
+ onRawSegmentsDetected?: (rawSegmentsDoNotModifiy: Array<Line>) => void;
46
+ }): Array<GenericPath>;
47
+ /**
48
+ * This function will calculate a single intersecion line of the given face4 data
49
+ * segment. If the given face does not intersect with the plane at the given `heightValue`
50
+ * then no segments will be stored.
51
+ *
52
+ * @param {number} xIndex - The x position (index) of the data face.
53
+ * @param {number} yIndex - The y position (index) of the data face.
54
+ * @param {[[number,number],[number,number]]} heightFace - The data sample that composes the face4 as a two-dimensional number array.
55
+ * @param {number} heightValue - The height value of the intersection plane to check for.
56
+ * @returns {Line|null}
57
+ */
58
+ private findHeight4FaceIntersectionLine;
59
+ /**
60
+ * This function will calculate a single intersecion line of the given face4 data
61
+ * segment. If the given face does not intersect with the plane at the given `heightValue`
62
+ * then no segments will be stored.
63
+ *
64
+ * @param {number} xIndex - The x position (index) of the data face.
65
+ * @param {number} yIndex - The y position (index) of the data face.
66
+ * @param {[[number,number],[number,number]]} heightFace - The data sample that composes the face4 as a two-dimensional number array.
67
+ * @param {number} heightValue - The height value of the intersection plane to check for.
68
+ * @returns {Line|null}
69
+ */
70
+ private findHeightFaceIntersectionLines;
71
+ /**
72
+ * This function will calculate a single intersecion line of the given face3 data
73
+ * segment. If the given face does not intersect with the plane at the given `heightValue`
74
+ * then no segments will be stored.
75
+ *
76
+ * @param {number} xIndexA - The x position (index) of the first triangle data point.
77
+ * @param {number} yIndexA - The y position (index) of the first triangle data point.
78
+ * @param {[[number,number],[number,number]]} heightFace - The data sample that composes the face4 as a two-dimensional number array.
79
+ * @param {number} heightValue - The height value of the intersection plane to check for.
80
+ * @returns {Line|null}
81
+ */
82
+ private findHeighteFace3IntersectionLine;
83
+ /**
84
+ * This procedure will look at the face4 at the ((x,y),(nextX,nextY)) position – which are four values –
85
+ * and determines the local contour lines for these cases.
86
+ *
87
+ * This is used to detect and calculate edge cases on the borders of the underliying height data:
88
+ * * left and right border (x=0, x=data.xSegmentCount)
89
+ * * top and bottom border (x=y, x=data.ySegmentCount)
90
+ *
91
+ * Resulting path segments will be stored in the global `rawLinearPathSegments` array for further processing.
92
+ *
93
+ * @param {number} x
94
+ * @param {number} y
95
+ * @param {number} nextX
96
+ * @param {number} nextY
97
+ * @param {number} criticalHeightValue
98
+ * @param {number} closeGapType - CLOSE_GAP_TYPE_ABOVE or CLOSE_GAP_TYPE_BELOW.
99
+ * @return {void}
100
+ */
101
+ detectAboveBelowLerpSegment(x: number, y: number, nextX: number, nextY: number, criticalHeightValue: number, closeGapType: number): void;
102
+ /**
103
+ * Checks if both value are on the same side of the critical value (above or below). The `closeGapType`
104
+ * indictes if `CLOSE_GAP_TYPE_BELOW` or `CLOSE_GAP_TYPE_ABOVE` should be used as a rule.
105
+ *
106
+ * @param {number} valueA
107
+ * @param {number} valueB
108
+ * @param {number} criticalValue
109
+ * @param {number} closeGapType
110
+ * @returns {boolean}
111
+ */
112
+ private areBothValuesOnRequiredPlaneSide;
113
+ /**
114
+ * Test if a given numeric value (`curValue`) is between the given values `valA` and `valB`.
115
+ * Value A and B don't need to be in ascending order, so `valA <= curValue <= valB` and `valB <= curvalue <= valA`
116
+ * will do the job.
117
+ *
118
+ * @param {number} valA - The first of the two bounds.
119
+ * @param {number} valB - The second of the two bounds.
120
+ * @param {number} curValue - The value to check if it is between (or equal) to the given bounds.
121
+ * @returns {boolean}
122
+ */
123
+ private isBetween;
124
+ /**
125
+ * Get a 'lerp' value - which is some sort of percentage/ratio for the `curValue` inside the
126
+ * range of the given interval `[valA ... valB]`.
127
+ *
128
+ * Examples:
129
+ * * getLerpRatio(0,100,50) === 0.5
130
+ * * getLerpRatio(50,100,75) === 0.5
131
+ * * getLerpRatio(0,100,0) === 0.0
132
+ * * getLerpRatio(0,100,100) === 1.0
133
+ * * getLerpRatio(0,100,-50) === -0.5
134
+ *
135
+ * @param {number} valA
136
+ * @param {number} valB
137
+ * @param {number} curValue
138
+ * @returns
139
+ */
140
+ private getLerpRatio;
141
+ /**
142
+ * Helper function to lerp a numeric value.
143
+ *
144
+ * @param {number} min - The min (start) value. Doesn't necesarily need to be the smaller one.
145
+ * @param {number} max - The max (end) value. Doesn't necesarily need to be the larger one.
146
+ * @param {number} ratio - The lerp ratio; usually a value between 0.0 and 1.0, but other values a valid for linear interpolation, too.
147
+ * @returns {number}
148
+ */
149
+ private lerp;
150
+ }
@@ -0,0 +1,362 @@
1
+ /**
2
+ * A function to detect contour lines from 3D terrain data.
3
+ *
4
+ * For usage see demo `./demos/48-contour-plot`.
5
+ *
6
+ * @requires detectPaths
7
+ * @requires GenericPath
8
+ * @author Ikaros Kappler
9
+ * @date 2023-11-05
10
+ * @modified 2023-11-20 Addig path detection on a triangle based grid.
11
+ * @version 1.0.0
12
+ */
13
+ import { Line } from "../../Line";
14
+ import { Vertex } from "../../Vertex";
15
+ import { detectPaths } from "./detectPaths";
16
+ import { clearDuplicateVertices } from "./clearDuplicateVertices";
17
+ export class ContourLineDetection {
18
+ /**
19
+ * Creates a new instance for calculating contour lines from the given data grid.
20
+ * @param {IDataGrid2d<number>} dataGrid - The data grid to use. Must not contain any NaN or null values.
21
+ * @param {boolean=?} debugMode - (optional) Pass `true` to log warnings on (rare) critical edge cases where the algorithm might fail.
22
+ */
23
+ constructor(dataGrid, debugMode) {
24
+ this.rawLinearPathSegments = [];
25
+ // Activates/deactivates warning messages on rare edge cases where local path detection fails.
26
+ this.debugMode = false;
27
+ this.dataGrid = dataGrid;
28
+ this.debugMode = Boolean(debugMode);
29
+ }
30
+ /**
31
+ * Detect contour paths from the underlying data source.
32
+ *
33
+ * @param {number} criticalHeightValue - The height value. If above data's maximum or below data's minimum then the result will be empty (no intersections).
34
+ * @param {number} options.closeGapType - `CLOSE_GAP_TYPE_NONE` or `CLOSE_GAP_TYPE_ABOVE` or `CLOSE_GAP_TYPE_BELOW`.
35
+ * @param {boolean=false} options.useTriangles - If set to true the detection will split each face3 quad into two triangle faces.
36
+ * @param {pathDetectEpsilon=0.000001} options.pathDetectEpsilon - (optional) The epsilon to tell if two points are located 'in the same place'. Used for connected path detection. If not specified the value `0.0000001` is used.
37
+ * @param {pointEliminationEpsilon=0.0000001} options.pointEliminationEpsilon - (optional) The epsilon for duplicate point elimination (default is 0.000001).
38
+ * @param {function?} onRawSegmentsDetected - (optional) Get the interim result of all detected single lines before path detection starts; DO NOT MODIFY the array.
39
+ * @returns {Array<GenericPath>} - A list of connected paths that resemble the contour lines of the data/terrain at the given height value.
40
+ */
41
+ detectContourPaths(criticalHeightValue, options) {
42
+ var _a, _b;
43
+ options = options || { closeGapType: ContourLineDetection.CLOSE_GAP_TYPE_NONE };
44
+ // First: clear the buffer
45
+ this.rawLinearPathSegments = [];
46
+ // Imagine a face4 element like this
47
+ // (x,y) (x+1,y)
48
+ // A-----B
49
+ // | / |
50
+ // | / |
51
+ // D-----C
52
+ // (x,y+1) (x+1,y+1)
53
+ // then result in the buffer will be
54
+ // [ [A,B],
55
+ // [D,C] ]
56
+ // Note that the diagonal line (used for triangles) is optional; depends on `options.useTriangles`.
57
+ const heightFace = [
58
+ [0, 0],
59
+ [0, 0]
60
+ ];
61
+ for (var y = 0; y + 1 < this.dataGrid.ySegmentCount; y++) {
62
+ for (var x = 0; x + 1 < this.dataGrid.xSegmentCount; x++) {
63
+ this.dataGrid.getDataFace4At(x, y, heightFace);
64
+ this.findHeightFaceIntersectionLines(x, y, heightFace, criticalHeightValue, (_a = options.pointEliminationEpsilon) !== null && _a !== void 0 ? _a : 0.0000001, options.useTriangles);
65
+ }
66
+ }
67
+ // Collect value above/below on the y axis
68
+ if (options.closeGapType == ContourLineDetection.CLOSE_GAP_TYPE_ABOVE ||
69
+ options.closeGapType == ContourLineDetection.CLOSE_GAP_TYPE_BELOW) {
70
+ const xExtremes = [0, this.dataGrid.xSegmentCount - 1];
71
+ for (var i = 0; i < xExtremes.length; i++) {
72
+ const x = xExtremes[i];
73
+ for (var y = 0; y + 1 < this.dataGrid.ySegmentCount; y++) {
74
+ const nextX = x;
75
+ const nextY = y + 1;
76
+ this.detectAboveBelowLerpSegment(x, y, nextX, nextY, criticalHeightValue, options.closeGapType);
77
+ }
78
+ }
79
+ const yExtremes = [0, this.dataGrid.ySegmentCount - 1];
80
+ for (var j = 0; j < yExtremes.length; j++) {
81
+ var y = yExtremes[j];
82
+ for (var x = 0; x + 1 < this.dataGrid.xSegmentCount; x++) {
83
+ const nextX = x + 1;
84
+ const nextY = y;
85
+ this.detectAboveBelowLerpSegment(x, y, nextX, nextY, criticalHeightValue, options.closeGapType);
86
+ }
87
+ }
88
+ }
89
+ if (options.onRawSegmentsDetected) {
90
+ options.onRawSegmentsDetected(this.rawLinearPathSegments);
91
+ }
92
+ // Detect connected paths
93
+ let pathSegments = detectPaths(this.rawLinearPathSegments, (_b = options.pathDetectEpsilon) !== null && _b !== void 0 ? _b : 0.0000001); // Epsilon
94
+ // Filter out segments with only a single line of length~=0
95
+ pathSegments = pathSegments.filter(function (pathSegment) {
96
+ return (pathSegment.segments.length != 1 ||
97
+ (pathSegment.segments.length === 1 && pathSegment.segments[0].length() > 0.1));
98
+ });
99
+ return pathSegments;
100
+ }
101
+ /**
102
+ * This function will calculate a single intersecion line of the given face4 data
103
+ * segment. If the given face does not intersect with the plane at the given `heightValue`
104
+ * then no segments will be stored.
105
+ *
106
+ * @param {number} xIndex - The x position (index) of the data face.
107
+ * @param {number} yIndex - The y position (index) of the data face.
108
+ * @param {[[number,number],[number,number]]} heightFace - The data sample that composes the face4 as a two-dimensional number array.
109
+ * @param {number} heightValue - The height value of the intersection plane to check for.
110
+ * @returns {Line|null}
111
+ */
112
+ findHeight4FaceIntersectionLine(xIndex, yIndex, heightFace, heightValue, pointEliminationEpsilon) {
113
+ const heightValueA = heightFace[0][0]; // value at (x,y)
114
+ const heightValueB = heightFace[1][0];
115
+ const heightValueC = heightFace[1][1];
116
+ const heightValueD = heightFace[0][1];
117
+ if (heightValueA === null || heightValueB === null || heightValueC === null || heightValueD === null) {
118
+ throw `[findHeightFace4IntersectionLine] Cannot extract data face at (${xIndex},${yIndex}). Some values are null.`;
119
+ }
120
+ let points = [];
121
+ // Case A: use full quad face
122
+ if (this.isBetween(heightValueA, heightValueB, heightValue)) {
123
+ const lerpValueByHeight = this.getLerpRatio(heightValueA, heightValueB, heightValue);
124
+ points.push(new Vertex(this.lerp(xIndex, xIndex + 1, lerpValueByHeight), yIndex));
125
+ }
126
+ if (this.isBetween(heightValueB, heightValueC, heightValue)) {
127
+ const lerpValueByHeight = this.getLerpRatio(heightValueB, heightValueC, heightValue);
128
+ points.push(new Vertex(xIndex + 1, this.lerp(yIndex, yIndex + 1, lerpValueByHeight)));
129
+ }
130
+ if (this.isBetween(heightValueC, heightValueD, heightValue)) {
131
+ const lerpValueByHeight = this.getLerpRatio(heightValueC, heightValueD, heightValue);
132
+ points.push(new Vertex(this.lerp(xIndex + 1, xIndex, lerpValueByHeight), yIndex + 1));
133
+ }
134
+ if (this.isBetween(heightValueD, heightValueA, heightValue)) {
135
+ const lerpValueByHeight = this.getLerpRatio(heightValueD, heightValueA, heightValue);
136
+ points.push(new Vertex(xIndex, this.lerp(yIndex + 1, yIndex, lerpValueByHeight)));
137
+ }
138
+ // Warning: if a plane intersection point is located EXACTLY on the corner
139
+ // edge of a face, then the two adjacent edges will result in 2x the same
140
+ // intersecion point. This must be handled as one, so filter the point list
141
+ // by an epsilon.
142
+ points = clearDuplicateVertices(points, pointEliminationEpsilon); // 0.000001);
143
+ if (points.length >= 2) {
144
+ const startPoint = points[0];
145
+ const endPoint = points[1];
146
+ if (this.debugMode && points.length > 2) {
147
+ console.warn("[findHeightFace4IntersectionLine] Detected more than 2 points on one face whre only 0 or 2 should appear. At ", xIndex, yIndex, points);
148
+ }
149
+ return new Line(startPoint, endPoint);
150
+ }
151
+ else {
152
+ if (this.debugMode && points.length === 1) {
153
+ console.warn("[findHeightFace4IntersectionLine] Point list has only one point (should not happen).");
154
+ }
155
+ return null;
156
+ }
157
+ }
158
+ /**
159
+ * This function will calculate a single intersecion line of the given face4 data
160
+ * segment. If the given face does not intersect with the plane at the given `heightValue`
161
+ * then no segments will be stored.
162
+ *
163
+ * @param {number} xIndex - The x position (index) of the data face.
164
+ * @param {number} yIndex - The y position (index) of the data face.
165
+ * @param {[[number,number],[number,number]]} heightFace - The data sample that composes the face4 as a two-dimensional number array.
166
+ * @param {number} heightValue - The height value of the intersection plane to check for.
167
+ * @returns {Line|null}
168
+ */
169
+ findHeightFaceIntersectionLines(xIndex, yIndex, heightFace, criticalHeightValue, pointEliminationEpsilon, useTriangles) {
170
+ // Imagine a face4 element like this
171
+ // (x,y) (x+1,y)
172
+ // A-----B
173
+ // | / |
174
+ // | / |
175
+ // D-----C
176
+ // (x,y+1) (x+1,y+1)
177
+ // then result in the buffer will be
178
+ // [ [A,B],
179
+ // [D,C] ]
180
+ if (useTriangles) {
181
+ const lineA = this.findHeighteFace3IntersectionLine(xIndex, yIndex, xIndex, yIndex + 1, xIndex + 1, yIndex, [heightFace[0][0], heightFace[0][1], heightFace[1][0]], criticalHeightValue, pointEliminationEpsilon);
182
+ if (lineA) {
183
+ this.rawLinearPathSegments.push(lineA);
184
+ }
185
+ const lineB = this.findHeighteFace3IntersectionLine(xIndex, yIndex + 1, xIndex + 1, yIndex + 1, xIndex + 1, yIndex, [heightFace[0][1], heightFace[1][1], heightFace[1][0]], criticalHeightValue, pointEliminationEpsilon);
186
+ if (lineB) {
187
+ this.rawLinearPathSegments.push(lineB);
188
+ }
189
+ }
190
+ else {
191
+ const line = this.findHeight4FaceIntersectionLine(xIndex, yIndex, heightFace, criticalHeightValue, pointEliminationEpsilon);
192
+ if (line) {
193
+ this.rawLinearPathSegments.push(line);
194
+ }
195
+ }
196
+ }
197
+ /**
198
+ * This function will calculate a single intersecion line of the given face3 data
199
+ * segment. If the given face does not intersect with the plane at the given `heightValue`
200
+ * then no segments will be stored.
201
+ *
202
+ * @param {number} xIndexA - The x position (index) of the first triangle data point.
203
+ * @param {number} yIndexA - The y position (index) of the first triangle data point.
204
+ * @param {[[number,number],[number,number]]} heightFace - The data sample that composes the face4 as a two-dimensional number array.
205
+ * @param {number} heightValue - The height value of the intersection plane to check for.
206
+ * @returns {Line|null}
207
+ */
208
+ findHeighteFace3IntersectionLine(xIndexA, yIndexA, xIndexB, yIndexB, xIndexC, yIndexC, heightFace, heightValue, pointEliminationEpsilon) {
209
+ const heightValueA = heightFace[0]; // value at (x,y)
210
+ const heightValueB = heightFace[1];
211
+ const heightValueC = heightFace[2];
212
+ if (heightValueA === null || heightValueB === null || heightValueC === null) {
213
+ throw `[findHeightFace3IntersectionLine] Cannot extract data face at (${xIndexA},${yIndexA}). Some values are null.`;
214
+ }
215
+ let points = [];
216
+ // Case A: use full quad face
217
+ if (this.isBetween(heightValueA, heightValueB, heightValue)) {
218
+ const lerpValueByHeight = this.getLerpRatio(heightValueA, heightValueB, heightValue);
219
+ points.push(new Vertex(this.lerp(xIndexA, xIndexB, lerpValueByHeight), this.lerp(yIndexA, yIndexB, lerpValueByHeight)));
220
+ }
221
+ if (this.isBetween(heightValueB, heightValueC, heightValue)) {
222
+ const lerpValueByHeight = this.getLerpRatio(heightValueB, heightValueC, heightValue);
223
+ // points.push(new Vertex(xIndex + 1, this.lerp(yIndex, yIndex + 1, lerpValueByHeight)));
224
+ points.push(new Vertex(this.lerp(xIndexB, xIndexC, lerpValueByHeight), this.lerp(yIndexB, yIndexC, lerpValueByHeight)));
225
+ }
226
+ if (this.isBetween(heightValueC, heightValueA, heightValue)) {
227
+ const lerpValueByHeight = this.getLerpRatio(heightValueC, heightValueA, heightValue);
228
+ // points.push(new Vertex(this.lerp(xIndex + 1, xIndex, lerpValueByHeight), yIndex + 1));
229
+ points.push(new Vertex(this.lerp(xIndexC, xIndexA, lerpValueByHeight), this.lerp(yIndexC, yIndexA, lerpValueByHeight)));
230
+ }
231
+ // Warning: if a plane intersection point is located EXACTLY on the corner
232
+ // edge of a face, then the two adjacent edges will result in 2x the same
233
+ // intersecion point. This must be handled as one, so filter the point list
234
+ // by an epsilon.
235
+ points = clearDuplicateVertices(points, pointEliminationEpsilon); // 0.0000001);
236
+ if (points.length >= 2) {
237
+ const startPoint = points[0];
238
+ const endPoint = points[1];
239
+ if (this.debugMode && points.length > 2) {
240
+ console.warn("[findHeightFace3IntersectionLine] Detected more than 2 points on one face whre only 0 or 2 should appear. At ", xIndexA, yIndexA, points);
241
+ }
242
+ return new Line(startPoint, endPoint);
243
+ }
244
+ else {
245
+ if (this.debugMode && points.length === 1) {
246
+ console.warn("[findHeightFace3IntersectionLine] Point list has only one point (should not happen).");
247
+ }
248
+ return null;
249
+ }
250
+ }
251
+ /**
252
+ * This procedure will look at the face4 at the ((x,y),(nextX,nextY)) position – which are four values –
253
+ * and determines the local contour lines for these cases.
254
+ *
255
+ * This is used to detect and calculate edge cases on the borders of the underliying height data:
256
+ * * left and right border (x=0, x=data.xSegmentCount)
257
+ * * top and bottom border (x=y, x=data.ySegmentCount)
258
+ *
259
+ * Resulting path segments will be stored in the global `rawLinearPathSegments` array for further processing.
260
+ *
261
+ * @param {number} x
262
+ * @param {number} y
263
+ * @param {number} nextX
264
+ * @param {number} nextY
265
+ * @param {number} criticalHeightValue
266
+ * @param {number} closeGapType - CLOSE_GAP_TYPE_ABOVE or CLOSE_GAP_TYPE_BELOW.
267
+ * @return {void}
268
+ */
269
+ detectAboveBelowLerpSegment(x, y, nextX, nextY, criticalHeightValue, closeGapType) {
270
+ const heightValueA = this.dataGrid.getDataValueAt(x, y);
271
+ const heightValueB = this.dataGrid.getDataValueAt(nextX, nextY);
272
+ // if (heightValueA >= criticalHeightValue && heightValueB >= criticalHeightValue) {
273
+ if (this.areBothValuesOnRequiredPlaneSide(heightValueA, heightValueB, criticalHeightValue, closeGapType)) {
274
+ // Both above
275
+ const line = new Line(new Vertex(x, y), new Vertex(nextX, nextY));
276
+ this.rawLinearPathSegments.push(line);
277
+ }
278
+ else if ((closeGapType == ContourLineDetection.CLOSE_GAP_TYPE_ABOVE &&
279
+ heightValueA >= criticalHeightValue &&
280
+ heightValueB <= criticalHeightValue) ||
281
+ (closeGapType == ContourLineDetection.CLOSE_GAP_TYPE_BELOW &&
282
+ heightValueA <= criticalHeightValue &&
283
+ heightValueB >= criticalHeightValue)) {
284
+ // Only one of both (first) is above -> interpolate to find exact intersection point
285
+ const lerpValueByHeight = this.getLerpRatio(heightValueA, heightValueB, criticalHeightValue);
286
+ const interpLine = new Line(new Vertex(x, y), new Vertex(this.lerp(x, nextX, lerpValueByHeight), this.lerp(y, nextY, lerpValueByHeight)));
287
+ this.rawLinearPathSegments.push(interpLine);
288
+ }
289
+ else if ((closeGapType == ContourLineDetection.CLOSE_GAP_TYPE_ABOVE &&
290
+ heightValueA <= criticalHeightValue &&
291
+ heightValueB >= criticalHeightValue) ||
292
+ (closeGapType == ContourLineDetection.CLOSE_GAP_TYPE_BELOW &&
293
+ heightValueA >= criticalHeightValue &&
294
+ heightValueB <= criticalHeightValue)) {
295
+ // Only one of both (second) is above -> interpolate to find exact intersection point
296
+ const lerpValueByHeight = this.getLerpRatio(heightValueA, heightValueB, criticalHeightValue);
297
+ const interpLine = new Line(new Vertex(this.lerp(x, nextX, lerpValueByHeight), this.lerp(y, nextY, lerpValueByHeight)), new Vertex(nextX, nextY));
298
+ this.rawLinearPathSegments.push(interpLine);
299
+ }
300
+ }
301
+ /**
302
+ * Checks if both value are on the same side of the critical value (above or below). The `closeGapType`
303
+ * indictes if `CLOSE_GAP_TYPE_BELOW` or `CLOSE_GAP_TYPE_ABOVE` should be used as a rule.
304
+ *
305
+ * @param {number} valueA
306
+ * @param {number} valueB
307
+ * @param {number} criticalValue
308
+ * @param {number} closeGapType
309
+ * @returns {boolean}
310
+ */
311
+ areBothValuesOnRequiredPlaneSide(valueA, valueB, criticalValue, closeGapType) {
312
+ return ((closeGapType == ContourLineDetection.CLOSE_GAP_TYPE_BELOW && valueA <= criticalValue && valueB <= criticalValue) ||
313
+ (closeGapType == ContourLineDetection.CLOSE_GAP_TYPE_ABOVE && valueA >= criticalValue && valueB >= criticalValue));
314
+ }
315
+ /**
316
+ * Test if a given numeric value (`curValue`) is between the given values `valA` and `valB`.
317
+ * Value A and B don't need to be in ascending order, so `valA <= curValue <= valB` and `valB <= curvalue <= valA`
318
+ * will do the job.
319
+ *
320
+ * @param {number} valA - The first of the two bounds.
321
+ * @param {number} valB - The second of the two bounds.
322
+ * @param {number} curValue - The value to check if it is between (or equal) to the given bounds.
323
+ * @returns {boolean}
324
+ */
325
+ isBetween(valA, valB, curValue) {
326
+ return (valA <= curValue && curValue <= valB) || (valB <= curValue && curValue <= valA);
327
+ }
328
+ /**
329
+ * Get a 'lerp' value - which is some sort of percentage/ratio for the `curValue` inside the
330
+ * range of the given interval `[valA ... valB]`.
331
+ *
332
+ * Examples:
333
+ * * getLerpRatio(0,100,50) === 0.5
334
+ * * getLerpRatio(50,100,75) === 0.5
335
+ * * getLerpRatio(0,100,0) === 0.0
336
+ * * getLerpRatio(0,100,100) === 1.0
337
+ * * getLerpRatio(0,100,-50) === -0.5
338
+ *
339
+ * @param {number} valA
340
+ * @param {number} valB
341
+ * @param {number} curValue
342
+ * @returns
343
+ */
344
+ getLerpRatio(valA, valB, curValue) {
345
+ return (curValue - valA) / (valB - valA);
346
+ }
347
+ /**
348
+ * Helper function to lerp a numeric value.
349
+ *
350
+ * @param {number} min - The min (start) value. Doesn't necesarily need to be the smaller one.
351
+ * @param {number} max - The max (end) value. Doesn't necesarily need to be the larger one.
352
+ * @param {number} ratio - The lerp ratio; usually a value between 0.0 and 1.0, but other values a valid for linear interpolation, too.
353
+ * @returns {number}
354
+ */
355
+ lerp(min, max, ratio) {
356
+ return min + (max - min) * ratio;
357
+ }
358
+ }
359
+ ContourLineDetection.CLOSE_GAP_TYPE_NONE = 0;
360
+ ContourLineDetection.CLOSE_GAP_TYPE_ABOVE = 1;
361
+ ContourLineDetection.CLOSE_GAP_TYPE_BELOW = 2;
362
+ //# sourceMappingURL=ContourLineDetection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContourLineDetection.js","sourceRoot":"","sources":["../../../ts/utils/algorithms/ContourLineDetection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;A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AAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC;IACnC,CAAC;;AArcM,wCAAmB,GAAG,CAAC,CAAC;AACxB,yCAAoB,GAAG,CAAC,CAAC;AACzB,yCAAoB,GAAG,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Remove duplicate vertices (2d) from an array.
3
+ *
4
+ * This method war taken and refactored from an older demo.
5
+ *
6
+ * @author Ikaros Kappler
7
+ * @date 2021-07-13
8
+ * @modified 2023-10-28 Refactored and ported to Typescript.
9
+ * @version 1.0.0
10
+ */
11
+ import { Vertex } from "../../Vertex";
12
+ /**
13
+ * Filter the array and clear all duplicates.
14
+ *
15
+ * The original array is left unchanged. The vertices in the array are not cloned.
16
+ *
17
+ * @param {Vertex[]} vertices
18
+ * @param {number=EPS} epsilon
19
+ * @return {Vertex[]}
20
+ */
21
+ export declare const clearDuplicateVertices: (vertices: Vertex[], epsilon?: number) => Vertex[];
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Remove duplicate vertices (2d) from an array.
3
+ *
4
+ * This method war taken and refactored from an older demo.
5
+ *
6
+ * @author Ikaros Kappler
7
+ * @date 2021-07-13
8
+ * @modified 2023-10-28 Refactored and ported to Typescript.
9
+ * @version 1.0.0
10
+ */
11
+ const EPS = 0.000001;
12
+ /**
13
+ * Filter the array and clear all duplicates.
14
+ *
15
+ * The original array is left unchanged. The vertices in the array are not cloned.
16
+ *
17
+ * @param {Vertex[]} vertices
18
+ * @param {number=EPS} epsilon
19
+ * @return {Vertex[]}
20
+ */
21
+ export const clearDuplicateVertices = (vertices, epsilon) => {
22
+ if (typeof epsilon === "undefined") {
23
+ epsilon = EPS;
24
+ }
25
+ const result = [];
26
+ for (var i = 0; i < vertices.length; i++) {
27
+ if (!containsElementFrom(vertices, vertices[i], i + 1, epsilon)) {
28
+ result.push(vertices[i]);
29
+ }
30
+ }
31
+ return result;
32
+ };
33
+ const isCloseTo = (vertA, vertB, eps) => {
34
+ return vertA.distance(vertB) < eps;
35
+ };
36
+ const containsElementFrom = (vertices, vertex, fromIndex, epsilon) => {
37
+ for (var i = fromIndex; i < vertices.length; i++) {
38
+ if (isCloseTo(vertices[i], vertex, epsilon)) {
39
+ return true;
40
+ }
41
+ }
42
+ return false;
43
+ };
44
+ //# sourceMappingURL=clearDuplicateVertices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clearDuplicateVertices.js","sourceRoot":"","sources":["../../../ts/utils/algorithms/clearDuplicateVertices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,GAAG,GAAW,QAAQ,CAAC;AAE7B;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,QAAkB,EAAE,OAAgB,EAAE,EAAE;IAC7E,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;QAClC,OAAO,GAAG,GAAG,CAAC;KACf;IACD,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE;YAC/D,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1B;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,KAAa,EAAE,GAAW,EAAW,EAAE;IACvE,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,QAAuB,EAAE,MAAc,EAAE,SAAiB,EAAE,OAAe,EAAW,EAAE;IACnH,KAAK,IAAI,CAAC,GAAG,SAAS,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAChD,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;YAC3C,OAAO,IAAI,CAAC;SACb;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * A 2D datagrid interface for getting/storing data in some 2 dimensional array style types.
3
+ *
4
+ * _|---- xIndex --->
5
+ * | d[0][0], d[1][0], d[2][0], ..., d[xSegmentCount-1][0]
6
+ * yIndex
7
+ * | d[0][1], d[1][1], d[2][1], ..., d[xSegmentCount-1][1]
8
+ * |
9
+ * v ...
10
+ *
11
+ * d[0][ySegmentCount-1], ..., ..., d[xSegmentCount-1][ySegmentCount-1]
12
+ *
13
+ *
14
+ * @date 2023-11-04
15
+ * @author Ikaros Kappler
16
+ * @version 1.0.0
17
+ */
18
+ export declare type DataGridFace4<T> = [[T | null, T | null], [T | null, T | null]];
19
+ export interface IDataGrid2d<T> {
20
+ readonly xSegmentCount: number;
21
+ readonly ySegmentCount: number;
22
+ getMinDataValue(): T;
23
+ getMaxDataValue(): T;
24
+ getDataValueAt(xIndex: number, yIndex: number): T | null;
25
+ /**
26
+ * Extract a 2x2 matrix (a "face4") from the underlyting data.
27
+ *
28
+ * Imagine a face4 element like this
29
+ * (x,y) (x+1,y)
30
+ * A-----B
31
+ * | |
32
+ * | |
33
+ * D-----C
34
+ * (x,y+1) (x+1,y+1)
35
+ *
36
+ * then result in the buffer will be
37
+ * [ [A,B],
38
+ * [D,C] ]
39
+ *
40
+ * If any index is invalid then the resulting buffer element will be null.
41
+ *
42
+ * @param {number} xIndex - The x index in `0 <= xIndex < xSegmentCount`.
43
+ * @param {number} yIndex - The y index in `0 <= yIndex < ySegmentCount`.
44
+ * @param {[[T,T],[T,T]]} buffer - The result buffer for four elements.
45
+ */
46
+ getDataFace4At(xIndex: number, yIndex: number, buffer: DataGridFace4<T>): void;
47
+ }