webgl2-sdf 0.0.1 → 0.0.3

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 (183) hide show
  1. package/browser/index.min.js +1 -0
  2. package/node/bezier/bezier-curves-to-line-segs.js +31 -0
  3. package/node/bezier/bezier-curves-to-line-segs.js.map +1 -0
  4. package/node/bezier/eval-de-casteljau.js +61 -0
  5. package/node/bezier/eval-de-casteljau.js.map +1 -0
  6. package/node/bezier/from-to/from-to-2.js +134 -0
  7. package/node/bezier/from-to/from-to-2.js.map +1 -0
  8. package/node/bezier/from-to/from-to-3.js +159 -0
  9. package/node/bezier/from-to/from-to-3.js.map +1 -0
  10. package/node/bezier/from-to/from-to.js +21 -0
  11. package/node/bezier/from-to/from-to.js.map +1 -0
  12. package/node/bezier/is-cubic-obtuse.js +24 -0
  13. package/node/bezier/is-cubic-obtuse.js.map +1 -0
  14. package/node/bezier/is-quad-obtuse.js +20 -0
  15. package/node/bezier/is-quad-obtuse.js.map +1 -0
  16. package/node/bezier/is-really-point.js +19 -0
  17. package/node/bezier/is-really-point.js.map +1 -0
  18. package/node/bezier/split-by-deviation-from-straight-line-cubic.js +85 -0
  19. package/node/bezier/split-by-deviation-from-straight-line-cubic.js.map +1 -0
  20. package/node/bezier/split-by-deviation-from-straight-line-quad.js +50 -0
  21. package/node/bezier/split-by-deviation-from-straight-line-quad.js.map +1 -0
  22. package/node/bezier/split-into-line-segments.js +29 -0
  23. package/node/bezier/split-into-line-segments.js.map +1 -0
  24. package/node/generate-sdf.js +57 -0
  25. package/node/generate-sdf.js.map +1 -0
  26. package/node/index.js +2 -0
  27. package/node/index.js.map +1 -0
  28. package/node/main-program.js +100 -0
  29. package/node/main-program.js.map +1 -0
  30. package/node/max-aspect-ratio-before-stretch.js +3 -0
  31. package/node/max-aspect-ratio-before-stretch.js.map +1 -0
  32. package/node/prepare-buffers.js +114 -0
  33. package/node/prepare-buffers.js.map +1 -0
  34. package/node/row-count.js +4 -0
  35. package/node/row-count.js.map +1 -0
  36. package/node/shaders/main.fragment.js +149 -0
  37. package/node/shaders/main.fragment.js.map +1 -0
  38. package/node/shaders/main.vertex.js +53 -0
  39. package/node/shaders/main.vertex.js.map +1 -0
  40. package/node/svg/get-beziers-from-raw-paths.js +91 -0
  41. package/node/svg/get-beziers-from-raw-paths.js.map +1 -0
  42. package/node/svg/get-paths-from-str.js +14 -0
  43. package/node/svg/get-paths-from-str.js.map +1 -0
  44. package/node/svg/path-data-polyfill/parse-number.js +101 -0
  45. package/node/svg/path-data-polyfill/parse-number.js.map +1 -0
  46. package/node/svg/path-data-polyfill/parse-path-data-string.js +21 -0
  47. package/node/svg/path-data-polyfill/parse-path-data-string.js.map +1 -0
  48. package/node/svg/path-data-polyfill/source.js +147 -0
  49. package/node/svg/path-data-polyfill/source.js.map +1 -0
  50. package/node/svg/path-segment/c.js +29 -0
  51. package/node/svg/path-segment/c.js.map +1 -0
  52. package/node/svg/path-segment/h.js +23 -0
  53. package/node/svg/path-segment/h.js.map +1 -0
  54. package/node/svg/path-segment/l.js +24 -0
  55. package/node/svg/path-segment/l.js.map +1 -0
  56. package/node/svg/path-segment/q.js +23 -0
  57. package/node/svg/path-segment/q.js.map +1 -0
  58. package/node/svg/path-segment/s.js +34 -0
  59. package/node/svg/path-segment/s.js.map +1 -0
  60. package/node/svg/path-segment/t.js +28 -0
  61. package/node/svg/path-segment/t.js.map +1 -0
  62. package/node/svg/path-segment/v.js +23 -0
  63. package/node/svg/path-segment/v.js.map +1 -0
  64. package/node/svg/path-segment/z.js +21 -0
  65. package/node/svg/path-segment/z.js.map +1 -0
  66. package/node/svg/path-state.js +2 -0
  67. package/node/svg/path-state.js.map +1 -0
  68. package/node/tex-width.js +12 -0
  69. package/node/tex-width.js.map +1 -0
  70. package/node/types/attribute.js +2 -0
  71. package/node/types/attribute.js.map +1 -0
  72. package/node/types/cell.js +2 -0
  73. package/node/types/cell.js.map +1 -0
  74. package/node/types/gl-context.js +2 -0
  75. package/node/types/gl-context.js.map +1 -0
  76. package/node/types/gl-type.js +2 -0
  77. package/node/types/gl-type.js.map +1 -0
  78. package/node/types/gl-usage.js +2 -0
  79. package/node/types/gl-usage.js.map +1 -0
  80. package/node/types/program.d.ts +2 -2
  81. package/node/types/program.js +2 -0
  82. package/node/types/program.js.map +1 -0
  83. package/node/types/strip.js +2 -0
  84. package/node/types/strip.js.map +1 -0
  85. package/node/types/texture.js +2 -0
  86. package/node/types/texture.js.map +1 -0
  87. package/node/utils/calc-circs.js +97 -0
  88. package/node/utils/calc-circs.js.map +1 -0
  89. package/node/utils/clip-line-segment-to-grid.d.ts +1 -1
  90. package/node/utils/clip-line-segment-to-grid.js +98 -0
  91. package/node/utils/clip-line-segment-to-grid.js.map +1 -0
  92. package/node/utils/clip-line-segment-to-strips.d.ts +1 -1
  93. package/node/utils/clip-line-segment-to-strips.js +150 -0
  94. package/node/utils/clip-line-segment-to-strips.js.map +1 -0
  95. package/node/utils/create-empty-grid.d.ts +1 -1
  96. package/node/utils/create-empty-grid.js +24 -0
  97. package/node/utils/create-empty-grid.js.map +1 -0
  98. package/node/utils/create-empty-strips.d.ts +1 -1
  99. package/node/utils/create-empty-strips.js +16 -0
  100. package/node/utils/create-empty-strips.js.map +1 -0
  101. package/node/utils/distance-seg-to-p.js +35 -0
  102. package/node/utils/distance-seg-to-p.js.map +1 -0
  103. package/node/utils/find-close-cells.d.ts +1 -1
  104. package/node/utils/find-close-cells.js +130 -0
  105. package/node/utils/find-close-cells.js.map +1 -0
  106. package/node/utils/find-crossing-cells.d.ts +1 -1
  107. package/node/utils/find-crossing-cells.js +31 -0
  108. package/node/utils/find-crossing-cells.js.map +1 -0
  109. package/node/utils/get-distance-to-line-function.js +45 -0
  110. package/node/utils/get-distance-to-line-function.js.map +1 -0
  111. package/node/utils/jump-idx.js +81 -0
  112. package/node/utils/jump-idx.js.map +1 -0
  113. package/node/utils/map-to-viewbox.js +29 -0
  114. package/node/utils/map-to-viewbox.js.map +1 -0
  115. package/node/utils/seg-box-x.js +69 -0
  116. package/node/utils/seg-box-x.js.map +1 -0
  117. package/node/utils/seg-strip-x.js +58 -0
  118. package/node/utils/seg-strip-x.js.map +1 -0
  119. package/node/vector/dot.js +11 -0
  120. package/node/vector/dot.js.map +1 -0
  121. package/node/vector/from-to-vec.js +11 -0
  122. package/node/vector/from-to-vec.js.map +1 -0
  123. package/node/vector/len.js +9 -0
  124. package/node/vector/len.js.map +1 -0
  125. package/node/webgl-utils/compile-shader.js +8 -0
  126. package/node/webgl-utils/compile-shader.js.map +1 -0
  127. package/node/webgl-utils/get-gl-context.d.ts +1 -1
  128. package/node/webgl-utils/get-gl-context.js +43 -0
  129. package/node/webgl-utils/get-gl-context.js.map +1 -0
  130. package/node/webgl-utils/set-attribute.d.ts +3 -3
  131. package/node/webgl-utils/set-attribute.js +52 -0
  132. package/node/webgl-utils/set-attribute.js.map +1 -0
  133. package/node/webgl-utils/set-uniform-block.d.ts +1 -1
  134. package/node/webgl-utils/set-uniform-block.js +31 -0
  135. package/node/webgl-utils/set-uniform-block.js.map +1 -0
  136. package/node/webgl-utils/set-uniform.d.ts +2 -2
  137. package/node/webgl-utils/set-uniform.js +11 -0
  138. package/node/webgl-utils/set-uniform.js.map +1 -0
  139. package/node/webgl-utils/uniform-block.js +2 -0
  140. package/node/webgl-utils/uniform-block.js.map +1 -0
  141. package/node/webgl-utils/uniform-type.js +2 -0
  142. package/node/webgl-utils/uniform-type.js.map +1 -0
  143. package/node/webgl-utils/use-program.d.ts +2 -2
  144. package/node/webgl-utils/use-program.js +31 -0
  145. package/node/webgl-utils/use-program.js.map +1 -0
  146. package/node/webgl-utils/use-texture.js +25 -0
  147. package/node/webgl-utils/use-texture.js.map +1 -0
  148. package/package.json +4 -5
  149. package/src/bezier/is-cubic-obtuse.ts +2 -2
  150. package/src/bezier/is-quad-obtuse.ts +2 -2
  151. package/src/bezier/split-by-deviation-from-straight-line-quad.ts +3 -3
  152. package/src/bezier/split-into-line-segments.ts +3 -3
  153. package/src/debug-shaders.ts +2 -2
  154. package/src/shaders/main.fragment.ts +1 -1
  155. package/src/shaders/main.vertex.ts +1 -1
  156. package/src/types/program.ts +2 -2
  157. package/src/utils/calc-circs.ts +3 -3
  158. package/src/utils/clip-line-segment-to-grid.ts +2 -3
  159. package/src/utils/clip-line-segment-to-strips.ts +2 -2
  160. package/src/utils/create-empty-grid.ts +2 -2
  161. package/src/utils/create-empty-strips.ts +2 -2
  162. package/src/utils/find-close-cells.ts +5 -5
  163. package/src/utils/find-crossing-cells.ts +2 -2
  164. package/src/utils/jump-idx.ts +1 -1
  165. package/src/webgl-utils/get-gl-context.ts +3 -3
  166. package/src/webgl-utils/set-attribute.ts +3 -3
  167. package/src/webgl-utils/set-uniform-block.ts +1 -1
  168. package/src/webgl-utils/set-uniform.ts +2 -2
  169. package/src/webgl-utils/use-program.ts +5 -5
  170. package/node/helpers/calc-circs.d.ts +0 -11
  171. package/node/helpers/clip-line-segment-to-grid.d.ts +0 -14
  172. package/node/helpers/clip-line-segment-to-strips.d.ts +0 -13
  173. package/node/helpers/create-empty-grid.d.ts +0 -8
  174. package/node/helpers/create-empty-strips.d.ts +0 -7
  175. package/node/helpers/distance-seg-to-p.d.ts +0 -5
  176. package/node/helpers/find-close-cells.d.ts +0 -3
  177. package/node/helpers/find-crossing-cells.d.ts +0 -3
  178. package/node/helpers/get-distance-to-line-function.d.ts +0 -10
  179. package/node/helpers/jump-idx.d.ts +0 -2
  180. package/node/helpers/map-to-viewbox.d.ts +0 -2
  181. package/node/helpers/seg-box-x.d.ts +0 -10
  182. package/node/helpers/seg-strip-x.d.ts +0 -9
  183. package/src/utils/path.ts +0 -137
@@ -0,0 +1,85 @@
1
+ import { getDistanceToLineFunction } from '../utils/get-distance-to-line-function.js';
2
+ import { fromTo } from './from-to/from-to.js';
3
+ import { isCubicObtuse } from './is-cubic-obtuse.js';
4
+ const { abs, max } = Math;
5
+ /**
6
+ * Split the given cubic bezier curve into pieces (given as an array of
7
+ * parameter `t` values) such that each piece is guaranteed to deviate less
8
+ * than `maxD` from a straigh line.
9
+ *
10
+ * * a crude method is employed (for efficiency) by noting that the hausdorff
11
+ * distance between a cubic and the line segment connecting its endpoints is at
12
+ * most 3/4 the distance of the max distance between any control point and the
13
+ * line segment if the control points are on the same side of the line segment
14
+ * and at most 4/9 if they are on opposite sides AND (in both cases) the cubic
15
+ * is not obtuse, i.e. the inner control points are not outside the strip formed
16
+ * by the two lines passing through the endpoint control points normal to the
17
+ * line segment connecting the endpoint control points.
18
+ *
19
+ * @param ps an order 2 bezier curve given as an ordered array of its
20
+ * control point coordinates, e.g. `[[0,0], [1,1], [2,1]]`
21
+ * @param maxD
22
+ */
23
+ function splitByDeviationFromStraighLine_Cubic_Crude(ps, maxD) {
24
+ const tsS = [0];
25
+ const tsE = [1];
26
+ while (true) {
27
+ const tS = tsS[tsS.length - 1];
28
+ const tE = tsE[tsE.length - 1];
29
+ const ps_ = fromTo(ps, tS, tE);
30
+ if ((!isCubicObtuse(ps_) && getMaxD(ps_) <= maxD)) {
31
+ tsS.push(tsE.pop());
32
+ if (tE === 1) {
33
+ return tsS;
34
+ }
35
+ continue;
36
+ }
37
+ const t = (tS + tE) / 2;
38
+ tsE.push(t);
39
+ }
40
+ }
41
+ // function splitByDeviationFromStraighLine_Cubic_Precise(
42
+ // ps: number[][],
43
+ // maxD: number): number[] {
44
+ // const tsS = [0];
45
+ // const tsE = [1];
46
+ // while (true) {
47
+ // const tS = tsS[tsS.length - 1];
48
+ // const tE = tsE[tsE.length - 1];
49
+ // const ps_ = fromTo(ps, tS, tE);
50
+ // if ((!isCubicObtuse(ps_) && getMaxDPrecise(ps_) <= maxD)) {
51
+ // tsS.push(tsE.pop()!);
52
+ // if (tE === 1) {
53
+ // return tsS;
54
+ // }
55
+ // continue;
56
+ // }
57
+ // const t = (tS + tE)/2;
58
+ // tsE.push(t);
59
+ // }
60
+ // }
61
+ function getMaxD(ps) {
62
+ const dF = getDistanceToLineFunction(ps[0], ps[3]);
63
+ const d1 = dF(ps[1]);
64
+ const d2 = dF(ps[2]);
65
+ // The hausdorff distance between a cubic and the line segment connecting its
66
+ // endpoints is at most 3/4 the distance of the max distance between any control
67
+ // point and the line segment if the control points are on the same side of the line
68
+ // segment and at most 4/9 if they are on opposite sides AND (in both cases) the cubic
69
+ // is not obtuse, i.e. the inner control points are not outside the strip formed
70
+ // by the two lines passing through the endpoint control points normal to the
71
+ // line segment connecting the endpoint control points.
72
+ const C = d1 * d2 <= 0 ? 4 / 9 : 3 / 4;
73
+ return C * max(abs(d1), abs(d2));
74
+ }
75
+ export { splitByDeviationFromStraighLine_Cubic_Crude,
76
+ // splitByDeviationFromStraighLine_Cubic_Precise
77
+ };
78
+ // Quokka tests
79
+ // splitByDeviationFromStraighLine_Cubic_Crude([
80
+ // [43, 0],
81
+ // [23, 0],
82
+ // [33, 0],
83
+ // [53, 0]
84
+ // ], 0.5);//?
85
+ //# sourceMappingURL=split-by-deviation-from-straight-line-cubic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split-by-deviation-from-straight-line-cubic.js","sourceRoot":"","sources":["../../src/bezier/split-by-deviation-from-straight-line-cubic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAG1B;;;;;;;;;;;;;;;;;GAiBG;AACF,SAAS,2CAA2C,CAC7C,EAAc,EACd,IAAY;IAEhB,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,OAAO,IAAI,EAAE,CAAC;QACV,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAA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;IAChF,6EAA6E;IAC7E,uDAAuD;IAEvD,MAAM,CAAC,GAAG,EAAE,GAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC;IAEjC,OAAO,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AACrC,CAAC;AAGD,OAAO,EACH,2CAA2C;AAC3C,gDAAgD;EACnD,CAAA;AAGD,eAAe;AACf,gDAAgD;AAChD,eAAe;AACf,eAAe;AACf,eAAe;AACf,cAAc;AACd,cAAc"}
@@ -0,0 +1,50 @@
1
+ import { getDistanceToLineFunction } from '../utils/get-distance-to-line-function.js';
2
+ import { evalDeCasteljau } from './eval-de-casteljau.js';
3
+ import { fromTo } from './from-to/from-to.js';
4
+ import { isQuadObtuse } from './is-quad-obtuse.js';
5
+ const { abs } = Math;
6
+ /**
7
+ * Split the given quadratic bezier curve into pieces (given as an array of
8
+ * parameter `t` values) such that each piece is guaranteed to deviate less
9
+ * than `maxD` from a straigh line.
10
+ *
11
+ * @param ps an order 2 bezier curve given as an ordered array of its
12
+ * control point coordinates, e.g. `[[0,0], [1,1], [2,1]]`
13
+ * @param maxD
14
+ */
15
+ function splitByDeviationFromStraighLine_Quad(ps, maxD) {
16
+ const tsS = [0];
17
+ const tsE = [1];
18
+ while (true) {
19
+ const tS = tsS[tsS.length - 1];
20
+ const tE = tsE[tsE.length - 1];
21
+ const ps_ = fromTo(ps, tS, tE);
22
+ if ((!isQuadObtuse(ps_) && getMaxD(ps_) <= maxD)) {
23
+ tsS.push(tsE.pop());
24
+ if (tE === 1) {
25
+ return tsS;
26
+ }
27
+ continue;
28
+ }
29
+ const t = (tS + tE) / 2;
30
+ tsE.push(t);
31
+ }
32
+ }
33
+ function getMaxD(ps) {
34
+ if (ps[0][0] === ps[1][0] && ps[0][1] === ps[1][1]) {
35
+ return 0;
36
+ }
37
+ const p = evalDeCasteljau(ps, 0.5); // peak is reached at t = 0.5
38
+ const dF = getDistanceToLineFunction(ps[0], ps[2]);
39
+ const d = abs(dF(p));
40
+ return d;
41
+ }
42
+ export { splitByDeviationFromStraighLine_Quad };
43
+ // Quokka tests
44
+ // splitByDeviationFromStraighLine_Quad([[0,0],[0,4],[-3,4],[20,0]], 0.25);//?
45
+ // splitByDeviationFromStraighLine_Quad([
46
+ // [128, 423],
47
+ // [128, 423],
48
+ // [128, 423]
49
+ // ]);//?
50
+ //# sourceMappingURL=split-by-deviation-from-straight-line-quad.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split-by-deviation-from-straight-line-quad.js","sourceRoot":"","sources":["../../src/bezier/split-by-deviation-from-straight-line-quad.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAGrB;;;;;;;;GAQG;AACF,SAAS,oCAAoC,CACtC,EAAc,EACd,IAAY;IAEhB,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,OAAO,IAAI,EAAE,CAAC;QACV,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC/B,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QAE/B,IAAI,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC;YAC/C,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAG,CAAC,CAAC;YACrB,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;gBACX,OAAO,GAAG,CAAC;YACf,CAAC;YACD,SAAS;QACb,CAAC;QAED,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAC,CAAC,CAAC;QAEtB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChB,CAAC;AACL,CAAC;AAGD,SAAS,OAAO,CAAC,EAAc;IAC3B,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,CAAC;IACb,CAAC;IACD,MAAM,CAAC,GAAG,eAAe,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAE,6BAA6B;IAClE,MAAM,EAAE,GAAG,yBAAyB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnD,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAErB,OAAO,CAAC,CAAC;AACb,CAAC;AAGD,OAAO,EAAE,oCAAoC,EAAE,CAAA;AAG/C,eAAe;AACf,8EAA8E;AAC9E,yCAAyC;AACzC,kBAAkB;AAClB,kBAAkB;AAClB,iBAAiB;AACjB,SAAS"}
@@ -0,0 +1,29 @@
1
+ import { evalDeCasteljau } from './eval-de-casteljau.js';
2
+ import { splitByDeviationFromStraighLine_Cubic_Crude } from './split-by-deviation-from-straight-line-cubic.js';
3
+ // import { splitByDeviationFromStraighLine_Cubic_Precise } from './split-by-deviation-from-straight-line-cubic';
4
+ import { splitByDeviationFromStraighLine_Quad } from './split-by-deviation-from-straight-line-quad.js';
5
+ /**
6
+ * Returns the result of splitting the given bezier curve into straight line
7
+ * segments up to `maxDeviation`
8
+ *
9
+ *
10
+ * @param ps
11
+ * @param maxDeviation maximum deviation from straight line
12
+ */
13
+ function splitIntoLineSegments(ps, maxDeviation) {
14
+ const ts = ps.length === 3
15
+ ? splitByDeviationFromStraighLine_Quad(ps, maxDeviation)
16
+ // : splitByDeviationFromStraighLine_Cubic_Precise(ps, maxDeviation)
17
+ : splitByDeviationFromStraighLine_Cubic_Crude(ps, maxDeviation);
18
+ const segs = [];
19
+ for (let i = 0; i < ts.length - 1; i++) {
20
+ const p0 = evalDeCasteljau(ps, ts[i]);
21
+ const p1 = evalDeCasteljau(ps, ts[i + 1]);
22
+ segs.push([p0, p1]);
23
+ }
24
+ return segs;
25
+ }
26
+ export { splitIntoLineSegments };
27
+ // Quokka tests
28
+ // splitByDeviationFromStraighLine([[0,0],[0,4],[-3,4],[20,0]], 0.25);//?
29
+ //# sourceMappingURL=split-into-line-segments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split-into-line-segments.js","sourceRoot":"","sources":["../../src/bezier/split-into-line-segments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,2CAA2C,EAAE,MAAM,kDAAkD,CAAC;AAC/G,iHAAiH;AACjH,OAAO,EAAE,oCAAoC,EAAE,MAAM,iDAAiD,CAAC;AAGvG;;;;;;;GAOG;AACH,SAAS,qBAAqB,CACtB,EAAc,EACd,YAAoB;IAExB,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,KAAK,CAAC;QACtB,CAAC,CAAC,oCAAoC,CAAC,EAAE,EAAE,YAAY,CAAC;QACxD,oEAAoE;QACpE,CAAC,CAAC,2CAA2C,CAAC,EAAE,EAAE,YAAY,CAAC,CAAA;IAEnE,MAAM,IAAI,GAAiB,EAAE,CAAC;IAC9B,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACjC,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAGD,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAGhC,eAAe;AACf,yEAAyE"}
@@ -0,0 +1,57 @@
1
+ import { getWebGLContext } from './webgl-utils/get-gl-context.js';
2
+ import { main_Vertex } from './shaders/main.vertex.js';
3
+ import { getMainFragment } from './shaders/main.fragment.js';
4
+ import { initProgram } from './webgl-utils/use-program.js';
5
+ import { mainProgram } from './main-program.js';
6
+ import { ROW_COUNT } from './row-count.js';
7
+ import { getPathsFromStr } from './svg/get-paths-from-str.js';
8
+ import { MAX_ASPECT_RATIO_BEFORE_STRETCH } from './max-aspect-ratio-before-stretch.js';
9
+ // import { debugShaders } from './debug-shaders.js';
10
+ const { ceil, min, max } = Math;
11
+ /**
12
+ *
13
+ * @param gl
14
+ * @param psss
15
+ * @param width
16
+ * @param height
17
+ * @param viewbox
18
+ * @param maxDistance
19
+ * @param sdfExponent
20
+ * @param inclInside
21
+ * @param inclOutside
22
+ * @param x
23
+ * @param y
24
+ * @param channel
25
+ * @param resolution
26
+ */
27
+ function generateIntoFramebuffer(gl, psss, width, height, viewbox, maxDistance, sdfExponent = 1, inclInside = true, inclOutside = true,
28
+ // framebuffer: WebGLFramebuffer | null,
29
+ x = 0, y = 0, channel = 0, resolution = 0.5) {
30
+ // debugShaders(gl); // comment for production
31
+ const psss_ = typeof psss === 'string'
32
+ ? getPathsFromStr(psss)
33
+ : psss;
34
+ const glContext = getWebGLContext(gl);
35
+ const { onContextLoss } = glContext;
36
+ let stretch = 1;
37
+ const aspectRatio = width / height;
38
+ if (aspectRatio > MAX_ASPECT_RATIO_BEFORE_STRETCH) {
39
+ const r = width / MAX_ASPECT_RATIO_BEFORE_STRETCH;
40
+ stretch = r / height;
41
+ height = r;
42
+ }
43
+ const cellSize = height / ROW_COUNT;
44
+ const maxDim = max(width, height);
45
+ const colCount = ceil(width / cellSize);
46
+ const padCount = 2 * ceil(min(maxDistance, maxDim) / cellSize / 2);
47
+ const programMain = initProgram(glContext, `main${colCount}-${padCount}`, main_Vertex, getMainFragment(colCount, padCount));
48
+ gl.useProgram(programMain.program);
49
+ mainProgram(glContext, programMain, resolution, psss_, viewbox, maxDistance, sdfExponent, width, height, colCount, cellSize, inclInside, inclOutside, padCount, stretch);
50
+ // Handle context loss occurring during any of the above calls
51
+ if (gl.isContextLost()) {
52
+ onContextLoss();
53
+ throw new Error('Webgl2 context lost.');
54
+ }
55
+ }
56
+ export { generateIntoFramebuffer };
57
+ //# sourceMappingURL=generate-sdf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-sdf.js","sourceRoot":"","sources":["../src/generate-sdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,C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AAW,CAC3B,SAAS,EAAE,OAAO,QAAQ,IAAI,QAAQ,EAAE,EACxC,WAAW,EAAE,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CACnD,CAAC;IAEF,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACnC,WAAW,CACP,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EACzC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAC1D,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,CACvD,CAAC;IAEF,8DAA8D;IAC9D,IAAI,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC;QACrB,aAAa,EAAE,CAAC;QAEhB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC5C,CAAC;AACL,CAAC;AAGD,OAAO,EAAE,uBAAuB,EAAE,CAAA"}
package/node/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { generateIntoFramebuffer } from './generate-sdf.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,100 @@
1
+ import { useTexture } from './webgl-utils/use-texture.js';
2
+ import { setAttribute } from './webgl-utils/set-attribute.js';
3
+ import { setUniform } from './webgl-utils/set-uniform.js';
4
+ import { setUniformBlock } from './webgl-utils/set-uniform-block.js';
5
+ import { prepareBuffers } from './prepare-buffers.js';
6
+ import { TEX_WIDTH } from './tex-width.js';
7
+ import { ROW_COUNT } from './row-count.js';
8
+ const SEG_TEX_INDEX = 0;
9
+ const CELL_TEX_INDEX = 1;
10
+ const CROSS_TEX_INDEX = 2;
11
+ function mainProgram(glContext, programMain, resolution, psss, viewbox, maxDistance, sdfExponent = 1, width, height, colCount, cellSize, inclInside, inclOutside, padCount, stretch) {
12
+ const { gl } = glContext;
13
+ const vertices = [];
14
+ const x0 = 0;
15
+ const y0 = 0;
16
+ const x1 = 1 / ROW_COUNT;
17
+ const y1 = 1 / ROW_COUNT;
18
+ vertices.push(x0, y0, x1, y0, x0, y1); // First triangle: (x0,y0), (x1,y0), (x0,y1)
19
+ vertices.push(x1, y0, x1, y1, x0, y1); // Second triangle: (x1,y0), (x1,y1), (x0,y1)
20
+ const uvArr = new Float32Array(vertices);
21
+ const setUniform_ = setUniform(programMain);
22
+ const setAttribute_ = setAttribute(programMain);
23
+ const { lineSegPtCoords_Arr, segIdxs_PerCell_Range_Arr, closeCellIdxs_PerCell_Arr, closeCellIdxs_PerCell_Range_Arr, crossCellIdxs_PerCell_Arr, crossCellIdxs_perCell_Range_Arr, segIdxs_PerStrip_Range_Arr } = prepareBuffers(psss, width, height, colCount, cellSize, maxDistance, padCount, resolution, viewbox, stretch);
24
+ // Init/update attributes
25
+ setAttribute_('aUV', 2, // size, i.e 2d - draw 2 values each time
26
+ gl.FLOAT, gl.STATIC_DRAW, uvArr);
27
+ setAttribute_('aCrossIdxRangePerCell', 2, // count
28
+ gl.INT, gl.STATIC_DRAW, crossCellIdxs_perCell_Range_Arr, 1 // instance division (once per instance)
29
+ );
30
+ setAttribute_('aCloseCellIdxRangePerCell', 2, // count
31
+ gl.INT, gl.STATIC_DRAW, closeCellIdxs_PerCell_Range_Arr, 1 // instance division (once per instance)
32
+ );
33
+ // Init/update uniforms
34
+ setUniform_('2f', 'uWidthHeight', width, height);
35
+ setUniform_('1f', 'uMaxDistance', maxDistance);
36
+ setUniform_('1f', 'uExponent', sdfExponent); // TODO
37
+ setUniform_('1i', 'uIncl', (inclInside ? 1 : 0) + (inclOutside ? 2 : 0));
38
+ setUniform_('1f', 'uStretch', stretch); // TODO
39
+ setUniformBlock(programMain)('SegIdxRangePerCellBlock', 0, segIdxs_PerCell_Range_Arr);
40
+ setUniformBlock(programMain)('SegIdxRangePerStripBlock', 1, segIdxs_PerStrip_Range_Arr);
41
+ ///////////////////////////////////////
42
+ // Create buffer for line segment data
43
+ useTexture(glContext, SEG_TEX_INDEX, 'segs');
44
+ gl.texImage2D(// really 1d
45
+ gl.TEXTURE_2D, 0, // level - irrelevant
46
+ gl.RGBA32F, // internalFormat - we're using 4 floats for the 2 line segment endpoints
47
+ lineSegPtCoords_Arr.length / 4, // width === number of lines
48
+ 1, // height - linear data texture so we only need height of 1
49
+ 0, // border - whatever
50
+ gl.RGBA, // format
51
+ gl.FLOAT, // it holds floats
52
+ lineSegPtCoords_Arr // texture data
53
+ );
54
+ const segTexLoc = gl.getUniformLocation(programMain.program, "uSegs");
55
+ gl.uniform1i(segTexLoc, SEG_TEX_INDEX);
56
+ ///////////////////////////////////////////////
57
+ ///////////////////////////////////////////////
58
+ // Create buffer for close cell indexes per cell
59
+ useTexture(glContext, CELL_TEX_INDEX, 'closeCellIdxsPerCell');
60
+ gl.texImage2D(// really 1d
61
+ gl.TEXTURE_2D, 0, // level - irrelevant
62
+ gl.R32I, // internalFormat - we're using 1 signed 32-bit int for indexes
63
+ TEX_WIDTH, // width === number of indexes
64
+ closeCellIdxs_PerCell_Arr.length / TEX_WIDTH, 0, // border - whatever
65
+ gl.RED_INTEGER, // format
66
+ gl.INT, // it holds ints
67
+ closeCellIdxs_PerCell_Arr // texture data
68
+ );
69
+ const cellTexLoc = gl.getUniformLocation(programMain.program, "uCloseCellIdxs");
70
+ gl.uniform1i(cellTexLoc, CELL_TEX_INDEX);
71
+ ///////////////////////////////////////////////
72
+ ///////////////////////////////////////////////
73
+ // Create buffer for crossing cell indexes per cell
74
+ useTexture(glContext, CROSS_TEX_INDEX, 'crossCellIdxsPerCell');
75
+ gl.texImage2D(// really 1d
76
+ gl.TEXTURE_2D, 0, // level - irrelevant
77
+ gl.R32I, // internalFormat - we're using 1 signed 32-bit int for indexes
78
+ TEX_WIDTH, // width === number of indexes
79
+ crossCellIdxs_PerCell_Arr.length / TEX_WIDTH, // height - linear data texture so we only need height of 1
80
+ 0, // border - whatever
81
+ gl.RED_INTEGER, // format
82
+ gl.INT, // it holds ints
83
+ crossCellIdxs_PerCell_Arr // texture data
84
+ );
85
+ const crossTexLoc = gl.getUniformLocation(programMain.program, "uCrossCellIdxs");
86
+ gl.uniform1i(crossTexLoc, CROSS_TEX_INDEX);
87
+ ///////////////////////////////////////////////
88
+ if (stretch > 1) {
89
+ gl.enable(gl.SCISSOR_TEST);
90
+ gl.scissor(0, 0, width, height / stretch);
91
+ }
92
+ gl.viewport(0, 0, width, height);
93
+ // draw a square colCount * ROW_COUNT times - 6 vertics
94
+ gl.drawArraysInstanced(gl.TRIANGLES, 0, 6, colCount * ROW_COUNT);
95
+ if (stretch > 1) {
96
+ gl.disable(gl.SCISSOR_TEST);
97
+ }
98
+ }
99
+ export { mainProgram };
100
+ //# sourceMappingURL=main-program.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main-program.js","sourceRoot":"","sources":["../src/main-program.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,eAAe,GAAG,CAAC,CAAC;AAG1B,SAAS,WAAW,CACZ,SAAoB,EACpB,WAAoB,EACpB,UAAiB,EACjB,IAAoB,EACpB,OAAsC,EACtC,WAAmB,EACnB,WAAW,GAAG,CAAC,EACf,KAAa,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IAC1B,EAAE,CAAC,GAAG,EAAK,gBAAgB;IAC3B,yBAAyB,CAAE,eAAe;KAC7C,CAAC;IACF,MAAM,WAAW,GAAG,EAAE,CAAC,kBAAkB,CAAC,WAAW,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IACjF,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAC3C,+CAA+C;IAE/C,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QACd,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;QAC3B,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAC,OAAO,CAAC,CAAA;IAC3C,CAAC;IAED,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAEjC,uDAAuD;IACvD,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAC,SAAS,CAAC,CAAC;IAE/D,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QACd,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;IAChC,CAAC;AACL,CAAC;AAGD,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -0,0 +1,3 @@
1
+ const MAX_ASPECT_RATIO_BEFORE_STRETCH = 4;
2
+ export { MAX_ASPECT_RATIO_BEFORE_STRETCH };
3
+ //# sourceMappingURL=max-aspect-ratio-before-stretch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"max-aspect-ratio-before-stretch.js","sourceRoot":"","sources":["../src/max-aspect-ratio-before-stretch.ts"],"names":[],"mappings":"AACA,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAG1C,OAAO,EAAE,+BAA+B,EAAE,CAAA"}
@@ -0,0 +1,114 @@
1
+ import { bezierCurvesToLineSegs } from './bezier/bezier-curves-to-line-segs.js';
2
+ import { findCloseCells } from './utils/find-close-cells.js';
3
+ import { clipLineSegmentToGrid } from './utils/clip-line-segment-to-grid.js';
4
+ import { createEmptyGrid } from './utils/create-empty-grid.js';
5
+ import { findCrossingCells } from './utils/find-crossing-cells.js';
6
+ import { TEX_WIDTH } from './tex-width.js';
7
+ import { ROW_COUNT } from './row-count.js';
8
+ import { createEmptyStrips } from './utils/create-empty-strips.js';
9
+ import { clipLineSegmentToStrips } from './utils/clip-line-segment-to-strips.js';
10
+ import { mapToViewbox } from './utils/map-to-viewbox.js';
11
+ // import { sum } from './utils/sum.js';
12
+ function prepareBuffers(psss, width, height, colCount, cellSize, maxDistance, padCount, resolution = 0.5, viewbox = [0, 0, width, height], stretch = 1) {
13
+ ////////////////////////////////////////////////////////////////////////////
14
+ const psss_ = mapToViewbox(viewbox, width, height / stretch, psss);
15
+ const lineSegs = bezierCurvesToLineSegs(psss_, resolution);
16
+ const grid = createEmptyGrid(colCount, padCount);
17
+ const strips = createEmptyStrips();
18
+ for (let i = 0; i < lineSegs.length; i++) {
19
+ const seg = lineSegs[i];
20
+ // Split the line segment into multiple segments that fit within grid cells
21
+ clipLineSegmentToGrid(grid, width, height, colCount, cellSize, seg, padCount); // add segments to grid
22
+ clipLineSegmentToStrips(strips, height, seg); // add segments to strips
23
+ }
24
+ findCloseCells(grid, colCount, cellSize, maxDistance, padCount); // add close cells
25
+ findCrossingCells(grid, colCount, padCount); // add crossing cells
26
+ ////////////////////////////////////////////////////////////////////////////
27
+ const allSegs = [];
28
+ const segIdxs_PerCell_Range = [];
29
+ // close cells
30
+ const closeCellIdxs_PerCell = [];
31
+ const closeCellIdxs_PerCell_Range = [];
32
+ // crossing cells
33
+ const crossCellIdxs_PerCell = [];
34
+ const crossCellIdxs_PerCell_Range = [];
35
+ // const closeCellIdxsPerCell_: number[][] = []; // testing
36
+ let S1 = 0;
37
+ let S2 = 0;
38
+ let S3 = 0;
39
+ for (let i = 0; i < colCount + 2 * padCount; i++) {
40
+ for (let j = 0; j < ROW_COUNT + 2 * padCount; j++) {
41
+ const cell = grid[i][j];
42
+ ///////////
43
+ if (i >= padCount && i < colCount + padCount &&
44
+ j >= padCount && j < ROW_COUNT + padCount) {
45
+ const { closeCells, crossingCells } = cell;
46
+ const L1 = crossingCells.length;
47
+ crossCellIdxs_PerCell.push(...crossingCells);
48
+ crossCellIdxs_PerCell_Range.push([S1, L1]);
49
+ S1 += L1;
50
+ const L2 = closeCells.length;
51
+ closeCellIdxs_PerCell.push(...closeCells);
52
+ closeCellIdxs_PerCell_Range.push([S2, L2]);
53
+ S2 += L2;
54
+ // closeCellIdxsPerCell_.push(closeCells); // testing
55
+ }
56
+ //////////
57
+ const { lineSegs } = cell;
58
+ const L3 = lineSegs.length;
59
+ segIdxs_PerCell_Range.push([S3, L3]);
60
+ S3 += L3;
61
+ allSegs.push(...lineSegs);
62
+ }
63
+ }
64
+ // It is a requirement to fill in multiples of `TEX_WIDTH`
65
+ while (closeCellIdxs_PerCell.length % TEX_WIDTH !== 0) {
66
+ closeCellIdxs_PerCell.push(0);
67
+ }
68
+ while (crossCellIdxs_PerCell.length % TEX_WIDTH !== 0) {
69
+ crossCellIdxs_PerCell.push(0);
70
+ }
71
+ // Add line segs from strips
72
+ const segIdxs_PerStrip_Range = [];
73
+ for (let i = 0; i < ROW_COUNT; i++) {
74
+ const strip = strips[i];
75
+ const { lineSegs } = strip;
76
+ //////////
77
+ const L = lineSegs.length;
78
+ segIdxs_PerStrip_Range.push([S3, L]);
79
+ S3 += L;
80
+ allSegs.push(...lineSegs);
81
+ }
82
+ // all line segments, with their ranges per cell and per strip
83
+ const lineSegPtCoords_Arr = new Float32Array(allSegs.flat(2));
84
+ const segIdxs_PerCell_Range_Arr = new Int32Array(segIdxs_PerCell_Range.flat());
85
+ // close cell idxs and range
86
+ const closeCellIdxs_PerCell_Range_Arr = new Int32Array(closeCellIdxs_PerCell_Range.flat());
87
+ const closeCellIdxs_PerCell_Arr = new Int32Array(closeCellIdxs_PerCell);
88
+ // cross cell idxs and range
89
+ const crossCellIdxs_PerCell_Arr = new Int32Array(crossCellIdxs_PerCell);
90
+ const crossCellIdxs_perCell_Range_Arr = new Int32Array(crossCellIdxs_PerCell_Range.flat());
91
+ // segment index ranges per strip
92
+ const segIdxs_PerStrip_Range_Arr = new Int32Array(segIdxs_PerStrip_Range.flat());
93
+ // testing
94
+ // const r = sum(closeCellIdxsPerCell_.map((c: number[]) => {
95
+ // let tot = 0;
96
+ // for (let i=0; i<c.length; i++) {
97
+ // const idx = c[i];
98
+ // const u = Math.trunc(idx / (ROW_COUNT + 2*padCount));
99
+ // const v = idx % (ROW_COUNT + 2*padCount);
100
+ // tot += grid[u][v].lineSegs.length;
101
+ // }
102
+ // return tot;
103
+ // }));
104
+ // console.log(r, r/colCount/ROW_COUNT);
105
+ return {
106
+ lineSegPtCoords_Arr,
107
+ segIdxs_PerCell_Range_Arr,
108
+ closeCellIdxs_PerCell_Arr, closeCellIdxs_PerCell_Range_Arr,
109
+ crossCellIdxs_PerCell_Arr, crossCellIdxs_perCell_Range_Arr,
110
+ segIdxs_PerStrip_Range_Arr
111
+ };
112
+ }
113
+ export { prepareBuffers };
114
+ //# sourceMappingURL=prepare-buffers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepare-buffers.js","sourceRoot":"","sources":["../src/prepare-buffers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,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,CAAC;IAGD,8DAA8D;IAC9D,MAAM,mBAAmB,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,MAAM,yBAAyB,GAAG,IAAI,UAAU,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAAC,CAAC;IAE/E,4BAA4B;IAC5B,MAAM,+BAA+B,GAAG,IAAI,UAAU,CAAC,2BAA2B,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3F,MAAM,yBAAyB,GAAG,IAAI,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAExE,4BAA4B;IAC5B,MAAM,yBAAyB,GAAG,IAAI,UAAU,CAAC,qBAAqB,CAAC,CAAC;IACxE,MAAM,+BAA+B,GAAG,IAAI,UAAU,CAAC,2BAA2B,CAAC,IAAI,EAAE,CAAC,CAAC;IAE3F,iCAAiC;IACjC,MAAM,0BAA0B,GAAG,IAAI,UAAU,CAAC,sBAAsB,CAAC,IAAI,EAAE,CAAC,CAAC;IAEjF,UAAU;IACV,6DAA6D;IAC7D,mBAAmB;IACnB,uCAAuC;IACvC,4BAA4B;IAC5B,gEAAgE;IAChE,oDAAoD;IAEpD,6CAA6C;IAC7C,QAAQ;IACR,kBAAkB;IAClB,OAAO;IACP,wCAAwC;IAExC,OAAO;QACH,mBAAmB;QACnB,yBAAyB;QACzB,yBAAyB,EAAE,+BAA+B;QAC1D,yBAAyB,EAAE,+BAA+B;QAC1D,0BAA0B;KAC7B,CAAA;AACL,CAAC;AAGD,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,4 @@
1
+ // 32 works by far the best (empirically determined) as compared to e.g. 16 or 64
2
+ const ROW_COUNT = 32;
3
+ export { ROW_COUNT };
4
+ //# sourceMappingURL=row-count.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row-count.js","sourceRoot":"","sources":["../src/row-count.ts"],"names":[],"mappings":"AACA,iFAAiF;AACjF,MAAM,SAAS,GAAG,EAAE,CAAC;AAGrB,OAAO,EAAE,SAAS,EAAE,CAAA"}