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
@@ -1 +1 @@
1
- {"version":3,"file":"get-meta.js","sourceRoot":"","sources":["../../src/find-mat/get-meta.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAOpD,IAAI,WAAmB,CAAC;AAGxB,gBAAgB;AAChB,SAAS,gBAAgB,CACjB,KAAa,EACb,OAAoC;IAExC,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAEhC,sEAAsE;IAEtE,8BAA8B;IAC9B,2BAA2B;IAC3B,yCAAyC;IACzC,+CAA+C;IAC/C,sCAAsC;IACtC,gDAAgD;IAChD,6DAA6D;IAC7D,QAAQ;IACR,IAAI;IAEJ,wBAAwB;IACxB,OAAO,SAAU,CAAA;AACrB,CAAC;AAGD,gBAAgB;AAChB,SAAS,cAAc,CACf,KAAa;IAUjB,MAAM,kBAAkB,GAAiB,EAAE,CAAC;IAC5C,MAAM,kBAAkB,GAAiB,EAAE,CAAC;IAC5C,MAAM,aAAa,GAAiB,EAAE,CAAC;IACvC,MAAM,YAAY,GAAY,EAAE,CAAC;IACjC,MAAM,WAAW,GAAY,EAAE,CAAC;IAEhC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC9B,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;YACpB,MAAM,IAAI,GAAG,eAAe,CAAC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G,WAAW,CAAC,GAAG,EAAE,CAAC;IAC9B,MAAM,CAAC,WAAW,IAAI,GAAG,GAAG,WAAW,CAAC;IACxC,WAAW,GAAG,GAAG,CAAC;AACtB,CAAC;AAGD,SAAS,aAAa;IAClB,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAE/C,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IACpC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAChC,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAE9B,MAAM,CAAC,aAAa,IAAI,GAAG,GAAG,WAAW,CAAC;IAC1C,WAAW,GAAG,GAAG,CAAC;AACtB,CAAC;AAGD,SAAS,aAAa;IAClB,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAE/C,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IACpC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAEhC,MAAM,CAAC,WAAW,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC;AAC1D,CAAC;AAGD,OAAO,EACH,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,aAAa,EACb,aAAa,EAChB,CAAA"}
package/node/index.d.ts CHANGED
@@ -75,3 +75,4 @@ export { getHoleClosers } from './cp-node/fs/get-hole-closers.js';
75
75
  export { getInitialDegAngleBetweenMatCurves } from './cp-node/fs/get-angle-between-mat-curves.js';
76
76
  export { getAllVertices } from './cp-node/fs/get-all-vertices.js';
77
77
  export { isTrivial } from './cp-node/fs/is-trivial.js';
78
+ export { scaleCircle } from './geometry/circle.js';
package/node/index.js CHANGED
@@ -63,4 +63,5 @@ export { getHoleClosers } from './cp-node/fs/get-hole-closers.js';
63
63
  export { getInitialDegAngleBetweenMatCurves } from './cp-node/fs/get-angle-between-mat-curves.js';
64
64
  export { getAllVertices } from './cp-node/fs/get-all-vertices.js';
65
65
  export { isTrivial } from './cp-node/fs/is-trivial.js';
66
+ export { scaleCircle } from './geometry/circle.js';
66
67
  //# sourceMappingURL=index.js.map
package/node/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAepF,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,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BAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,mDAAmD,CAAC;AACjG,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import type { Loop } from 'flo-boolean';
2
2
  import type { CpNode } from '../cp-node/cp-node.js';
3
- import { LlRbTree } from 'flo-ll-rb-tree';
3
+ import { RbTree } from 'flo-ll-rb-tree';
4
4
  /**
5
5
  * @param cpNode
6
6
  *
7
7
  * @internal
8
8
  */
9
- declare function createNewCpTrees(cpNode: CpNode): Map<Loop, LlRbTree<CpNode>>;
9
+ declare function createNewCpTrees(cpNode: CpNode): Map<Loop, RbTree<CpNode>>;
10
10
  export { createNewCpTrees };
@@ -1,4 +1,4 @@
1
- import { LlRbTree } from 'flo-ll-rb-tree';
1
+ import { RbTree } from 'flo-ll-rb-tree';
2
2
  import { cpNodeComparator } from '../cp-node/fs/cp-node-comparator.js';
3
3
  import { getAllOnLoop } from '../cp-node/fs/get-all-on-loop.js';
4
4
  /**
@@ -13,7 +13,7 @@ function createNewCpTrees(cpNode) {
13
13
  const loop = cpNode.pointOnShape.curve.loop;
14
14
  let cpTree = cpTrees_.get(loop);
15
15
  if (!cpTree) {
16
- cpTree = new LlRbTree(cpNodeComparator, false);
16
+ cpTree = new RbTree(cpNodeComparator);
17
17
  cpTrees_.set(loop, cpTree);
18
18
  }
19
19
  cpTree.insert(cpNode);
@@ -1 +1 @@
1
- {"version":3,"file":"create-new-cp-trees.js","sourceRoot":"","sources":["../../src/mat/create-new-cp-trees.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAIhE;;;;GAIG;AACH,SAAS,gBAAgB,CACjB,MAAc;IAElB,MAAM,QAAQ,GAA+B,IAAI,GAAG,EAAE,CAAC;IAEvD,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE/C,SAAS,gBAAgB,CAAC,MAAc;QACpC,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;QAC5C,IAAI,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,GAAG,IAAI,QAAQ,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;YAC/C,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
1
+ {"version":3,"file":"create-new-cp-trees.js","sourceRoot":"","sources":["../../src/mat/create-new-cp-trees.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAIhE;;;;GAIG;AACH,SAAS,gBAAgB,CACjB,MAAc;IAElB,MAAM,QAAQ,GAA6B,IAAI,GAAG,EAAE,CAAC;IAErD,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE/C,SAAS,gBAAgB,CAAC,MAAc;QACpC,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;QAC5C,IAAI,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,GAAG,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACtC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import type { PrePointOnShape } from '../point-on-shape/point-on-shape.js';
2
2
  import type { CpNode } from '../cp-node/cp-node.js';
3
- import { LlRbTree } from 'flo-ll-rb-tree';
3
+ import { RbTree } from 'flo-ll-rb-tree';
4
4
  /**
5
5
  * @internal
6
6
  *
@@ -14,5 +14,5 @@ import { LlRbTree } from 'flo-ll-rb-tree';
14
14
  * @param order
15
15
  * @param order2
16
16
  */
17
- declare function getCpNodeToLeftOrSame(cpTree: LlRbTree<CpNode>, pos: PrePointOnShape, order: number, order2: number): CpNode | undefined;
17
+ declare function getCpNodeToLeftOrSame(cpTree: RbTree<CpNode>, pos: PrePointOnShape, order: number, order2: number): CpNode | undefined;
18
18
  export { getCpNodeToLeftOrSame };
@@ -21,7 +21,8 @@ function getCpNodeToLeftOrSame(cpTree, pos, order, order2) {
21
21
  if (cps[0] === undefined || cps[1] === undefined) {
22
22
  // Smaller than all -> cptree.min() === cps[1].data OR
23
23
  // Larger than all -> cptree.max() === cps[0].data
24
- return cpTree.max(cpTree.root);
24
+ // return cpTree.max(cpTree.root);
25
+ return cpTree.getMaxNode()?.datum;
25
26
  }
26
27
  return cps[0].datum;
27
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get-cp-node-to-left-or-same.js","sourceRoot":"","sources":["../../src/mat/get-cp-node-to-left-or-same.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAYG;AACH,SAAS,qBAAqB,CACtB,MAAwB,EACxB,GAAoB,EACpB,KAAa,EACb,MAAc;IAElB,MAAM,YAAY,GAAG,EAAE,GAAG,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC/C,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,EAAE,YAAY,EAAY,CAAC,CAAC;IAE1D,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;QAC/C,0BAA0B;QAC1B,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;QAC/C,sDAAsD;QACtD,mDAAmD;QACnD,OAAO,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACxB,CAAC;AAGD,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
1
+ {"version":3,"file":"get-cp-node-to-left-or-same.js","sourceRoot":"","sources":["../../src/mat/get-cp-node-to-left-or-same.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAYG;AACH,SAAS,qBAAqB,CACtB,MAAsB,EACtB,GAAoB,EACpB,KAAa,EACb,MAAc;IAElB,MAAM,YAAY,GAAG,EAAE,GAAG,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC/C,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,EAAE,YAAY,EAAY,CAAC,CAAC;IAE1D,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;QAC/C,0BAA0B;QAC1B,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;QAC/C,sDAAsD;QACtD,mDAAmD;QACnD,kCAAkC;QAClC,OAAO,MAAM,CAAC,UAAU,EAAE,EAAE,KAAK,CAAC;IACtC,CAAC;IAED,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACxB,CAAC;AAGD,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import type { Loop } from 'flo-boolean';
2
2
  import type { CpNode } from '../cp-node/cp-node.js';
3
3
  import type { Curve } from 'flo-boolean';
4
- import { LlRbTree } from 'flo-ll-rb-tree';
4
+ import { RbTree } from 'flo-ll-rb-tree';
5
5
  interface MatMeta {
6
6
  /** The minimum power of 2 such that `2**maxCoordPowerOf2 >= "the max coordinate"` */
7
7
  readonly maxCoordPowerOf2: number;
@@ -17,7 +17,7 @@ interface MatMeta {
17
17
  * `CpNode`s of the MAT by their compare order, i.e. their cyclic order
18
18
  * around the shape boundary.
19
19
  */
20
- readonly cpTrees: Map<Loop, LlRbTree<CpNode>>;
20
+ readonly cpTrees: Map<Loop, RbTree<CpNode>>;
21
21
  /** A map from a bezier and t value to a `PointOnShape` */
22
22
  /**
23
23
  * Stores the last insert id so each `CpNode` can have a unique id for
@@ -12,7 +12,8 @@ function getOsculatingCircle(maxOsculatingCircleRadius, pos, norm) {
12
12
  const { curve, p, t } = pos;
13
13
  const { ps } = curve;
14
14
  const minCurvature = 1 / maxOsculatingCircleRadius;
15
- const k_ = -(ddCurvature(ps, t)[1]);
15
+ const kDd = ddCurvature(ps, t);
16
+ const k_ = -(kDd[0] + kDd[1]);
16
17
  const k = k_ < minCurvature ? minCurvature : k_;
17
18
  const [tx, ty] = norm;
18
19
  const l = sqrt(tx * tx + ty * ty);
@@ -1 +1 @@
1
- {"version":3,"file":"get-osculating-circle.js","sourceRoot":"","sources":["../../src/point-on-shape/get-osculating-circle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;AAGtB;;;;;;;GAOG;AACH,SAAS,mBAAmB,CACpB,yBAAiC,EACjC,GAAoB,EACpB,IAAc;IAElB,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,GAAG,CAAC;IAC5B,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC;IAErB,MAAM,YAAY,GAAG,CAAC,GAAC,yBAAyB,CAAC;IAEjD,MAAM,EAAE,GAAG,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,CAAC,GAAG,EAAE,GAAG,YAAY,CAAC,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IACtB,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,GAAC,EAAE,GAAG,EAAE,GAAC,EAAE,CAAC,CAAC;IAC9B,MAAM,KAAK,GAAG,CAAC,GAAC,CAAC,CAAC;IAElB,OAAO;QACH,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAC,KAAK,CAAC;QAClC,CAAC,GAAC,CAAC;KACN,CAAC;AACN,CAAC;AAGD,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "flo-mat",
3
3
  "sideEffects": false,
4
4
  "description": "Medial / Scale Axis Transform (MAT/SAT) Library.",
5
- "version": "4.0.1",
5
+ "version": "4.0.2",
6
6
  "author": {
7
7
  "name": "Floris Steenkamp"
8
8
  },
@@ -31,20 +31,20 @@
31
31
  "skeleton"
32
32
  ],
33
33
  "dependencies": {
34
- "big-float-ts": "^4.0.3",
34
+ "big-float-ts": "^4.0.4",
35
35
  "double-double": "^3.0.4",
36
- "flo-bezier3": "^8.0.5",
36
+ "flo-bezier3": "^8.0.11",
37
37
  "flo-boolean": "^5.0.5",
38
38
  "flo-draw": "^2.0.5",
39
39
  "flo-gauss-quadrature": "^2.1.4",
40
- "flo-ll-rb-tree": "^0.3.4",
40
+ "flo-ll-rb-tree": "^1.0.1",
41
41
  "flo-memoize": "^2.0.1",
42
42
  "flo-poly": "^8.1.2",
43
43
  "flo-vector2d": "^4.0.6"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@jest/globals": "^30.4.1",
47
- "@swc/core": "^1.15.43",
47
+ "@swc/core": "^1.15.46",
48
48
  "@swc/jest": "^0.2.39",
49
49
  "@types/jest": "^30.0.0",
50
50
  "@types/node": "^26.1.1",
@@ -53,7 +53,6 @@
53
53
  "c8": "^12.0.0",
54
54
  "circular-dependency-plugin": "^5.2.2",
55
55
  "rimraf": "^6.1.3",
56
- "source-map-support": "^0.5.21",
57
56
  "ts-loader": "^9.6.2",
58
57
  "ts-node": "^10.9.2",
59
58
  "typescript": "^6.0.3",
@@ -3,10 +3,7 @@ import type { Curve } from "flo-boolean";
3
3
 
4
4
  interface FootAndEndpointInfo {
5
5
  readonly curve: Curve;
6
- readonly p: number[];
7
6
  readonly t: number;
8
- readonly d: number;
9
- readonly box: number[][];
10
7
  readonly dSquaredI: number[];
11
8
  }
12
9
 
@@ -17,7 +17,6 @@ import { toP } from '../point-on-shape/to-p.js';
17
17
  * @internal
18
18
  */
19
19
  function getCloseBoundaryPointsCertified(
20
- maxCoordPowerOf2: number,
21
20
  curvePieces: CurvePiece[],
22
21
  x: number[]): PrePointOnShape[] {
23
22
 
@@ -28,7 +27,6 @@ function getCloseBoundaryPointsCertified(
28
27
  const curvePiece = curvePieces[i];
29
28
 
30
29
  const _pInfos = getPotentialClosestPointsOnCurveCertified(
31
- maxCoordPowerOf2,
32
30
  curvePiece.curve,
33
31
  x,
34
32
  curvePiece.ts as [number,number]
@@ -1,62 +1,76 @@
1
1
  import type { Curve } from "flo-boolean";
2
2
  import type { FootAndEndpointInfo } from './foot-and-endpoint-info.js';
3
- import { createRootExact, roots } from 'flo-poly';
4
- import { getFootPointsOnBezierPolysCertified, getIntervalBox } from 'flo-bezier3';
3
+ import { roots } from 'flo-poly';
4
+ import { evalDeCasteljauDd, getFootPointsOnBezierPolysCertified, getIntervalBox } from 'flo-bezier3';
5
5
  import { rootIntervalToDistanceSquaredInterval } from './root-interval-to-distance-squared-interval.js';
6
- import { getPFromBox } from './get-p-from-box.js';
7
-
8
- const { sqrt } = Math;
6
+ import { squaredDistanceBetweenDd } from "../find-2-prong/squared-distance-between-dd.js";
7
+ import { eps } from '../error-analysis/gamma.js';
9
8
 
10
9
 
11
10
  /**
12
11
  * @internal
13
12
  *
14
- * @param maxCoordPowerOf2
15
13
  * @param curve the curve
16
14
  * @param x the point from which to check
17
15
  * @param tRange The allowed t range
18
16
  */
19
17
  function getPotentialClosestPointsOnCurveCertified(
20
- maxCoordPowerOf2: number,
21
18
  curve: Curve,
22
19
  x: number[],
23
20
  tRange: [number, number]): FootAndEndpointInfo[] {
24
21
 
25
22
  const [tS,tE] = tRange;
26
- const ps = curve.ps;
23
+ const { ps } = curve;
24
+
25
+ const infos: FootAndEndpointInfo[] = [];
26
+
27
+ if (tS !== tE) {
28
+ const { polyDd: pDd, polyE: pDd_, getPolyExact } =
29
+ getFootPointsOnBezierPolysCertified(ps, x);
30
+
31
+ const ris = roots(pDd, tS, tE, pDd_, getPolyExact) || [];
32
+
33
+ infos.push(...ris.map(ri => {
34
+ const { tS: ts, tE: te, t: _t } = ri;
35
+
36
+ const t = _t < 0 ? 0 : _t > 1 ? 1 : _t;
37
+
38
+ const box = getIntervalBox(ps, [ts, te]);
27
39
 
28
- let { polyDd: pDd, polyE: pDd_, getPolyExact } =
29
- getFootPointsOnBezierPolysCertified(ps, x);
40
+ const dSquaredI = rootIntervalToDistanceSquaredInterval(box, x);
30
41
 
31
- const ris = roots(pDd, tS, tE, pDd_, getPolyExact) || [];
42
+ const t_ = t === 0 ? 1 : t;
43
+ const curve_ = t === 0 ? curve.prev : curve;
32
44
 
33
- ris.push(createRootExact(tS));
34
- ris.push(createRootExact(tE));
45
+ return {
46
+ curve: curve_,
47
+ t: t_,
48
+ dSquaredI
49
+ }
50
+ }));
51
+ }
35
52
 
36
- const infos = ris
37
- .map(ri => {
38
- const { tS: ts, tE: te } = ri;
53
+ const ts = tRange.slice();
54
+ if (tS === tE) {
55
+ ts.push(tS);
56
+ }
57
+
58
+ infos.push(...ts.map(t => {
59
+ const p = evalDeCasteljauDd(ps, [0,t]).map(v => v[0] + v[1]);
39
60
 
40
- const _t = (ts + te)/2;
41
- const t = _t < 0 ? 0 : _t > 1 ? 1 : _t;
61
+ const d = squaredDistanceBetweenDd(p, x);
42
62
 
43
- const box = getIntervalBox(ps, [ts, te]);
44
- const p_ = getPFromBox(box);
45
-
46
- const dSquaredI = rootIntervalToDistanceSquaredInterval(maxCoordPowerOf2, box, x);
63
+ const dSquaredI = [d*(1 - eps), d*(1 + eps)];
47
64
 
48
65
  const t_ = t === 0 ? 1 : t;
49
66
  const curve_ = t === 0 ? curve.prev : curve;
50
67
 
51
68
  return {
52
69
  curve: curve_,
53
- p: p_,
54
70
  t: t_,
55
- d: (sqrt(dSquaredI[0]) + sqrt(dSquaredI[1]))/2,
56
- dSquaredI,
57
- box
71
+ dSquaredI
58
72
  }
59
- });
73
+ }));
60
74
 
61
75
  return infos;
62
76
  }
@@ -1,12 +1,6 @@
1
- import { twoDiff, eEstimate, eMult, eAdd } from 'big-float-ts';
2
- import { ddMultDd, ddAddDd } from 'double-double';
1
+ import { twoDiff, ddMultDd, ddAddDd } from 'double-double';
3
2
 
4
-
5
- // We *have* to do the below to improve performance with bundlers❗ The assignee is a getter❗ The assigned is a pure function❗
6
- const estimate = eEstimate;
7
3
  const td = twoDiff;
8
- // const emult = eMult;
9
- // const eadd = eAdd;
10
4
  const qmq = ddMultDd;
11
5
  const qaq = ddAddDd;
12
6
 
@@ -25,7 +19,6 @@ const eps = Number.EPSILON;
25
19
  * @internal
26
20
  */
27
21
  function rootIntervalToDistanceSquaredInterval(
28
- maxCoordPowerOf2: number,
29
22
  box: number[][],
30
23
  p: number[]) {
31
24
 
@@ -62,8 +55,10 @@ function rootIntervalToDistanceSquaredInterval(
62
55
  const dc1Dd = qaq(qmq(ax,ax),qmq(by,by)); // ax**2 + bx**2
63
56
  const dc1 = dc1Dd[1];
64
57
 
65
- const dc1Min = dc1*(1 - 2**maxCoordPowerOf2*eps); // distance minus max error
66
- const dc1Max = dc1*(1 + 2**maxCoordPowerOf2*eps); // distance plus max error
58
+ // const dc1Min = dc1*(1 - 2**maxCoordPowerOf2*eps); // distance minus max error
59
+ // const dc1Max = dc1*(1 + 2**maxCoordPowerOf2*eps); // distance plus max error
60
+ const dc1Min = dc1*(1 - eps); // distance minus max error
61
+ const dc1Max = dc1*(1 + eps); // distance plus max error
67
62
 
68
63
  if (dc1Min <= minDSquared) {
69
64
  minDSquared = dc1Min;
@@ -1,7 +1,7 @@
1
1
  import type { CpNode } from "../cp-node.js";
2
2
  import type { PointOnShape } from "../../point-on-shape/point-on-shape.js";
3
3
  import type { Mutable } from "../../utils/mutable.js";
4
- import { LlRbTree } from "flo-ll-rb-tree";
4
+ import { RbTree } from "flo-ll-rb-tree";
5
5
  import { isOrderCorrect } from "./is-order-correct.js";
6
6
 
7
7
 
@@ -9,7 +9,7 @@ function insertCpNode(
9
9
  insertIfOrderWrong: boolean,
10
10
  isHoleClosing: boolean,
11
11
  isIntersection: boolean,
12
- cpTree: LlRbTree<CpNode>,
12
+ cpTree: RbTree<CpNode>,
13
13
  pos: PointOnShape,
14
14
  _prev: CpNode | undefined,
15
15
  lastInsertId: { id: number }): CpNode | undefined {
@@ -1,11 +1,11 @@
1
1
  import type { CpNode } from "../cp-node.js";
2
- import { LlRbTree } from "flo-ll-rb-tree";
2
+ import { RbTree } from "flo-ll-rb-tree";
3
3
  import { PointOnShape } from "../../point-on-shape/point-on-shape.js";
4
4
  import { comparePoss } from "../../point-on-shape/compare-poss.js";
5
5
 
6
6
 
7
7
  function isOrderCorrect(
8
- cpTree: LlRbTree<CpNode>,
8
+ cpTree: RbTree<CpNode>,
9
9
  pos: PointOnShape,
10
10
  next: CpNode): boolean {
11
11
 
@@ -27,7 +27,7 @@ function traverseCp(
27
27
  const next = cpNode.next.prevOnCircle;
28
28
  cpNode = cpNode === next
29
29
  ? cpNode = cpNode.next.next // Terminal vertex
30
- : cpNode = next // Take last exit
30
+ : cpNode = next // Take last exit
31
31
 
32
32
  } while (cpNode !== cpStart);
33
33
 
@@ -1,5 +1,4 @@
1
- import { CpNode } from '../cp-node.js';
2
- import { CpNodeFs } from '../cp-node-fs.js';
1
+ import type { CpNode } from '../cp-node.js';
3
2
  import { getAllOnCircle } from './get-all-on-circle.js';
4
3
  import { isTerminating } from './is-terminating.js';
5
4
  import { getVertexForwardChildren } from './get-vertex-forward-children.js';
@@ -1,5 +1,4 @@
1
1
  import type { Loop } from "flo-boolean";
2
- import type { LlRbTree } from "flo-ll-rb-tree";
3
2
  import type { MatMeta } from "../../mat/mat-meta.js";
4
3
  import { CpNode } from "../../cp-node/cp-node.js";
5
4
  import { getAllOnLoop } from "../../cp-node/fs/get-all-on-loop.js";
@@ -1,6 +1,4 @@
1
- import { drawFs } from 'flo-draw';
2
- import { CpNode } from '../../../cp-node/cp-node.js';
3
- import { CpNodeFs } from '../../../cp-node/cp-node-fs.js';
1
+ import type { CpNode } from '../../../cp-node/cp-node.js';
4
2
  import { getMatCurveToNext } from '../../../cp-node/fs/get-mat-curve-to-next.js';
5
3
  import { isTerminating } from '../../../cp-node/fs/is-terminating.js';
6
4
  import { drawBeziersAsSinglePath } from '../draw/draw-beziers-as-single-path.js';
@@ -1,8 +1,7 @@
1
-
1
+ import type { CpNode } from '../../../cp-node/cp-node.js';
2
2
  import { drawFs } from 'flo-draw';
3
3
  import { scaleCircle } from '../../../geometry/circle.js';
4
- import { CpNode } from '../../../cp-node/cp-node.js';
5
- import { CpNodeFs } from '../../../cp-node/cp-node-fs.js';
4
+ import { getAllOnCircle } from '../../../cp-node/fs/get-all-on-circle.js';
6
5
 
7
6
 
8
7
  /** @internal */
@@ -19,7 +18,7 @@ function drawCpNode(
19
18
  );
20
19
  const { center: c, radius: r } = circle;
21
20
 
22
- const poss = CpNodeFs.getAllOnCircle(cpNode)
21
+ const poss = getAllOnCircle(cpNode)
23
22
  .map(cpNode => cpNode.pointOnShape)
24
23
 
25
24
  const { dot, circle: drawCircle, crossHair } = drawFs;
@@ -1,7 +1,7 @@
1
+ import type { CpNode } from '../../../cp-node/cp-node.js';
1
2
  import { drawFs } from 'flo-draw';
2
- import { CpNodeFs } from '../../../cp-node/cp-node-fs.js';
3
- import { CpNode } from '../../../cp-node/cp-node.js';
4
3
  import { drawCirclePercent } from './draw-circle-percent.js';
4
+ import { getAllOnCircle } from '../../../cp-node/fs/get-all-on-circle.js';
5
5
 
6
6
 
7
7
  /** @internal */
@@ -22,7 +22,7 @@ function drawLeaves(
22
22
 
23
23
  const $center = [drawCirclePercent(g, c, 0.5, 'pinker thin5 nofill')];
24
24
 
25
- const poss = CpNodeFs.getAllOnCircle(cpNode)
25
+ const poss = getAllOnCircle(cpNode)
26
26
  .map(cpNode => cpNode.pointOnShape);
27
27
 
28
28
  const $ls: SVGElement[] = [];
@@ -1,11 +1,8 @@
1
+ import type { Mat } from '../../../mat/mat.js';
1
2
  import { drawFs } from 'flo-draw';
2
- import { Mat } from '../../../mat/mat.js';
3
3
  import { traverseEdges } from '../../../cp-node/fs/traverse-edges.js';
4
4
  import { getMatCurveToNext } from '../../../cp-node/fs/get-mat-curve-to-next.js';
5
- import { CpNodeFs } from '../../../cp-node/cp-node-fs.js';
6
-
7
-
8
- const { isTerminating } = CpNodeFs;
5
+ import { isTerminating } from '../../../cp-node/fs/is-terminating.js';
9
6
 
10
7
 
11
8
  const altClasses = [
@@ -1,6 +1,6 @@
1
- import { toCubic, evalDeCasteljau } from 'flo-bezier3';
1
+ import type { PointOnShape } from '../../../point-on-shape/point-on-shape.js';
2
+ import { evalDeCasteljau } from 'flo-bezier3';
2
3
  import { drawFs } from 'flo-draw';
3
- import { PointOnShape } from '../../../point-on-shape/point-on-shape.js';
4
4
 
5
5
 
6
6
  /** @internal */
@@ -1,7 +1,7 @@
1
+ import type { CpNode } from '../../../cp-node/cp-node.js';
1
2
  import { drawFs } from 'flo-draw';
2
3
  import { scaleCircle } from '../../../geometry/circle.js';
3
- import { CpNode } from '../../../cp-node/cp-node.js';
4
- import { CpNodeFs } from '../../../cp-node/cp-node-fs.js';
4
+ import { getAllOnCircle } from '../../../cp-node/fs/get-all-on-circle.js';
5
5
 
6
6
 
7
7
  /** @internal */
@@ -20,7 +20,7 @@ function drawThreeProng(
20
20
  const { center: c, radius: r } = circle;
21
21
 
22
22
  // const poss = threeProng.poss;
23
- const poss = CpNodeFs.getAllOnCircle(threeProng)
23
+ const poss = getAllOnCircle(threeProng)
24
24
  .map(cpNode => cpNode.pointOnShape)
25
25
 
26
26
  const { dot, circle: drawCircle, crossHair } = drawFs;
@@ -1,8 +1,5 @@
1
+ import type { CpNode } from '../../../cp-node/cp-node.js';
1
2
  import { drawFs } from 'flo-draw';
2
- import { CpNode } from '../../../cp-node/cp-node.js';
3
- import { CpNodeFs } from '../../../cp-node/cp-node-fs.js';
4
-
5
- const { getAllOnCircle } = CpNodeFs;
6
3
 
7
4
 
8
5
  /** @internal */
@@ -1,4 +1,11 @@
1
- const u = Number.EPSILON / 2;
1
+
2
+ /** `2 * 2^-53` -> 2x the standard round-of unit `=== Number.EPSILON` */
3
+ const eps = Number.EPSILON;
4
+
5
+ /** `2^-53` -> the standard round-of unit `=== eps/2` */
6
+ const u = eps / 2;
7
+
8
+ /** `2^-106` -> the standard round-of unit for double-double precision `=== (eps/2)**2` */
2
9
  const uu = u*u;
3
10
 
4
11
 
@@ -38,4 +45,4 @@ function γγ(n: number): number {
38
45
  }
39
46
 
40
47
 
41
- export { γ, γγ }
48
+ export { γ, γγ, u, uu, eps }
@@ -83,11 +83,6 @@ function find2Prong(
83
83
  const xy2 = reduceRadius(maxCoordPowerOf2, curvePieces, y, nnorm);
84
84
  const xy = sqrt(xy2);
85
85
 
86
- if (for1Prong && rO < (1 - oneProngTolerance)*xy) {
87
- add1Prong(meta, rO, xO, yPos);
88
- return undefined;
89
- }
90
-
91
86
  const l = sqrt(nnorm[0]**2 + nnorm[1]**2);
92
87
  xO = [y[0] + nnorm[0]/l*xy, y[1] + nnorm[1]/l*xy];
93
88
 
@@ -110,6 +105,12 @@ function find2Prong(
110
105
  }
111
106
 
112
107
  const { x, d, curve, s } = antipodalPoints[0];
108
+
109
+ if (for1Prong && rO < (1 - oneProngTolerance)*d) {
110
+ add1Prong(meta, rO, xO, yPos);
111
+ return undefined;
112
+ }
113
+
113
114
  const z: PrePointOnShape = {
114
115
  curve, t: s, isSource: false,
115
116
  p: toP(curve.ps, s)
@@ -126,7 +127,7 @@ function find2Prong(
126
127
  // The lines below eliminate cases where the found 2-prong is too
127
128
  // close to a one-prong
128
129
  const squaredSeperationTolerance = max(
129
- calcSeperationTolerance(rO, sqrt(xz), 2**2*errorTolerance),
130
+ calcSeperationTolerance(rO, sqrt(xz), (2**2)*errorTolerance),
130
131
  minSquaredSeperationTolerance
131
132
  );
132
133
  if (yz <= squaredSeperationTolerance) {