flo-mat 4.0.1 → 4.0.2

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 (132) hide show
  1. package/README.md +1 -1
  2. package/__tests__/find-2-prong/get-medial/get-closest-points.spec.ts +49 -0
  3. package/browser/index.js +1153 -1205
  4. package/browser/index.min.js +1 -1
  5. package/node/closest-boundary-point/foot-and-endpoint-info.d.ts +0 -3
  6. package/node/closest-boundary-point/get-close-boundary-points-certified.d.ts +1 -1
  7. package/node/closest-boundary-point/get-close-boundary-points-certified.js +2 -2
  8. package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -1
  9. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.d.ts +1 -2
  10. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js +34 -24
  11. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js.map +1 -1
  12. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.d.ts +1 -1
  13. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js +6 -9
  14. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js.map +1 -1
  15. package/node/cp-node/fs/insert-cp-node.d.ts +2 -2
  16. package/node/cp-node/fs/insert-cp-node.js.map +1 -1
  17. package/node/cp-node/fs/is-order-correct.d.ts +2 -2
  18. package/node/cp-node/fs/is-order-correct.js.map +1 -1
  19. package/node/cp-node/fs/traverse-cp.js.map +1 -1
  20. package/node/cp-node/fs/traverse-vertices.d.ts +1 -1
  21. package/node/cp-node/fs/traverse-vertices.js.map +1 -1
  22. package/node/debug/functions/draw-elem/draw-branch.d.ts +1 -1
  23. package/node/debug/functions/draw-elem/draw-branch.js.map +1 -1
  24. package/node/debug/functions/draw-elem/draw-cp-node.d.ts +1 -1
  25. package/node/debug/functions/draw-elem/draw-cp-node.js +2 -2
  26. package/node/debug/functions/draw-elem/draw-cp-node.js.map +1 -1
  27. package/node/debug/functions/draw-elem/draw-leaves.d.ts +1 -1
  28. package/node/debug/functions/draw-elem/draw-leaves.js +2 -2
  29. package/node/debug/functions/draw-elem/draw-leaves.js.map +1 -1
  30. package/node/debug/functions/draw-elem/draw-mat.d.ts +1 -1
  31. package/node/debug/functions/draw-elem/draw-mat.js +1 -2
  32. package/node/debug/functions/draw-elem/draw-mat.js.map +1 -1
  33. package/node/debug/functions/draw-elem/draw-min-y.d.ts +1 -1
  34. package/node/debug/functions/draw-elem/draw-min-y.js.map +1 -1
  35. package/node/debug/functions/draw-elem/draw-three-prong.d.ts +1 -1
  36. package/node/debug/functions/draw-elem/draw-three-prong.js +2 -2
  37. package/node/debug/functions/draw-elem/draw-three-prong.js.map +1 -1
  38. package/node/debug/functions/draw-elem/draw-vertex.d.ts +1 -1
  39. package/node/debug/functions/draw-elem/draw-vertex.js +0 -2
  40. package/node/debug/functions/draw-elem/draw-vertex.js.map +1 -1
  41. package/node/error-analysis/gamma.d.ts +32 -0
  42. package/node/error-analysis/gamma.js +39 -0
  43. package/node/error-analysis/gamma.js.map +1 -0
  44. package/node/find-2-prong/find-2-prong.js +5 -5
  45. package/node/find-2-prong/find-2-prong.js.map +1 -1
  46. package/node/find-2-prong/get-medial/get-closest-points.js +27 -23
  47. package/node/find-2-prong/get-medial/get-closest-points.js.map +1 -1
  48. package/node/find-3-prong/calc-better-x.d.ts +1 -1
  49. package/node/find-3-prong/calc-better-x.js +6 -4
  50. package/node/find-3-prong/calc-better-x.js.map +1 -1
  51. package/node/find-3-prong/calc-initial-3-prong-center.d.ts +1 -1
  52. package/node/find-3-prong/calc-initial-3-prong-center.js +4 -3
  53. package/node/find-3-prong/calc-initial-3-prong-center.js.map +1 -1
  54. package/node/find-3-prong/find-3-prong-for-delta3s.js +22 -5
  55. package/node/find-3-prong/find-3-prong-for-delta3s.js.map +1 -1
  56. package/node/find-3-prong/find-and-add-3-prong.d.ts +2 -2
  57. package/node/find-3-prong/find-and-add-3-prong.js +15 -0
  58. package/node/find-3-prong/find-and-add-3-prong.js.map +1 -1
  59. package/node/find-3-prong/find-and-add-3-prongs-on-loop.js +8 -21
  60. package/node/find-3-prong/find-and-add-3-prongs-on-loop.js.map +1 -1
  61. package/node/find-3-prong/find-and-add-3-prongs.d.ts +1 -4
  62. package/node/find-3-prong/find-and-add-3-prongs.js +1 -2
  63. package/node/find-3-prong/find-and-add-3-prongs.js.map +1 -1
  64. package/node/find-3-prong/get-closest-points.d.ts +1 -1
  65. package/node/find-3-prong/get-closest-points.js +2 -2
  66. package/node/find-3-prong/get-closest-points.js.map +1 -1
  67. package/node/find-3-prong/timed-cc.d.ts +3 -0
  68. package/node/find-3-prong/timed-cc.js +5 -0
  69. package/node/find-3-prong/timed-cc.js.map +1 -0
  70. package/node/find-mat/create-initial-cp-tree.d.ts +2 -2
  71. package/node/find-mat/create-initial-cp-tree.js +2 -2
  72. package/node/find-mat/create-initial-cp-tree.js.map +1 -1
  73. package/node/find-mat/find-mat.d.ts +4 -4
  74. package/node/find-mat/find-mat.js.map +1 -1
  75. package/node/find-mat/find-mats.js +2 -2
  76. package/node/find-mat/find-mats.js.map +1 -1
  77. package/node/find-mat/get-meta.d.ts +2 -2
  78. package/node/find-mat/get-meta.js +1 -0
  79. package/node/find-mat/get-meta.js.map +1 -1
  80. package/node/index.d.ts +1 -0
  81. package/node/index.js +1 -0
  82. package/node/index.js.map +1 -1
  83. package/node/mat/create-new-cp-trees.d.ts +2 -2
  84. package/node/mat/create-new-cp-trees.js +2 -2
  85. package/node/mat/create-new-cp-trees.js.map +1 -1
  86. package/node/mat/get-cp-node-to-left-or-same.d.ts +2 -2
  87. package/node/mat/get-cp-node-to-left-or-same.js +2 -1
  88. package/node/mat/get-cp-node-to-left-or-same.js.map +1 -1
  89. package/node/mat/mat-meta.d.ts +2 -2
  90. package/node/point-on-shape/get-osculating-circle.js +2 -1
  91. package/node/point-on-shape/get-osculating-circle.js.map +1 -1
  92. package/package.json +5 -6
  93. package/src/closest-boundary-point/foot-and-endpoint-info.ts +0 -3
  94. package/src/closest-boundary-point/get-close-boundary-points-certified.ts +0 -2
  95. package/src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts +41 -27
  96. package/src/closest-boundary-point/root-interval-to-distance-squared-interval.ts +5 -10
  97. package/src/cp-node/fs/insert-cp-node.ts +2 -2
  98. package/src/cp-node/fs/is-order-correct.ts +2 -2
  99. package/src/cp-node/fs/traverse-cp.ts +1 -1
  100. package/src/cp-node/fs/traverse-vertices.ts +1 -2
  101. package/src/debug/functions/check-ordering.ts +0 -1
  102. package/src/debug/functions/draw-elem/draw-branch.ts +1 -3
  103. package/src/debug/functions/draw-elem/draw-cp-node.ts +3 -4
  104. package/src/debug/functions/draw-elem/draw-leaves.ts +3 -3
  105. package/src/debug/functions/draw-elem/draw-mat.ts +2 -5
  106. package/src/debug/functions/draw-elem/draw-min-y.ts +2 -2
  107. package/src/debug/functions/draw-elem/draw-three-prong.ts +3 -3
  108. package/src/debug/functions/draw-elem/draw-vertex.ts +1 -4
  109. package/src/error-analysis/gamma.ts +9 -2
  110. package/src/find-2-prong/find-2-prong.ts +7 -6
  111. package/src/find-2-prong/get-medial/get-closest-points.ts +24 -26
  112. package/src/find-3-prong/calc-better-x.ts +7 -4
  113. package/src/find-3-prong/calc-initial-3-prong-center.ts +2 -3
  114. package/src/find-3-prong/find-3-prong-for-delta3s.ts +23 -5
  115. package/src/find-3-prong/find-and-add-3-prong.ts +18 -4
  116. package/src/find-3-prong/find-and-add-3-prongs-on-loop.ts +7 -23
  117. package/src/find-3-prong/find-and-add-3-prongs.ts +5 -3
  118. package/src/find-3-prong/get-closest-points.ts +0 -2
  119. package/src/find-3-prong/timed-cc.ts +9 -0
  120. package/src/find-mat/create-initial-cp-tree.ts +3 -3
  121. package/src/find-mat/find-mat.ts +5 -6
  122. package/src/find-mat/find-mats.ts +4 -2
  123. package/src/find-mat/get-meta.ts +3 -3
  124. package/src/index.ts +2 -1
  125. package/src/mat/create-new-cp-trees.ts +3 -3
  126. package/src/mat/get-cp-node-to-left-or-same.ts +4 -3
  127. package/src/mat/mat-meta.ts +2 -2
  128. package/src/point-on-shape/get-osculating-circle.ts +2 -1
  129. package/wallaby.mjs +1 -0
  130. package/node/closest-boundary-point/get-p-from-box.d.ts +0 -3
  131. package/node/closest-boundary-point/get-p-from-box.js +0 -11
  132. package/node/closest-boundary-point/get-p-from-box.js.map +0 -1
package/README.md CHANGED
@@ -7,7 +7,7 @@ Bug reports, pull requests and ⭐⭐⭐⭐⭐s are welcome and appreciated!
7
7
  ---
8
8
  **[Demo](https://florissteenkamp.github.io/MAT-Demo/)**
9
9
 
10
- **[Full simple 140 Lines of Code live StackBlitz project](https://stackblitz.com/edit/typescript-yucdon)**
10
+ **[Full simple 140 Lines of Code live StackBlitz project](https://stackblitz.com/edit/typescript-pheway51?file=index.ts)**
11
11
 
12
12
  **[GitHub](https://github.com/FlorisSteenkamp/MAT)**
13
13
 
@@ -0,0 +1,49 @@
1
+ import { expect, test } from '@jest/globals';
2
+ import type { PrePointOnShape } from '../../../src/point-on-shape/point-on-shape';
3
+ import { getClosestPoint } from '../../../src/find-2-prong/get-medial/get-closest-points';
4
+ import { CurvePiece } from '../../../src/mat/curve-piece';
5
+ import { Curve } from 'flo-boolean';
6
+ import { getCurvatureExtremaDd } from 'flo-bezier3';
7
+ import { deflate } from 'flo-poly';
8
+ import { translate } from 'flo-vector2d';
9
+
10
+
11
+ test('getClosestPoints', function() {
12
+ const maxPowerOf2 = 11;
13
+ const nnorm = [20.25, 239];
14
+ const ps = [[610, -20], [484, -20], [384, 20.5]];
15
+ const t = 0.25;
16
+ const p = [548.625, -17.46875];
17
+ const xO = translate(p, nnorm);//?
18
+ const curve: Curve = {
19
+ idx: 0,
20
+ ps,
21
+ prev: undefined!, // just used for comparing by function
22
+ loop: undefined!, // not used by function
23
+ next: undefined! // ...
24
+ };
25
+
26
+ const yPos: PrePointOnShape = {
27
+ isSource: true,
28
+ p, t, curve
29
+ };
30
+ const for1Prong = false;
31
+ const angle = 0;
32
+ const curvePiece: CurvePiece = { ts: [0,1], curve };
33
+
34
+ getCurvatureExtremaDd(ps); //=> none
35
+
36
+ const H = [
37
+ 47279295, -169198895.25, 139649335.875, -48674806.03125, 7804659.76171875,
38
+ -476248.4384765625
39
+ ];
40
+
41
+ const def = deflate(H,t);//?
42
+ // def = [47279295, -157379071.5, 100304568, -23598664.03125, 1904993.75390625]
43
+
44
+ const r = getClosestPoint(maxPowerOf2, nnorm, yPos, for1Prong, angle, curvePiece);
45
+
46
+ r;//?
47
+
48
+ expect(true).toBe(true);
49
+ });