flo-mat 3.0.13 → 3.0.15

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 (138) hide show
  1. package/__tests__/cp-node/check-clone-eql-calc.spec.ts +58 -0
  2. package/__tests__/cp-node/compare-cp-nodes-by-value.ts +35 -0
  3. package/__tests__/cp-node/compare-loops-by-value.ts +40 -0
  4. package/__tests__/cp-node/compare-poss-by-value.ts +25 -0
  5. package/__tests__/cp-node/fs/clone.spec.ts +19 -3
  6. package/__tests__/cp-node/fs/find-first.spec.ts +13 -3
  7. package/__tests__/cp-node/fs/get-all-between.spec.ts +20 -3
  8. package/__tests__/cp-node/fs/get-all-on-circle.spec.ts +2 -2
  9. package/__tests__/cp-node/fs/get-all-on-loop.spec.ts +16 -3
  10. package/__tests__/cp-node/fs/get-all-vertices.spec.ts +14 -3
  11. package/__tests__/cp-node/fs/get-children.spec.ts +18 -3
  12. package/__tests__/cp-node/fs/get-non-terminating-on-circle.spec.ts +14 -3
  13. package/__tests__/cp-node/fs/get-prong-count.spec.ts +16 -3
  14. package/__tests__/cp-node/fs/get-real-prong-count.spec.ts +11 -3
  15. package/__tests__/cp-node/fs/get-terminating-on-circle.spec.ts +20 -3
  16. package/__tests__/cp-node/fs/is-fully-terminating.spec.ts +16 -3
  17. package/__tests__/cp-node/fs/is-on-same-circle.spec.ts +20 -3
  18. package/__tests__/cp-node/fs/is-one-prong.spec.ts +16 -3
  19. package/__tests__/cp-node/fs/is-sharp.spec.ts +10 -3
  20. package/__tests__/cp-node/fs/is-single-3-prong.spec.ts +13 -3
  21. package/__tests__/cp-node/fs/is-special.spec.ts +12 -3
  22. package/__tests__/cp-node/fs/is-terminating.spec.ts +15 -3
  23. package/__tests__/cp-node/fs/is-trivial.spec.ts +13 -3
  24. package/__tests__/cp-node/fs/is-two-prong.spec.ts +11 -3
  25. package/__tests__/cp-node/fs/is-vertex-special.spec.ts +13 -3
  26. package/__tests__/cp-node/fs/is-vertex.spec.ts +14 -3
  27. package/__tests__/cp-node/fs/iterate-all-on-loop.spec.ts +13 -3
  28. package/__tests__/cp-node/fs/traverse-all-forward.spec.ts +10 -3
  29. package/__tests__/cp-node/fs/traverse-cp.spec.ts +9 -3
  30. package/__tests__/cp-node/fs/traverse-edges.spec.ts +13 -3
  31. package/__tests__/cp-node/fs/traverse-vertices.spec.ts +12 -3
  32. package/__tests__/cp-node/random-walk.ts +33 -0
  33. package/__tests__/cp-node/stringification/from-stringifyable.spec.ts +3 -0
  34. package/__tests__/cp-node/stringification/loop-from-stringifyable.spec.ts +4 -0
  35. package/__tests__/cp-node/stringification/loop-to-stringifyable.spec.ts +19 -0
  36. package/__tests__/cp-node/stringification/to-stringifyable.spec.ts +34 -0
  37. package/__tests__/get-mats1.ts +125 -0
  38. package/__tests__/jsog/check-jsog-eql-calc.spec.ts +47 -67
  39. package/__tests__/jsog/decode-jsog.ts +88 -85
  40. package/__tests__/jsog/mat-dummy-1.ts +19 -0
  41. package/__tests__/jsog/mat-dummys.ts +6197 -6195
  42. package/__tests__/jsog/to-jsog-breath-first.ts +110 -107
  43. package/__tests__/jsog/to-jsog-depth-first.ts +58 -55
  44. package/browser/index.js +7002 -6298
  45. package/browser/index.min.js +1 -1
  46. package/jest.config.cjs +1 -0
  47. package/node/closest-boundary-point/foot-and-endpoint-info.d.ts +1 -1
  48. package/node/closest-boundary-point/get-close-boundary-points-certified.d.ts +3 -3
  49. package/node/closest-boundary-point/get-close-boundary-points-certified.js +1 -1
  50. package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -1
  51. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.d.ts +2 -2
  52. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js +7 -7
  53. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js.map +1 -1
  54. package/node/cp-node/cp-node.d.ts +2 -2
  55. package/node/cp-node/fs/clone.d.ts +1 -1
  56. package/node/cp-node/fs/clone.js +17 -13
  57. package/node/cp-node/fs/clone.js.map +1 -1
  58. package/node/cp-node/fs/enhance-cp-node.d.ts +2 -2
  59. package/node/cp-node/fs/find-first.d.ts +9 -2
  60. package/node/cp-node/fs/find-first.js +12 -9
  61. package/node/cp-node/fs/find-first.js.map +1 -1
  62. package/node/cp-node/fs/get-all-on-loop.js +5 -6
  63. package/node/cp-node/fs/get-all-on-loop.js.map +1 -1
  64. package/node/cp-node/fs/get-edge-direction.d.ts +1 -1
  65. package/node/cp-node/fs/get-edge-direction.js.map +1 -1
  66. package/node/cp-node/fs/is-on-same-circle.d.ts +1 -0
  67. package/node/cp-node/fs/is-on-same-circle.js +1 -0
  68. package/node/cp-node/fs/is-on-same-circle.js.map +1 -1
  69. package/node/debug/functions/draw-elem/draw-dull-corner.d.ts +1 -1
  70. package/node/debug/functions/draw-elem/draw-dull-corner.js +1 -1
  71. package/node/debug/functions/draw-elem/draw-dull-corner.js.map +1 -1
  72. package/node/debug/functions/draw-elem/draw-sharp-corner.d.ts +1 -1
  73. package/node/debug/functions/draw-elem/draw-sharp-corner.js +2 -1
  74. package/node/debug/functions/draw-elem/draw-sharp-corner.js.map +1 -1
  75. package/node/find-mat/find-mats.js +7 -2
  76. package/node/find-mat/find-mats.js.map +1 -1
  77. package/node/find-mat/get-meta.d.ts +4 -4
  78. package/node/find-mat/get-meta.js +1 -1
  79. package/node/find-mat/get-meta.js.map +1 -1
  80. package/node/geometry/circle.d.ts +4 -3
  81. package/node/geometry/circle.js +0 -7
  82. package/node/geometry/circle.js.map +1 -1
  83. package/node/index.d.ts +2 -2
  84. package/node/index.js +1 -0
  85. package/node/index.js.map +1 -1
  86. package/node/mat/curve-piece.d.ts +3 -3
  87. package/node/mat/get-boundary-piece-beziers.d.ts +2 -2
  88. package/node/mat/mat-meta.d.ts +4 -4
  89. package/node/mat/simplify-mat.d.ts +10 -8
  90. package/node/mat/simplify-mat.js +12 -10
  91. package/node/mat/simplify-mat.js.map +1 -1
  92. package/node/point-on-shape/create-pos.d.ts +2 -2
  93. package/node/point-on-shape/create-pos.js.map +1 -1
  94. package/node/point-on-shape/point-on-shape.d.ts +6 -6
  95. package/node/svg/get-loop-bounds.d.ts +2 -2
  96. package/node/svg/get-loop-bounds.js +1 -1
  97. package/node/svg/get-loop-bounds.js.map +1 -1
  98. package/package.json +10 -10
  99. package/src/closest-boundary-point/foot-and-endpoint-info.ts +1 -1
  100. package/src/closest-boundary-point/get-close-boundary-points-certified.ts +5 -5
  101. package/src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts +9 -9
  102. package/src/cp-node/cp-node.ts +8 -3
  103. package/src/cp-node/fs/add-distance-from.ts +37 -37
  104. package/src/cp-node/fs/clone.ts +23 -17
  105. package/src/cp-node/fs/find-first.ts +14 -11
  106. package/src/cp-node/fs/get-all-on-loop.ts +5 -6
  107. package/src/cp-node/fs/get-boundary-bezier-parts-to-next.ts +1 -1
  108. package/src/cp-node/fs/get-edge-direction.ts +3 -5
  109. package/src/cp-node/fs/is-on-same-circle.ts +1 -0
  110. package/src/cp-node/stringification/cp-node-stringifyable.ts +68 -0
  111. package/src/cp-node/stringification/from-stringifyable.ts +57 -0
  112. package/src/cp-node/stringification/loop-from-stringifyable.ts +15 -0
  113. package/src/cp-node/stringification/loop-stringifyable.ts +8 -0
  114. package/src/cp-node/stringification/loop-to-stringifyable.ts +14 -0
  115. package/src/cp-node/stringification/to-stringifyable.ts +71 -0
  116. package/src/curve/curve.ts +31 -33
  117. package/src/debug/functions/draw-elem/draw-dull-corner.ts +2 -2
  118. package/src/debug/functions/draw-elem/draw-sharp-corner.ts +4 -3
  119. package/src/find-mat/find-mats.ts +8 -2
  120. package/src/find-mat/get-meta.ts +7 -6
  121. package/src/geometry/circle.ts +5 -12
  122. package/src/index.ts +3 -4
  123. package/src/mat/curve-piece.ts +3 -3
  124. package/src/mat/get-boundary-piece-beziers.ts +3 -3
  125. package/src/mat/mat-meta.ts +4 -4
  126. package/src/mat/simplify-mat-map-only.ts +110 -110
  127. package/src/mat/simplify-mat.ts +15 -13
  128. package/src/point-on-shape/create-pos.ts +3 -3
  129. package/src/point-on-shape/point-on-shape.ts +6 -6
  130. package/src/svg/get-loop-bounds.ts +4 -5
  131. package/__tests__/cp-node/fs/add-distance-from.spec.ts +0 -7
  132. package/__tests__/cp-node/fs/cp-nodes-to-boundary-beziers.spec.ts +0 -7
  133. package/__tests__/cp-node/fs/create-cp-node.spec.ts +0 -7
  134. package/__tests__/cp-node/fs/enhance-cp-node.spec.ts +0 -7
  135. package/__tests__/jsog/get-mats1.ts +0 -41
  136. package/node/curve/curve.d.ts +0 -33
  137. package/node/curve/curve.js +0 -2
  138. package/node/curve/curve.js.map +0 -1
@@ -1,14 +1,16 @@
1
- import { Mat } from './mat.js';
1
+ import type { Mat } from './mat.js';
2
2
  /**
3
- * Simplifies the given MAT by replacing the piecewise quad beziers composing
4
- * the MAT with fewer ones to within a given tolerance.
5
- * @param cpNode A representation of the MAT
6
- * @param anlgeTolerance Tolerance given as the degrees difference of the unit
3
+ * Returns a new simplified MAT of the given one by replacing the piecewise
4
+ * quad beziers composing the MAT with fewer ones to within a given tolerance.
5
+ *
6
+ * @param cpNode a representation of the MAT
7
+ * @param anlgeTolerance tolerance given as the degrees difference of the unit
7
8
  * direction vectors at the interface between curves. A tolerance of zero means
8
- * perfect smoothness is required - defaults to 15.
9
- * @param hausdorffTolerance The approximate maximum Hausdorff Distance tolerance -
9
+ * perfect smoothness is required - defaults to 15
10
+ * @param hausdorffTolerance the approximate maximum Hausdorff Distance tolerance -
10
11
  * defaults to `2**-3`
11
- * @param maxIterations The max iterations, defaults to `50`
12
+ * @param maxIterations the max iterations of the Hausdorff Distance calculation,
13
+ * defaults to `50`
12
14
  */
13
15
  declare function simplifyMat(mat: Mat, hausdorffTolerance?: number, maxIterations?: number): Mat;
14
16
  export { simplifyMat };
@@ -11,15 +11,17 @@ import { isVertex } from '../cp-node/fs/is-vertex.js';
11
11
  import { getProngCount } from '../cp-node/fs/get-prong-count.js';
12
12
  // TODO2 could be made faster by binary "search" on hausdorff curves
13
13
  /**
14
- * Simplifies the given MAT by replacing the piecewise quad beziers composing
15
- * the MAT with fewer ones to within a given tolerance.
16
- * @param cpNode A representation of the MAT
17
- * @param anlgeTolerance Tolerance given as the degrees difference of the unit
14
+ * Returns a new simplified MAT of the given one by replacing the piecewise
15
+ * quad beziers composing the MAT with fewer ones to within a given tolerance.
16
+ *
17
+ * @param cpNode a representation of the MAT
18
+ * @param anlgeTolerance tolerance given as the degrees difference of the unit
18
19
  * direction vectors at the interface between curves. A tolerance of zero means
19
- * perfect smoothness is required - defaults to 15.
20
- * @param hausdorffTolerance The approximate maximum Hausdorff Distance tolerance -
20
+ * perfect smoothness is required - defaults to 15
21
+ * @param hausdorffTolerance the approximate maximum Hausdorff Distance tolerance -
21
22
  * defaults to `2**-3`
22
- * @param maxIterations The max iterations, defaults to `50`
23
+ * @param maxIterations the max iterations of the Hausdorff Distance calculation,
24
+ * defaults to `50`
23
25
  */
24
26
  function simplifyMat(mat, hausdorffTolerance = 2 ** -3, maxIterations = 50) {
25
27
  let cpNode = clone(mat.cpNode);
@@ -49,12 +51,12 @@ function simplifyMat(mat, hausdorffTolerance = 2 ** -3, maxIterations = 50) {
49
51
  }
50
52
  }
51
53
  if (i + 1 === j) {
52
- // no simplification occured
53
- continue;
54
+ continue; // no simplification occured
54
55
  }
55
56
  }
56
57
  }
57
- cpNode = findFirst(cpNode_ => isTerminating(cpNode_) ? cpNode_ : undefined, cpNode);
58
+ // cpNode = findFirst(cpNode_ => isTerminating(cpNode_) ? cpNode_ : undefined, cpNode)!;
59
+ cpNode = findFirst(isTerminating, cpNode);
58
60
  for (const cpNode of canDeletes) {
59
61
  if (!isVertex(cpNode => (getProngCount(cpNode) !== 2) &&
60
62
  !cpNode.isHoleClosing)(cpNode)) {
@@ -1 +1 @@
1
- {"version":3,"file":"simplify-mat.js","sourceRoot":"","sources":["../../src/mat/simplify-mat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAy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;IAE3C,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CACf,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC7B,CAAC,MAAM,CAAC,aAAa,CACxB,CAAC,MAAM,CAAC,EAAE,CAAC;YAEZ,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;IACL,CAAC;IAGD,OAAO;QACH,MAAM;QACN,IAAI,EAAE;YACF,GAAG,GAAG,CAAC,IAAI;YACX,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC;SACnC;KACJ,CAAA;AACL,CAAC;AAGD,SAAS,yBAAyB,CAC1B,CAAS,EACT,CAAS,EACT,MAAgB,EAChB,gBAAwB;IAE5B,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAChE,OAAO,CAAC,GAAC,CAAC,GAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAChB,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAC9B,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAC5B,SAAS,EACT,gBAAgB,CACnB,CAAC,CAAC;IACP,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;AAC5B,CAAC;AAGD,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -1,4 +1,4 @@
1
- import { Curve } from "../curve/curve.js";
2
- import { PointOnShape } from "./point-on-shape.js";
1
+ import type { Curve } from "flo-boolean";
2
+ import type { PointOnShape } from "./point-on-shape.js";
3
3
  declare function createPos(curve: Curve, t: number, isSource?: boolean): PointOnShape;
4
4
  export { createPos };
@@ -1 +1 @@
1
- {"version":3,"file":"create-pos.js","sourceRoot":"","sources":["../../src/point-on-shape/create-pos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAK/C,SAAS,SAAS,CACV,KAAY,EACZ,CAAS,EACT,QAAkB;IAEtB,OAAO;QACH,KAAK;QACL,CAAC;QACD,CAAC,EAAE,iBAAiB,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,QAAQ,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ;KACtD,CAAA;AACL,CAAC;AAGD,OAAO,EAAE,SAAS,EAAE,CAAA"}
1
+ {"version":3,"file":"create-pos.js","sourceRoot":"","sources":["../../src/point-on-shape/create-pos.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,SAAS,SAAS,CACV,KAAY,EACZ,CAAS,EACT,QAAkB;IAEtB,OAAO;QACH,KAAK;QACL,CAAC;QACD,CAAC,EAAE,iBAAiB,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,QAAQ,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ;KACtD,CAAA;AACL,CAAC;AAGD,OAAO,EAAE,SAAS,EAAE,CAAA"}
@@ -1,11 +1,11 @@
1
- import { Curve } from '../curve/curve.js';
1
+ import type { Curve } from 'flo-boolean';
2
2
  interface PointOnShape {
3
3
  /** The `Curve` on the shape boundary this points belong to. */
4
- curve: Curve;
4
+ readonly curve: Curve;
5
5
  /** The bezier parameter value on the curve identifying the point coordinates. */
6
- t: number;
7
- p: number[];
6
+ readonly t: number;
7
+ readonly p: number[];
8
8
  /** just for debugging */
9
- isSource?: boolean;
9
+ readonly isSource?: boolean;
10
10
  }
11
- export { PointOnShape };
11
+ export type { PointOnShape };
@@ -1,5 +1,5 @@
1
- import { Loop } from 'flo-boolean';
2
- import { PointOnShape } from '../point-on-shape/point-on-shape.js';
1
+ import type { Loop } from 'flo-boolean';
2
+ import type { PointOnShape } from '../point-on-shape/point-on-shape.js';
3
3
  /**
4
4
  * @internal
5
5
  */
@@ -1,5 +1,5 @@
1
- import { getBounds } from 'flo-bezier3';
2
1
  import { memoize } from 'flo-memoize';
2
+ import { getBounds } from 'flo-bezier3';
3
3
  import { createPos } from '../point-on-shape/create-pos.js';
4
4
  /** @internal */
5
5
  const INF = Number.POSITIVE_INFINITY;
@@ -1 +1 @@
1
- {"version":3,"file":"get-loop-bounds.js","sourceRoot":"","sources":["../../src/svg/get-loop-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,gBAAgB;AAChB,MAAM,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAGrC;;GAEG;AACH,MAAM,aAAa,GAAG,OAAO,CAAC,UAAS,IAAU;IAM7C,MAAM,QAAQ,GAIN;QACJ;YACI,EAAE,MAAM,EAAE,SAAU,EAAE,CAAC,EAAE,SAAU,EAAE,GAAG,EAAE,GAAG,EAAC;YAC9C,EAAE,MAAM,EAAE,SAAU,EAAE,CAAC,EAAE,SAAU,EAAE,GAAG,EAAE,GAAG,EAAC;SACjD;QACD;YACI,EAAE,MAAM,EAAE,SAAU,EAAE,CAAC,EAAE,SAAU,EAAE,GAAG,EAAE,CAAC,GAAG,EAAC;YAC/C,EAAE,MAAM,EAAE,SAAU,EAAE,CAAC,EAAE,SAAU,EAAE,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E,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;QAC/D,IAAI,EAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;KAClE,CAAC;AACN,CAAC,CAAC,CAAC;AAGH,OAAO,EAAE,aAAa,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": "3.0.13",
5
+ "version": "3.0.15",
6
6
  "author": {
7
7
  "name": "Floris Steenkamp"
8
8
  },
@@ -31,23 +31,23 @@
31
31
  "skeleton"
32
32
  ],
33
33
  "dependencies": {
34
- "big-float-ts": "^4.0.2",
34
+ "big-float-ts": "^4.0.3",
35
35
  "double-double": "^3.0.4",
36
- "flo-bezier3": "^6.0.10",
37
- "flo-boolean": "^5.0.3",
36
+ "flo-bezier3": "^7.0.3",
37
+ "flo-boolean": "^5.0.5",
38
38
  "flo-draw": "^2.0.5",
39
39
  "flo-gauss-quadrature": "^2.1.4",
40
40
  "flo-ll-rb-tree": "^0.3.4",
41
41
  "flo-memoize": "^2.0.1",
42
- "flo-poly": "^7.0.2",
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.40",
47
+ "@swc/core": "^1.15.43",
48
48
  "@swc/jest": "^0.2.39",
49
49
  "@types/jest": "^30.0.0",
50
- "@types/node": "^25.9.1",
50
+ "@types/node": "^26.1.1",
51
51
  "jest": "^30.4.2",
52
52
  "jest-ts-webcompat-resolver": "^1.0.1",
53
53
  "c8": "^11.0.0",
@@ -56,11 +56,11 @@
56
56
  "mocha": "^11.7.6",
57
57
  "rimraf": "^6.1.3",
58
58
  "source-map-support": "^0.5.21",
59
- "ts-loader": "^9.5.7",
59
+ "ts-loader": "^9.6.2",
60
60
  "ts-node": "^10.9.2",
61
61
  "typescript": "^6.0.3",
62
- "webpack": "^5.107.2",
63
- "webpack-cli": "^7.0.2"
62
+ "webpack": "^5.108.4",
63
+ "webpack-cli": "^7.2.1"
64
64
  },
65
65
  "scripts": {
66
66
  "build": "npm run build-browser && npm run build-node",
@@ -1,5 +1,5 @@
1
1
  // import { RootInterval } from "flo-poly";
2
- import { Curve } from "../curve/curve.js";
2
+ import { Curve } from "flo-boolean";
3
3
 
4
4
 
5
5
  type FootAndEndpointInfo = {
@@ -1,10 +1,10 @@
1
- import { CurvePiece } from '../mat/curve-piece.js';
1
+ import type { Curve } from 'flo-boolean';
2
+ import type { CurvePiece } from '../mat/curve-piece.js';
3
+ import type { FootAndEndpointInfo } from './foot-and-endpoint-info.js';
4
+ import type { PointOnShape } from '../point-on-shape/point-on-shape.js';
5
+ import { createPos } from '../point-on-shape/create-pos.js';
2
6
  import { getPotentialClosestPointsOnCurveCertified } from './get-potential-closest-points-on-curve-certified.js';
3
7
  import { cullCurvePieces1 } from './cull-bezier-pieces.js';
4
- import { Curve } from '../curve/curve.js';
5
- import { FootAndEndpointInfo } from './foot-and-endpoint-info.js';
6
- import { PointOnShape } from '../point-on-shape/point-on-shape.js';
7
- import { createPos } from '../point-on-shape/create-pos.js';
8
8
 
9
9
 
10
10
  /**
@@ -1,12 +1,12 @@
1
+ import type { Curve } from "flo-boolean";
2
+ import type { FootAndEndpointInfo } from './foot-and-endpoint-info.js';
1
3
  import { allRootsCertified } from 'flo-poly';
4
+ import { eDeflate } from 'flo-poly';
2
5
  import { getFootPointsOnBezierPolysCertified, getIntervalBox } from 'flo-bezier3';
3
- import { Curve } from "../curve/curve.js";
4
6
  import { ddDeflateWithRunningError } from './dd-deflate-with-running-error.js';
5
- import { eDeflate } from 'flo-poly';
6
7
  import { γγ } from '../error-analysis/gamma.js';
7
8
  import { rootIntervalToDistanceSquaredInterval } from './root-interval-to-distance-squared-interval.js';
8
9
  import { getPFromBox } from './get-p-from-box.js';
9
- import { FootAndEndpointInfo } from './foot-and-endpoint-info.js';
10
10
 
11
11
 
12
12
  const γγ3 = γγ(3);
@@ -87,19 +87,19 @@ function getPotentialClosestPointsOnCurveCertified(
87
87
  );
88
88
 
89
89
  if (tS === 0) {
90
- if (!dontPush0) { ris.push({ tS: 0, tE: 0, multiplicity: 1 }); }
90
+ if (!dontPush0) { ris.push({ t: 0, tS: 0, tE: 0, multiplicity: 1 }); }
91
91
  } else if (tS === 1) {
92
- if (!dontPush1) { ris.push({ tS: 1, tE: 1, multiplicity: 1 }); }
92
+ if (!dontPush1) { ris.push({ t: 1, tS: 1, tE: 1, multiplicity: 1 }); }
93
93
  } else {
94
- ris.push({ tS: tS, tE: tS, multiplicity: 1 });
94
+ ris.push({ t: tS, tS: tS, tE: tS, multiplicity: 1 });
95
95
  }
96
96
 
97
97
  if (tE === 0) {
98
- if (!dontPush0) { ris.push({ tS: 0, tE: 0, multiplicity: 1 }); }
98
+ if (!dontPush0) { ris.push({ t: 0, tS: 0, tE: 0, multiplicity: 1 }); }
99
99
  } else if (tE === 1) {
100
- if (!dontPush1) { ris.push({ tS: 1, tE: 1, multiplicity: 1 }); }
100
+ if (!dontPush1) { ris.push({ t: 1, tS: 1, tE: 1, multiplicity: 1 }); }
101
101
  } else {
102
- ris.push({ tS: tE, tE: tE, multiplicity: 1 });
102
+ ris.push({ t: tE, tS: tE, tE: tE, multiplicity: 1 });
103
103
  }
104
104
 
105
105
  const infos = ris
@@ -50,12 +50,20 @@ import { ContactPoint } from '../contact-point/contact-point.js';
50
50
  * in opposite directions.
51
51
  */
52
52
  interface CpNode {
53
+ /** For debugging / easy identification only */
54
+ id: number;
55
+
53
56
  /** The shape boundary contact point, i.e. a `CpNode` without its edges. */
54
57
  cp: ContactPoint;
55
58
  /** If true, this `CpNode` belongs to a hole-closing maximal disk. */
56
59
  isHoleClosing: boolean;
57
60
  /** true if this `CpNode` is at a shape boundary intersection point, false otherwise */
58
61
  isIntersection: boolean;
62
+
63
+ //------------------------
64
+ // EDGES TO OTHER CpNodes
65
+ //------------------------
66
+
59
67
  /** The previous (going clockwise around the boundary) contact point `CpNode`. */
60
68
  prev: CpNode;
61
69
  /** The next (going anti-clockwise around the boundary) contact point `CpNode`. */
@@ -76,9 +84,6 @@ interface CpNode {
76
84
  * next `CpNode` on the same loop.
77
85
  */
78
86
  holeCloserTwin?: CpNode | undefined;
79
-
80
- /** For debugging / easy identification only */
81
- id: number;
82
87
  }
83
88
 
84
89
 
@@ -1,50 +1,50 @@
1
- import { getTAtLength, length } from "flo-bezier3";
2
- import { createPos } from "../../point-on-shape/create-pos.js";
3
- import { CpNode } from "../cp-node.js";
1
+ //------------------------------
2
+ // KEEP FOR POSSIBLE FUTURE USE
3
+ //------------------------------
4
4
 
5
+ // import { getTAtLength, length } from "flo-bezier3";
6
+ // import { createPos } from "../../point-on-shape/create-pos.js";
7
+ // import { CpNode } from "../cp-node.js";
5
8
 
6
- function addDistanceFrom(
7
- d: number,
8
- cpNode: CpNode) {
9
9
 
10
- const posS = cpNode.cp.pointOnShape;
11
- const curveS = posS.curve;
10
+ // function addDistanceFrom(
11
+ // d: number,
12
+ // cpNode: CpNode) {
12
13
 
13
- let tS = posS.t;
14
- let cumL = 0;
15
- let dist = 0;
16
- let curve = curveS;
17
- let ps;
18
- let dLeft = d;
19
- while (true) {
20
- ps = curve.ps;
21
- dist = length([tS,1], ps);
22
- cumL += dist;
14
+ // const posS = cpNode.cp.pointOnShape;
15
+ // const curveS = posS.curve;
23
16
 
24
- if (cumL < d) {
25
- tS = 0;
26
- dLeft -= dist;
27
- curve = curve.next;
28
- } else {
29
- break;
30
- }
31
- }
17
+ // let tS = posS.t;
18
+ // let cumL = 0;
19
+ // let dist = 0;
20
+ // let curve = curveS;
21
+ // let ps;
22
+ // let dLeft = d;
23
+ // while (true) {
24
+ // ps = curve.ps;
25
+ // dist = length([tS,1], ps);
26
+ // cumL += dist;
32
27
 
33
- // const overshoot = cumL - d;
34
- const lL = length([0,tS], curve.ps);
35
- const l = lL + dLeft;
28
+ // if (cumL < d) {
29
+ // tS = 0;
30
+ // dLeft -= dist;
31
+ // curve = curve.next;
32
+ // } else {
33
+ // break;
34
+ // }
35
+ // }
36
36
 
37
- const t = getTAtLength(curve.ps, l);
37
+ // // const overshoot = cumL - d;
38
+ // const lL = length([0,tS], curve.ps);
39
+ // const l = lL + dLeft;
38
40
 
39
- const posE = createPos(curve, t);
41
+ // const t = getTAtLength(curve.ps, l);
40
42
 
41
- return posE;
42
- }
43
+ // const posE = createPos(curve, t);
43
44
 
45
+ // return posE;
46
+ // }
44
47
 
45
48
 
46
- export { addDistanceFrom }
47
-
48
-
49
- // TESTING
50
49
 
50
+ // export { addDistanceFrom }
@@ -1,4 +1,4 @@
1
- import { CpNode } from "../cp-node.js";
1
+ import type { CpNode } from "../cp-node.js";
2
2
 
3
3
 
4
4
  /** @internal */
@@ -6,14 +6,15 @@ type Edge =
6
6
  | 'prev'
7
7
  | 'next'
8
8
  | 'prevOnCircle'
9
- | 'nextOnCircle';
9
+ | 'nextOnCircle'
10
+ | 'holeCloserTwin';
10
11
 
11
12
  /** @internal */
12
- const EDGES: Edge[] = ['prev', 'next', 'prevOnCircle', 'nextOnCircle'];
13
+ const EDGES: Edge[] = ['prev', 'next', 'prevOnCircle', 'nextOnCircle', 'holeCloserTwin'];
13
14
 
14
15
 
15
16
  type CpNodeWithoutEdges =
16
- Omit<CpNode, 'prev' | 'next' | 'prevOnCircle' | 'nextOnCircle'>;
17
+ Omit<CpNode, 'prev' | 'next' | 'prevOnCircle' | 'nextOnCircle' | 'holeCloserTwin'>;
17
18
 
18
19
 
19
20
  /**
@@ -21,13 +22,15 @@ type CpNodeWithoutEdges =
21
22
  * since cloning a single `CpNode` necessarily implies cloning all
22
23
  * `CpNode`s on the same MAT tree.
23
24
  */
24
- function clone(cpNode: CpNode): CpNode {
25
+ function clone(
26
+ cpNode: CpNode): CpNode {
27
+
25
28
  // Don't change this function to be recursive, the call stack may
26
- // overflow if there are too many CpNodes.
29
+ // overflow if there are too many `CpNode`s.
27
30
 
28
31
  const nodeMap: Map<CpNode, CpNodeWithoutEdges> = new Map();
29
32
 
30
- const newCpNode: CpNodeWithoutEdges = cloneWithoutLinks(cpNode);
33
+ const newCpNode: CpNodeWithoutEdges = cloneWithoutEdges(cpNode);
31
34
 
32
35
  nodeMap.set(cpNode, newCpNode);
33
36
  const cpStack = [{ cpNode, newCpNode }];
@@ -37,14 +40,16 @@ function clone(cpNode: CpNode): CpNode {
37
40
 
38
41
  for (const edge of EDGES) {
39
42
  const node = cpNode[edge];
40
- let newNode = nodeMap.get(node);
41
- if (!newNode) {
42
- newNode = cloneWithoutLinks(node);
43
+ if (node === undefined) { continue; }
44
+
45
+ let node_ = nodeMap.get(node);
46
+ if (!node_) {
47
+ node_ = cloneWithoutEdges(node);
43
48
 
44
- nodeMap.set(node, newNode);
45
- cpStack.push({cpNode: node, newCpNode: newNode });
49
+ nodeMap.set(node, node_);
50
+ cpStack.push({ cpNode: node, newCpNode: node_ });
46
51
  }
47
- (newCpNode as CpNode)[edge] = newNode as CpNode;
52
+ (newCpNode as CpNode)[edge] = node_ as CpNode;
48
53
  }
49
54
  }
50
55
 
@@ -52,18 +57,19 @@ function clone(cpNode: CpNode): CpNode {
52
57
  }
53
58
 
54
59
 
55
- function cloneWithoutLinks(cpNode: CpNode) {
56
- const newNode = {
60
+ function cloneWithoutEdges(cpNode: CpNode) {
61
+ const cpNode_ = {
57
62
  ...cpNode,
58
63
  ...{
59
64
  prev: undefined,
60
65
  next: undefined,
61
66
  prevOnCircle: undefined,
62
- nextOnCircle: undefined
67
+ nextOnCircle: undefined,
68
+ holeCloserTwin: undefined
63
69
  }
64
70
  };
65
71
 
66
- return newNode;
72
+ return cpNode_;
67
73
  }
68
74
 
69
75
 
@@ -1,22 +1,25 @@
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
 
4
3
 
4
+ /**
5
+ * Finds the first `CpNode` in the same MAT tree for which `f` returns a
6
+ * truthy value. Returns `undefined` if no such `CpNode` exists.
7
+ *
8
+ * @param f a function that takes a `CpNode` and returns a `CpNode` or `undefined`
9
+ * @param cpNode a `CpNode` on the MAT tree to search from
10
+ */
5
11
  function findFirst(
6
- f: (cpNode: CpNode) => CpNode | undefined,
12
+ f: (cpNode: CpNode) => boolean,
7
13
  cpNode: CpNode): CpNode | undefined {
8
14
 
9
15
  const cpStart = cpNode;
10
16
 
11
- if (f(cpStart)) { return cpStart; }
12
-
13
- let cpNode_ = cpNode.next;
14
- while (cpNode_ !== cpStart) {
15
- if (f(cpNode_)) {
16
- return cpNode_;
17
+ do {
18
+ if (f(cpNode)) {
19
+ return cpNode;
17
20
  }
18
- cpNode_ = cpNode_.next;
19
- }
21
+ cpNode = cpNode.next;
22
+ } while (cpNode !== cpStart);
20
23
 
21
24
  return undefined;
22
25
  }
@@ -9,13 +9,12 @@ function getAllOnLoop(
9
9
  cpNode: CpNode) {
10
10
 
11
11
  const cpStart = cpNode;
12
- const cpNodes: CpNode[] = [cpStart];
13
- let cpNode_ = cpNode.next;
12
+ const cpNodes: CpNode[] = [];
14
13
 
15
- while (cpNode_ !== cpStart) {
16
- cpNodes.push(cpNode_);
17
- cpNode_ = cpNode_.next;
18
- }
14
+ do {
15
+ cpNodes.push(cpNode);
16
+ cpNode = cpNode.next;
17
+ } while (cpNode !== cpStart);
19
18
 
20
19
  return cpNodes;
21
20
  }
@@ -1,6 +1,6 @@
1
1
  import type { BezierPiece } from 'flo-bezier3';
2
+ import type { Curve } from 'flo-boolean';
2
3
  import type { CpNode } from '../cp-node.js';
3
- import type { Curve } from '../../curve/curve.js';
4
4
 
5
5
 
6
6
  /**
@@ -1,10 +1,8 @@
1
- import {
2
- toUnitVector, fromTo, rotate, translate, rotate90Degrees, reverse, dot
3
- } from 'flo-vector2d';
1
+ import type { Curve } from 'flo-boolean';
2
+ import type { CpNode } from '../cp-node.js';
3
+ import { toUnitVector, fromTo, rotate, translate, rotate90Degrees, reverse, dot } from 'flo-vector2d';
4
4
  import { tangent } from 'flo-bezier3';
5
- import { CpNode } from '../cp-node.js';
6
5
  import { isPosSharpCorner } from '../../point-on-shape/is-pos-sharp-corner.js';
7
- import { Curve } from '../../curve/curve.js';
8
6
 
9
7
 
10
8
  /**
@@ -5,6 +5,7 @@ import { getAllOnCircle } from "./get-all-on-circle.js";
5
5
  /**
6
6
  * Returns true if the 2 given `CpNode`s are on the same maximal disk
7
7
  * circle.
8
+ *
8
9
  * @param cpNode1 A `CpNode`.
9
10
  * @param cpNode2 Another `CpNode`
10
11
  */
@@ -0,0 +1,68 @@
1
+ // import type { Loop } from "flo-boolean";
2
+ import type { Circle } from "../../geometry/circle";
3
+ import type { CpNode } from "../cp-node";
4
+ import type { LoopStringifyable } from "./loop-stringifyable";
5
+
6
+
7
+ /** @internal */
8
+ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
9
+ /** @internal */
10
+ type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
11
+
12
+
13
+ /** @internal */
14
+ type Edge =
15
+ | 'prev' | 'next'
16
+ | 'prevOnCircle' | 'nextOnCircle'
17
+ | 'holeCloserTwin';
18
+
19
+
20
+ /** @internal */
21
+ type PointOnShapeSimplified = {
22
+ readonly loopIdx: number;
23
+ readonly curveIdx: number;
24
+ readonly p: number[];
25
+ readonly t: number;
26
+ readonly isSource?: boolean;
27
+ }
28
+ /** @internal */
29
+ type ContactPointSimplified = {
30
+ readonly circle: Circle;
31
+ readonly pointOnShape: PointOnShapeSimplified;
32
+ readonly order: number;
33
+ readonly order2: number;
34
+ }
35
+ /** @internal */
36
+ type CpNodeSimplified = Omit<CpNode, 'cp'> & {
37
+ readonly cp: ContactPointSimplified;
38
+ }
39
+
40
+ /** @internal */
41
+ type CpNodeSimplifiedEdgeless = Omit<CpNodeSimplified, Edge>;
42
+
43
+ /** @internal */
44
+ type CpNodeWithAnyEdges = PartialBy<
45
+ CpNodeSimplifiedEdgeless & Record<Edge, CpNode | number>,
46
+ 'holeCloserTwin'
47
+ >
48
+
49
+
50
+ interface CpNodeStringifyable {
51
+ cpNodes: CpNodeWithAnyEdges[];
52
+ loops: LoopStringifyable[];
53
+ }
54
+
55
+
56
+ const EDGES: Edge[] = [
57
+ 'prev', 'next',
58
+ 'prevOnCircle', 'nextOnCircle',
59
+ 'holeCloserTwin'
60
+ ];
61
+
62
+
63
+ export { EDGES }
64
+ export type {
65
+ PointOnShapeSimplified, ContactPointSimplified,
66
+ CpNodeSimplified, CpNodeSimplifiedEdgeless,
67
+ CpNodeStringifyable, CpNodeWithAnyEdges,
68
+ }