flo-mat 3.0.12 → 3.0.13

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 (122) hide show
  1. package/browser/index.js +174 -40
  2. package/browser/index.min.js +1 -1
  3. package/node/cp-node/cp-node-fs.d.ts +4 -4
  4. package/node/cp-node/cp-node-fs.js +4 -4
  5. package/node/cp-node/cp-node.d.ts +8 -10
  6. package/node/cp-node/fs/cp-node-comparator.d.ts +6 -0
  7. package/node/cp-node/fs/cp-node-comparator.js +6 -0
  8. package/node/cp-node/fs/cp-node-comparator.js.map +1 -1
  9. package/node/cp-node/fs/enhance-cp-node.d.ts +5 -2
  10. package/node/cp-node/fs/enhance-cp-node.js +4 -0
  11. package/node/cp-node/fs/enhance-cp-node.js.map +1 -1
  12. package/node/cp-node/fs/get-all-on-circle.d.ts +4 -4
  13. package/node/cp-node/fs/get-all-on-circle.js +4 -4
  14. package/node/cp-node/fs/get-all-on-loop.d.ts +4 -0
  15. package/node/cp-node/fs/get-all-on-loop.js +4 -0
  16. package/node/cp-node/fs/get-all-on-loop.js.map +1 -1
  17. package/node/cp-node/fs/get-boundary-bezier-parts-to-next.d.ts +5 -4
  18. package/node/cp-node/fs/get-boundary-bezier-parts-to-next.js +5 -4
  19. package/node/cp-node/fs/get-boundary-bezier-parts-to-next.js.map +1 -1
  20. package/node/cp-node/fs/get-boundary-beziers-to-next.d.ts +4 -8
  21. package/node/cp-node/fs/get-boundary-beziers-to-next.js +4 -8
  22. package/node/cp-node/fs/get-boundary-beziers-to-next.js.map +1 -1
  23. package/node/cp-node/fs/get-children.d.ts +6 -0
  24. package/node/cp-node/fs/get-children.js +6 -0
  25. package/node/cp-node/fs/get-children.js.map +1 -1
  26. package/node/cp-node/fs/get-edge-direction.d.ts +6 -0
  27. package/node/cp-node/fs/get-edge-direction.js +6 -0
  28. package/node/cp-node/fs/get-edge-direction.js.map +1 -1
  29. package/node/cp-node/fs/get-first-exit.d.ts +4 -0
  30. package/node/cp-node/fs/get-first-exit.js +4 -0
  31. package/node/cp-node/fs/get-first-exit.js.map +1 -1
  32. package/node/cp-node/fs/get-mat-curve-between.d.ts +6 -0
  33. package/node/cp-node/fs/get-mat-curve-between.js +6 -0
  34. package/node/cp-node/fs/get-mat-curve-between.js.map +1 -1
  35. package/node/cp-node/fs/get-mat-curve-to-next.d.ts +6 -0
  36. package/node/cp-node/fs/get-mat-curve-to-next.js +6 -0
  37. package/node/cp-node/fs/get-mat-curve-to-next.js.map +1 -1
  38. package/node/cp-node/fs/get-prong-count.d.ts +8 -0
  39. package/node/cp-node/fs/get-prong-count.js +8 -0
  40. package/node/cp-node/fs/get-prong-count.js.map +1 -1
  41. package/node/cp-node/fs/get-real-prong-count.d.ts +6 -0
  42. package/node/cp-node/fs/get-real-prong-count.js +6 -0
  43. package/node/cp-node/fs/get-real-prong-count.js.map +1 -1
  44. package/node/cp-node/fs/get-vertex-forward-children.d.ts +8 -0
  45. package/node/cp-node/fs/get-vertex-forward-children.js +8 -0
  46. package/node/cp-node/fs/get-vertex-forward-children.js.map +1 -1
  47. package/node/cp-node/fs/is-fully-terminating.d.ts +2 -5
  48. package/node/cp-node/fs/is-fully-terminating.js +2 -5
  49. package/node/cp-node/fs/is-fully-terminating.js.map +1 -1
  50. package/node/cp-node/fs/is-on-same-circle.d.ts +6 -0
  51. package/node/cp-node/fs/is-on-same-circle.js +6 -0
  52. package/node/cp-node/fs/is-on-same-circle.js.map +1 -1
  53. package/node/cp-node/fs/is-one-prong.d.ts +8 -0
  54. package/node/cp-node/fs/is-one-prong.js +8 -0
  55. package/node/cp-node/fs/is-one-prong.js.map +1 -1
  56. package/node/cp-node/fs/is-order-correct.d.ts +1 -1
  57. package/node/cp-node/fs/is-order-correct.js +1 -4
  58. package/node/cp-node/fs/is-order-correct.js.map +1 -1
  59. package/node/cp-node/fs/is-sharp.d.ts +7 -0
  60. package/node/cp-node/fs/is-sharp.js +7 -0
  61. package/node/cp-node/fs/is-sharp.js.map +1 -1
  62. package/node/cp-node/fs/is-special.d.ts +1 -1
  63. package/node/cp-node/fs/is-special.js +1 -3
  64. package/node/cp-node/fs/is-special.js.map +1 -1
  65. package/node/cp-node/fs/is-terminating.d.ts +22 -0
  66. package/node/cp-node/fs/is-terminating.js +22 -0
  67. package/node/cp-node/fs/is-terminating.js.map +1 -1
  68. package/node/cp-node/fs/traverse-cp.d.ts +9 -0
  69. package/node/cp-node/fs/traverse-cp.js +9 -0
  70. package/node/cp-node/fs/traverse-cp.js.map +1 -1
  71. package/node/cp-node/fs/traverse-edges.d.ts +7 -0
  72. package/node/cp-node/fs/traverse-edges.js +7 -0
  73. package/node/cp-node/fs/traverse-edges.js.map +1 -1
  74. package/node/cp-node/fs/traverse-vertices.d.ts +9 -0
  75. package/node/cp-node/fs/traverse-vertices.js +9 -0
  76. package/node/cp-node/fs/traverse-vertices.js.map +1 -1
  77. package/node/find-2-prong/add-2-prong.js +5 -3
  78. package/node/find-2-prong/add-2-prong.js.map +1 -1
  79. package/node/floyd-warshall/get-graph.d.ts +1 -1
  80. package/node/floyd-warshall/get-graph.js +2 -2
  81. package/node/floyd-warshall/get-graph.js.map +1 -1
  82. package/node/floyd-warshall/get-hole-closer-pairs.d.ts +6 -1
  83. package/node/floyd-warshall/get-hole-closer-pairs.js +8 -0
  84. package/node/floyd-warshall/get-hole-closer-pairs.js.map +1 -1
  85. package/node/mat/add-to-cp-tree.js +1 -3
  86. package/node/mat/add-to-cp-tree.js.map +1 -1
  87. package/node/vertex/remove-vertex.d.ts +5 -0
  88. package/node/vertex/remove-vertex.js +5 -0
  89. package/node/vertex/remove-vertex.js.map +1 -1
  90. package/package.json +1 -1
  91. package/src/cp-node/cp-node-fs.ts +4 -4
  92. package/src/cp-node/cp-node.ts +8 -10
  93. package/src/cp-node/fs/cp-node-comparator.ts +6 -0
  94. package/src/cp-node/fs/enhance-cp-node.ts +4 -0
  95. package/src/cp-node/fs/get-all-on-circle.ts +4 -4
  96. package/src/cp-node/fs/get-all-on-loop.ts +4 -0
  97. package/src/cp-node/fs/get-boundary-bezier-parts-to-next.ts +6 -5
  98. package/src/cp-node/fs/get-boundary-beziers-to-next.ts +4 -8
  99. package/src/cp-node/fs/get-children.ts +6 -0
  100. package/src/cp-node/fs/get-edge-direction.ts +6 -0
  101. package/src/cp-node/fs/get-first-exit.ts +4 -0
  102. package/src/cp-node/fs/get-mat-curve-between.ts +6 -0
  103. package/src/cp-node/fs/get-mat-curve-to-next.ts +6 -0
  104. package/src/cp-node/fs/get-prong-count.ts +8 -0
  105. package/src/cp-node/fs/get-real-prong-count.ts +6 -0
  106. package/src/cp-node/fs/get-vertex-forward-children.ts +8 -0
  107. package/src/cp-node/fs/is-fully-terminating.ts +2 -5
  108. package/src/cp-node/fs/is-on-same-circle.ts +6 -0
  109. package/src/cp-node/fs/is-one-prong.ts +8 -0
  110. package/src/cp-node/fs/is-order-correct.ts +1 -4
  111. package/src/cp-node/fs/is-sharp.ts +7 -0
  112. package/src/cp-node/fs/is-special.ts +2 -3
  113. package/src/cp-node/fs/is-terminating.ts +22 -0
  114. package/src/cp-node/fs/traverse-cp.ts +9 -0
  115. package/src/cp-node/fs/traverse-edges.ts +7 -0
  116. package/src/cp-node/fs/traverse-vertices.ts +9 -0
  117. package/src/find-2-prong/add-2-prong.ts +4 -1
  118. package/src/floyd-warshall/get-graph.ts +3 -3
  119. package/src/floyd-warshall/get-hole-closer-pairs.ts +9 -1
  120. package/src/mat/add-to-cp-tree.ts +1 -2
  121. package/src/vertex/remove-vertex.ts +5 -0
  122. package/src/cp-node/fs/create-cp-node.ts +0 -21
@@ -1 +1 @@
1
- {"version":3,"file":"is-on-same-circle.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-on-same-circle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,SAAS,cAAc,CACf,OAAe,EACf,OAAe;IAEnB,iDAAiD;IACjD,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAExC,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAGD,OAAO,EAAE,cAAc,EAAE,CAAA"}
1
+ {"version":3,"file":"is-on-same-circle.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-on-same-circle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD;;;;;GAKG;AACH,SAAS,cAAc,CACf,OAAe,EACf,OAAe;IAEnB,iDAAiD;IACjD,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAExC,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAGD,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -1,3 +1,11 @@
1
1
  import { CpNode } from "../cp-node.js";
2
+ /**
3
+ * Returns true if this `CpNode`'s maximal disk has only one contact point
4
+ * on the shape boundary (up to planar coordinates). These includes sharp
5
+ * corners.
6
+ *
7
+ * Note, however, that two `CpNode`s are stored for each such point to
8
+ * preserve symmetry - see `isTerminating` for more details.
9
+ */
2
10
  declare function isOneProng(cpNode: CpNode): boolean;
3
11
  export { isOneProng };
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Returns true if this `CpNode`'s maximal disk has only one contact point
3
+ * on the shape boundary (up to planar coordinates). These includes sharp
4
+ * corners.
5
+ *
6
+ * Note, however, that two `CpNode`s are stored for each such point to
7
+ * preserve symmetry - see `isTerminating` for more details.
8
+ */
1
9
  // TODO2 - remove - or replace with `getRealProngCount === 1`
2
10
  function isOneProng(cpNode) {
3
11
  const cp1 = cpNode;
@@ -1 +1 @@
1
- {"version":3,"file":"is-one-prong.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-one-prong.ts"],"names":[],"mappings":"AAGA,6DAA6D;AAC7D,SAAS,UAAU,CAAC,MAAc;IAC9B,MAAM,GAAG,GAAG,MA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type { CpNode } from "../cp-node.js";
1
2
  import { LlRbTree } from "flo-ll-rb-tree";
2
3
  import { ContactPoint } from "../../contact-point/contact-point.js";
3
- import { CpNode } from "../cp-node.js";
4
4
  declare function isOrderCorrect(cpTree: LlRbTree<CpNode>, cp: ContactPoint, next: CpNode): boolean;
5
5
  export { isOrderCorrect };
@@ -1,8 +1,5 @@
1
1
  import { compareCps } from "../../contact-point/contact-point.js";
2
- function isOrderCorrect(
3
- // isHoleClosing: boolean,
4
- cpTree, cp, next) {
5
- // if (isHoleClosing) { return true; }
2
+ function isOrderCorrect(cpTree, cp, next) {
6
3
  // TODO2
7
4
  const c = compareCps(cp, next.cp);
8
5
  if (c < 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"is-order-correct.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-order-correct.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAgB,MAAM,sCAAsC,CAAC;AAIhF,SAAS,cAAc;AACf,0BAA0B;AAC1B,MAAwB,EACxB,EAAgB,EAChB,IAAY;IAEhB,sCAAsC;IAEtC,QAAQ;IACR,MAAM,CAAC,GAAG,UAAU,CAAC,EAAE,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;IAC3B,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACV,QAAQ;QACR,0BAA0B;QAC1B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACpC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC,CAAE,oBAAoB;QAC9C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC;IAC1B,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,EAAG,CAAC,KAAK,CAAC;IAEvC,2CAA2C;IAC3C,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC;AACvD,CAAC;AAGD,OAAO,EAAE,cAAc,EAAE,CAAA"}
1
+ {"version":3,"file":"is-order-correct.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-order-correct.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAgB,MAAM,sCAAsC,CAAC;AAGhF,SAAS,cAAc,CACf,MAAwB,EACxB,EAAgB,EAChB,IAAY;IAEhB,QAAQ;IACR,MAAM,CAAC,GAAG,UAAU,CAAC,EAAE,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;IAC3B,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACV,QAAQ;QACR,0BAA0B;QAC1B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACpC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC,CAAE,oBAAoB;QAC9C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC;IAC1B,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,EAAG,CAAC,KAAK,CAAC;IAEvC,2CAA2C;IAC3C,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC;AACvD,CAAC;AAGD,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -1,3 +1,10 @@
1
1
  import { CpNode } from "../cp-node.js";
2
+ /**
3
+ * Returns true if this `CpNode` represents a sharp corner, i.e. the
4
+ * limiting case of a two-prong having zero radius.
5
+ *
6
+ * Note that two `CpNode`s are stored for each sharp corner, one being
7
+ * terminating and one not. See `isTerminating` for more details.
8
+ */
2
9
  declare function isSharp(cpNode: CpNode): boolean;
3
10
  export { isSharp };
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Returns true if this `CpNode` represents a sharp corner, i.e. the
3
+ * limiting case of a two-prong having zero radius.
4
+ *
5
+ * Note that two `CpNode`s are stored for each sharp corner, one being
6
+ * terminating and one not. See `isTerminating` for more details.
7
+ */
1
8
  function isSharp(cpNode) {
2
9
  return cpNode.cp.circle.radius === 0;
3
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"is-sharp.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-sharp.ts"],"names":[],"mappings":"AAGA,SAAS,OAAO,CAAC,MAAc;IAC3B,OAAO,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;AACzC,CAAC;AAGD,OAAO,EAAE,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"is-sharp.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-sharp.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,SAAS,OAAO,CAAC,MAAc;IAC3B,OAAO,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;AACzC,CAAC;AAGD,OAAO,EAAE,OAAO,EAAE,CAAA"}
@@ -1,3 +1,3 @@
1
- import { CpNode } from "../cp-node.js";
1
+ import type { CpNode } from "../cp-node.js";
2
2
  declare function isSpecial(cpNode: CpNode): boolean;
3
3
  export { isSpecial };
@@ -1,9 +1,7 @@
1
1
  import { getRealProngCount } from "./get-real-prong-count.js";
2
2
  function isSpecial(cpNode) {
3
3
  return ((getRealProngCount(cpNode) !== 2) &&
4
- !cpNode.isHoleClosing /* && cpNode.cp.circle.radius !== 0*/
5
- // !cpNode.isHoleClosing && cpNode.cp.circle.radius !== 0 // TODO2
6
- );
4
+ !cpNode.isHoleClosing);
7
5
  }
8
6
  export { isSpecial };
9
7
  //# sourceMappingURL=is-special.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-special.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-special.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D,SAAS,SAAS,CACV,MAAc;IAElB,OAAO,CACH,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC,MAAM,CAAC,aAAa,CAAA,qCAAqC;IAC1D,kEAAkE;KACrE,CAAA;AACL,CAAC;AAGD,OAAO,EAAE,SAAS,EAAE,CAAA"}
1
+ {"version":3,"file":"is-special.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-special.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D,SAAS,SAAS,CACV,MAAc;IAElB,OAAO,CACH,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC,MAAM,CAAC,aAAa,CACxB,CAAA;AACL,CAAC;AAGD,OAAO,EAAE,SAAS,EAAE,CAAA"}
@@ -1,3 +1,25 @@
1
1
  import type { CpNode } from "../cp-node.js";
2
+ /**
3
+ * Returns `true` if this `CpNode` is terminating, i.e. implies a leaf MAT
4
+ * vertex.
5
+ *
6
+ * The following are some instances where this is the case:
7
+ *
8
+ * * Sharp corners.
9
+ *
10
+ * * Half of Hole-closers, i.e. `CpNode`s whose next `CpNode` is on a different
11
+ * loop
12
+ *
13
+ * * Maximal disks with a single contact point.
14
+ * Note, however, that even in these cases there are two contact points stored
15
+ * (sitting 'on top' of each other) for the maximal disk. It can be seen as a
16
+ * limiting case of a two-prong where the distance between two of the contact
17
+ * points tend to zero. One point (represented by a `CpNode` of course) will
18
+ * be terminating with the other point being its `next`, whereas the other
19
+ * point will *not* be terminating and 'points' back into the shape.
20
+ *
21
+ * * Some 3-prongs may also become terminating if the Scale Axis Transform is
22
+ * applied to the shape.
23
+ */
2
24
  declare function isTerminating(cpNode: CpNode): boolean;
3
25
  export { isTerminating };
@@ -1,3 +1,25 @@
1
+ /**
2
+ * Returns `true` if this `CpNode` is terminating, i.e. implies a leaf MAT
3
+ * vertex.
4
+ *
5
+ * The following are some instances where this is the case:
6
+ *
7
+ * * Sharp corners.
8
+ *
9
+ * * Half of Hole-closers, i.e. `CpNode`s whose next `CpNode` is on a different
10
+ * loop
11
+ *
12
+ * * Maximal disks with a single contact point.
13
+ * Note, however, that even in these cases there are two contact points stored
14
+ * (sitting 'on top' of each other) for the maximal disk. It can be seen as a
15
+ * limiting case of a two-prong where the distance between two of the contact
16
+ * points tend to zero. One point (represented by a `CpNode` of course) will
17
+ * be terminating with the other point being its `next`, whereas the other
18
+ * point will *not* be terminating and 'points' back into the shape.
19
+ *
20
+ * * Some 3-prongs may also become terminating if the Scale Axis Transform is
21
+ * applied to the shape.
22
+ */
1
23
  function isTerminating(cpNode) {
2
24
  return cpNode === cpNode.next.prevOnCircle;
3
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"is-terminating.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-terminating.ts"],"names":[],"mappings":"AAGA,SAAS,aAAa,CAAC,MAAc;IACjC,OAAO,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;AAC/C,CAAC;AAGD,OAAO,EAAE,aAAa,EAAE,CAAA"}
1
+ {"version":3,"file":"is-terminating.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-terminating.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAS,aAAa,CAAC,MAAc;IACjC,OAAO,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;AAC/C,CAAC;AAGD,OAAO,EAAE,aAAa,EAAE,CAAA"}
@@ -1,3 +1,12 @@
1
1
  import { CpNode } from "../cp-node.js";
2
+ /**
3
+ * @internal
4
+ *
5
+ * Traverses the shape from the given `CpNode` going around the shortest path
6
+ * so that only a piece of the shape is traversed and returns the visited
7
+ * `CpNode`s (starting from the given `CpNode`).
8
+ *
9
+ * @param cpStart The `CpNode` from where to start the traversal.
10
+ */
2
11
  declare function traverseCp(cpStart: CpNode): CpNode[];
3
12
  export { traverseCp };
@@ -1,4 +1,13 @@
1
1
  import { isTerminating } from "./is-terminating.js";
2
+ /**
3
+ * @internal
4
+ *
5
+ * Traverses the shape from the given `CpNode` going around the shortest path
6
+ * so that only a piece of the shape is traversed and returns the visited
7
+ * `CpNode`s (starting from the given `CpNode`).
8
+ *
9
+ * @param cpStart The `CpNode` from where to start the traversal.
10
+ */
2
11
  function traverseCp(cpStart) {
3
12
  let cpNode = cpStart;
4
13
  if (isTerminating(cpNode)) {
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-cp.js","sourceRoot":"","sources":["../../../src/cp-node/fs/traverse-cp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,SAAS,UAAU,CACX,OAAe;IAEnB,IAAI,MAAM,GAAG,OAAO,CAAC;IAErB,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAE,mBAAmB;IACzC,CAAC;IAED,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,GAAG,CAAC;QACA,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAExB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;QACtC,MAAM,GAAG,MAAM,KAAK,IAAI;YAChB,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB;YAC9C,CAAC,CAAC,MAAM,GAAG,IAAI,CAAA,CAAS,iBAAiB;IAErD,CAAC,QAAQ,MAAM,KAAK,OAAO,EAAE;IAE7B,OAAO,UAAU,CAAC;AACtB,CAAC;AAGD,OAAO,EAAE,UAAU,EAAE,CAAA"}
1
+ {"version":3,"file":"traverse-cp.js","sourceRoot":"","sources":["../../../src/cp-node/fs/traverse-cp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD;;;;;;;;GAQG;AACH,SAAS,UAAU,CACX,OAAe;IAEnB,IAAI,MAAM,GAAG,OAAO,CAAC;IAErB,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAE,mBAAmB;IACzC,CAAC;IAED,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,GAAG,CAAC;QACA,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAExB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;QACtC,MAAM,GAAG,MAAM,KAAK,IAAI;YAChB,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB;YAC9C,CAAC,CAAC,MAAM,GAAG,IAAI,CAAA,CAAS,iBAAiB;IAErD,CAAC,QAAQ,MAAM,KAAK,OAAO,EAAE;IAE7B,OAAO,UAAU,CAAC;AACtB,CAAC;AAGD,OAAO,EAAE,UAAU,EAAE,CAAA"}
@@ -1,3 +1,10 @@
1
1
  import { CpNode } from '../cp-node.js';
2
+ /**
3
+ * Traverses all edges (depth first) of the given MAT tree starting at the given
4
+ * vertex (represented by a `CpNode`).
5
+ * @param cpNode Any `CpNode` representing the start vertex.
6
+ * @param traverseEdgesCallback A callback function for each CpNode representing the vertex at the
7
+ * start of an edge.
8
+ */
2
9
  declare function traverseEdges(cpNode: CpNode, traverseEdgesCallback: (cpNode: CpNode) => void): void;
3
10
  export { traverseEdges };
@@ -1,5 +1,12 @@
1
1
  import { isTerminating } from './is-terminating.js';
2
2
  import { getAllOnLoop } from './get-all-on-loop.js';
3
+ /**
4
+ * Traverses all edges (depth first) of the given MAT tree starting at the given
5
+ * vertex (represented by a `CpNode`).
6
+ * @param cpNode Any `CpNode` representing the start vertex.
7
+ * @param traverseEdgesCallback A callback function for each CpNode representing the vertex at the
8
+ * start of an edge.
9
+ */
3
10
  function traverseEdges(cpNode, traverseEdgesCallback) {
4
11
  const cpNodes = getAllOnLoop(cpNode);
5
12
  const seen = new Set();
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-edges.js","sourceRoot":"","sources":["../../../src/cp-node/fs/traverse-edges.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,SAAS,aAAa,CACd,MAAc,EACd,qBAA+C;IAEnD,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,KAAK,MAAM,IAAI,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YAChE,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC;AACL,CAAC;AAGD,OAAO,EAAE,aAAa,EAAE,CAAA"}
1
+ {"version":3,"file":"traverse-edges.js","sourceRoot":"","sources":["../../../src/cp-node/fs/traverse-edges.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD;;;;;;GAMG;AACH,SAAS,aAAa,CACd,MAAc,EACd,qBAA+C;IAEnD,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,KAAK,MAAM,IAAI,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YAChE,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC;AACL,CAAC;AAGD,OAAO,EAAE,aAAa,EAAE,CAAA"}
@@ -1,3 +1,12 @@
1
1
  import { CpNode } from '../cp-node.js';
2
+ /**
3
+ * Traverses the MAT tree and calls the given callback function for each vertex
4
+ * (represented by a `CpNode`) on the MAT.
5
+ *
6
+ * It is usually preferable to use `traverseEdges` as it allows for the
7
+ * traversal of all the smooth curves representing the MAT.
8
+ * @param cpNode Any `CpNode` representing the start vertex.
9
+ * @param traverseVerticesCallback A callback function taking a single `CpNode` as parameter.
10
+ */
2
11
  declare function traverseVertices(cpStart: CpNode, traverseVerticesCallback: (cpNode: CpNode) => void): void;
3
12
  export { traverseVertices };
@@ -1,6 +1,15 @@
1
1
  import { getAllOnCircle } from './get-all-on-circle.js';
2
2
  import { isTerminating } from './is-terminating.js';
3
3
  import { getVertexForwardChildren } from './get-vertex-forward-children.js';
4
+ /**
5
+ * Traverses the MAT tree and calls the given callback function for each vertex
6
+ * (represented by a `CpNode`) on the MAT.
7
+ *
8
+ * It is usually preferable to use `traverseEdges` as it allows for the
9
+ * traversal of all the smooth curves representing the MAT.
10
+ * @param cpNode Any `CpNode` representing the start vertex.
11
+ * @param traverseVerticesCallback A callback function taking a single `CpNode` as parameter.
12
+ */
4
13
  function traverseVertices(cpStart, traverseVerticesCallback) {
5
14
  traverseVerticesCallback(cpStart);
6
15
  // Since the tree is unrooted we must iterate in all directions from the
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-vertices.js","sourceRoot":"","sources":["../../../src/cp-node/fs/traverse-vertices.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,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,CAAC;SACtB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;SACxC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEhC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;QACrB,OAAO,GAAG,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,EAAG,CAAC;YACtB,wBAAwB,CAAC,EAAE,CAAC,CAAC;YAC7B,GAAG,CAAC,IAAI,CAAC,GAAG,wBAAwB,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC;AACL,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
@@ -44,16 +44,18 @@ function add2Prong(meta, circle, poss, isHoleClosing) {
44
44
  }
45
45
  return cpNodes[0]; // return the source `CpNode`
46
46
  }
47
- function closeHole(meta,
48
- // cpTrees: Map<Loop, LlRbTree<CpNode>>,
49
- cpNodes) {
47
+ function closeHole(meta, cpNodes) {
50
48
  const { cpTrees } = meta;
51
49
  const [cpNodeA, cpNodeB] = cpNodes;
52
50
  // Duplicate ContactPoints
53
51
  // const antipodeCpNode = cpNodeB[0];
54
52
  const cpAntipode = cpNodeB.cp;
55
53
  const cpNodeB2 = insertCpNode(true, true, false, cpTrees.get(cpAntipode.pointOnShape.curve.loop), { ...cpAntipode, order2: +1 }, cpNodeB, meta.lastInsertId);
54
+ cpNodeB2.holeCloserTwin = cpNodeB;
55
+ cpNodeB.holeCloserTwin = cpNodeB2;
56
56
  const cpNodeB1 = insertCpNode(true, true, false, cpTrees.get(cpNodeA.cp.pointOnShape.curve.loop), { ...cpNodeA.cp, order2: -1 }, cpNodeA.prev, meta.lastInsertId);
57
+ cpNodeB1.holeCloserTwin = cpNodeA;
58
+ cpNodeA.holeCloserTwin = cpNodeB1;
57
59
  // Connect graph
58
60
  cpNodeB1.prevOnCircle = cpNodeB2;
59
61
  cpNodeB1.nextOnCircle = cpNodeB2;
@@ -1 +1 @@
1
- {"version":3,"file":"add-2-prong.js","sourceRoot":"","sources":["../../src/find-2-prong/add-2-prong.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAG/D;;;;;;;;;;;GAWG;AACH,SAAS,SAAS,CACV,IAAa,EACb,MAAc,EACd,IAAoB,EACpB,aAAsB;IAE1B,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACrB,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC;QACxC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEd,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAE1D,uEAAuE;IACvE,mCAAmC;IACnC,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/B,IAAI,CAAC,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAA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SAAS,EAAE,CAAA"}
@@ -1,3 +1,3 @@
1
- import { CpNode } from "../cp-node/cp-node.js";
1
+ import type { CpNode } from "../cp-node/cp-node.js";
2
2
  declare function getGraph(specialVertices: CpNode[], holeClosers: CpNode[]): number[][];
3
3
  export { getGraph };
@@ -26,7 +26,7 @@ function getGraph(specialVertices, holeClosers) {
26
26
  }
27
27
  if (child.isHoleClosing) {
28
28
  // Hole closer found - don't go around loop
29
- child = holeCloserNext(pairs, child);
29
+ child = getHoleCloserNext(pairs, child);
30
30
  continue;
31
31
  }
32
32
  if (isVertexSpecial(child)) {
@@ -47,7 +47,7 @@ function getGraph(specialVertices, holeClosers) {
47
47
  }
48
48
  return graph;
49
49
  }
50
- function holeCloserNext(pairs, holeCloser) {
50
+ function getHoleCloserNext(pairs, holeCloser) {
51
51
  return pairs.get(holeCloser).next;
52
52
  }
53
53
  export { getGraph };
@@ -1 +1 @@
1
- {"version":3,"file":"get-graph.js","sourceRoot":"","sources":["../../src/floyd-warshall/get-graph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,SAAS,QAAQ,CACT,eAAyB,EACzB,WAAqB;IAEzB,MAAM,KAAK,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAE9C,MAAM,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC;IAEjC,MAAM,KAAK,GAAe,EAAE,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACrB,MAAM,OAAO,GAAG,eAAe,CAAC,CAAC,CAAC,CA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cp-node/cp-node.js";
2
+ /**
3
+ *
4
+ * @param holeClosers
5
+ * @returns
6
+ */
2
7
  declare function getHoleCloserPairs(holeClosers: CpNode[]): Map<CpNode, CpNode>;
3
8
  export { getHoleCloserPairs };
@@ -1,3 +1,11 @@
1
+ /**
2
+ *
3
+ * @param holeClosers
4
+ * @returns
5
+ */
6
+ // TODO - this function is currently O(n^2) but could be made O(n).
7
+ // TODO - only `pointOnShape.p` is checked but `pointOnShape.t` should also be checked
8
+ // or better yet, `CpNode.cp.order` and `CpNode.cp.order2`, etc.
1
9
  function getHoleCloserPairs(holeClosers) {
2
10
  const pairs = new Map();
3
11
  for (let hcA of holeClosers) {
@@ -1 +1 @@
1
- {"version":3,"file":"get-hole-closer-pairs.js","sourceRoot":"","sources":["../../src/floyd-warshall/get-hole-closer-pairs.ts"],"names":[],"mappings":"AAGA,SAAS,kBAAkB,CACnB,WAAqB;IAEzB,MAAM,KAAK,GAAuB,IAAI,GAAG,EAAE,CAAC;IAC5C,KAAK,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;QAC1B,KAAK,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;YAC1B,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;YAChC,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;YAChC,MAAM,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;YAClC,MAAM,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;YAClC,IAAI,GAAG,KAAK,GAAG;gBACX,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;gBAClC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC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,OAAO,KAAK,CAAC;AACjB,CAAC;AAGD,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
@@ -10,9 +10,7 @@ import { joinSpokes } from '../add-n-prong.ts/join-spokes.js';
10
10
  *
11
11
  * @internal
12
12
  */
13
- function addToCpTree(insertIfOrderIsWrong, isHoleClosing, circle, orders,
14
- // cpTrees: Map<Loop,LlRbTree<CpNode>>,
15
- meta, poss, neighbors) {
13
+ function addToCpTree(insertIfOrderIsWrong, isHoleClosing, circle, orders, meta, poss, neighbors) {
16
14
  const { cpTrees } = meta;
17
15
  let anyFailed = false;
18
16
  const cpNodes = poss.map((pos, i) => {
@@ -1 +1 @@
1
- {"version":3,"file":"add-to-cp-tree.js","sourceRoot":"","sources":["../../src/mat/add-to-cp-tree.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAG9D;;;;;;;;GAQG;AACH,SAAS,WAAW,CACZ,oBAA6B,EAC7B,aAAsB,EACtB,MAAc,EACd,MAAgB;AAChB,uCAAuC;AACvC,IAAa,EACb,IAAoB,EACpB,SAAqB;IAEzB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEzB,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAC,CAAC,EAAE,EAAE;QAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAE,CAAC;QAC5C,MAAM,EAAE,GAAiB,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAEzE,MAAM,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MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAE,CAAC;QAC5C,MAAM,EAAE,GAAiB,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAEzE,MAAM,IAAI,GAAG,SAAS,KAAK,SAAS;YAChC,CAAC,CAAC,qBAAqB,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;YAC9C,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAEnB,MAAM,MAAM,GAAG,YAAY,CACvB,oBAAoB,EACpB,aAAa,EACb,KAAK,EACL,MAAM,EACN,EAAE,EACF,IAAI,EACJ,IAAI,CAAC,YAAY,CACpB,CAAC;QAEF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAAC,SAAS,GAAG,IAAI,CAAC;QAAC,CAAC;QAE/C,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,UAAU,CAAC,MAAM,EAAE,OAAmB,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC;AAGD,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -1,4 +1,9 @@
1
1
  import type { CpNode } from "../cp-node/cp-node.js";
2
2
  import type { MatMeta } from '../mat/mat-meta.js';
3
+ /**
4
+ * Removes a cpNode from the MAT.
5
+ * @param cpTree The tree graph holding the `CpNodes` of the MAT.
6
+ * @param cpNode The `CpNode` to remove.
7
+ */
3
8
  declare function removeVertex(cpNode: CpNode, meta: MatMeta): void;
4
9
  export { removeVertex };
@@ -1,6 +1,11 @@
1
1
  import { getAllOnCircle } from '../cp-node/fs/get-all-on-circle.js';
2
2
  import { getProngCount } from '../cp-node/fs/get-prong-count.js';
3
3
  import { removeCpNode } from '../cp-node/fs/remove-cp-node.js';
4
+ /**
5
+ * Removes a cpNode from the MAT.
6
+ * @param cpTree The tree graph holding the `CpNodes` of the MAT.
7
+ * @param cpNode The `CpNode` to remove.
8
+ */
4
9
  function removeVertex(cpNode, meta) {
5
10
  // cpTrees: Map<Loop, LlRbTree<CpNode>>): void {
6
11
  const prongCount = getProngCount(cpNode);
@@ -1 +1 @@
1
- {"version":3,"file":"remove-vertex.js","sourceRoot":"","sources":["../../src/vertex/remove-vertex.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAG/D,SAAS,YAAY,CACb,MAAc,EACd,IAAa;IACb,gDAAgD;IAEpD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,+BAA+B,UAAU,QAAQ,CAAC,CAAA;IACtE,CAAC;IAED,cAAc,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACzE,CAAC;AAGD,OAAO,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"remove-vertex.js","sourceRoot":"","sources":["../../src/vertex/remove-vertex.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAG/D;;;;GAIG;AACH,SAAS,YAAY,CACb,MAAc,EACd,IAAa;IACb,gDAAgD;IAEpD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,+BAA+B,UAAU,QAAQ,CAAC,CAAA;IACtE,CAAC;IAED,cAAc,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACzE,CAAC;AAGD,OAAO,EAAE,YAAY,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.12",
5
+ "version": "3.0.13",
6
6
  "author": {
7
7
  "name": "Floris Steenkamp"
8
8
  },
@@ -176,20 +176,20 @@ const CpNodeFs = {
176
176
  */
177
177
  clone,
178
178
  /**
179
- * Returns the ordered bezier curves from this CpNode to the next CpNode
179
+ * Returns the ordered bezier curves from this `CpNode` to the next `CpNode`
180
180
  * on the boundary.
181
181
  * @param cpNode
182
182
  */
183
183
  getBoundaryBezierPartsToNext,
184
184
  /**
185
- * Returns the ordered bezier curves from this CpNode to the next CpNode
185
+ * Returns the ordered bezier curves from this `CpNode` to the next `CpNode`
186
186
  * on the boundary.
187
187
  * @param cpNode
188
188
  */
189
189
  getBoundaryBeziersToNext,
190
190
  /**
191
- * Removes a cpNode from the MAT.
192
- * @param cpTree The tree graph holding the `CpNodes` of the MAT.
191
+ * Removes a `CpNode` from the MAT.
192
+ * @param cpTree The tree graph holding the `CpNode`s of the MAT.
193
193
  * @param cpNode The `CpNode` to remove.
194
194
  */
195
195
  removeVertex,
@@ -54,11 +54,11 @@ interface CpNode {
54
54
  cp: ContactPoint;
55
55
  /** If true, this `CpNode` belongs to a hole-closing maximal disk. */
56
56
  isHoleClosing: boolean;
57
- /** true if this cpNode is at a shape boundary intersection point, false otherwise */
57
+ /** true if this `CpNode` is at a shape boundary intersection point, false otherwise */
58
58
  isIntersection: boolean;
59
- /** The previous (going clockwise around the boundary) contact point (`CpNode`).*/
59
+ /** The previous (going clockwise around the boundary) contact point `CpNode`. */
60
60
  prev: CpNode;
61
- /** The next (going anti-clockwise around the boundary) contact point (`CpNode`). */
61
+ /** The next (going anti-clockwise around the boundary) contact point `CpNode`. */
62
62
  next: CpNode;
63
63
  /**
64
64
  * The previous `CpNode` (going clockwise around the inscribed circle
@@ -71,15 +71,13 @@ interface CpNode {
71
71
  */
72
72
  nextOnCircle: CpNode;
73
73
  /**
74
- * For hole closers only - the next `CpNode` ignoring the hole closer
74
+ * For hole closers only - the twin `CpNode` at the same point, e.g.
75
+ * use `cpNode.holeCloserTwin.next` to skip the hole closer and get to the
76
+ * next `CpNode` on the same loop.
75
77
  */
76
- holeCloserNext?: CpNode | undefined;
77
- /**
78
- * For hole closers only - the prev `CpNode` ignoring the hole closer
79
- */
80
- holeCloserPrev?: CpNode | undefined;
78
+ holeCloserTwin?: CpNode | undefined;
81
79
 
82
- /** Only used in export */
80
+ /** For debugging / easy identification only */
83
81
  id: number;
84
82
  }
85
83
 
@@ -2,6 +2,12 @@ import type { CpNode } from "../cp-node.js";
2
2
  import { compareCps } from "../../contact-point/contact-point.js";
3
3
 
4
4
 
5
+ /**
6
+ * Primarily for internal use.
7
+ *
8
+ * Compares the order of two `CpNode`s. The order is cyclic and depends
9
+ * on a `CpNode`'s relative position along the shape boundary.
10
+ */
5
11
  function cpNodeComparator(
6
12
  a: CpNode,
7
13
  b: CpNode) {
@@ -7,6 +7,10 @@ import { isSharp } from "./is-sharp.js";
7
7
  import { isTerminating } from "./is-terminating.js";
8
8
 
9
9
 
10
+ /**
11
+ * For debugging
12
+ * @param cpNode
13
+ */
10
14
  function enhanceCpNode(cpNode: CpNode) {
11
15
  const cp = cpNode.cp;
12
16
  const pos = cp.pointOnShape;
@@ -2,10 +2,10 @@ import type { CpNode } from "../cp-node.js";
2
2
 
3
3
 
4
4
  /**
5
- * Returns all the `CpNode`s on the same circle.
6
- *
7
- * @param cpNode
8
- * @param exclThis
5
+ * Return this (except if exclThis is truthy) and the the other CpNodes
6
+ * around the maximal disk vertex circle in an anti-clockwise order.
7
+ * @param exclThis If true the returned array does not include this
8
+ * `CpNode`.
9
9
  */
10
10
  function getAllOnCircle(
11
11
  cpNode: CpNode,
@@ -1,6 +1,10 @@
1
1
  import type { CpNode } from "../cp-node.js";
2
2
 
3
3
 
4
+ /**
5
+ * Returns all `CpNode`s on the MAT that this `CpNode` is part of
6
+ * starting from the current one and going anti-clockwise around the shape.
7
+ */
4
8
  function getAllOnLoop(
5
9
  cpNode: CpNode) {
6
10
 
@@ -4,13 +4,14 @@ import type { Curve } from '../../curve/curve.js';
4
4
 
5
5
 
6
6
  /**
7
- * Returns the boundary beziers pieces between this `CpNode` and the next
8
- * one.
7
+ * Returns the ordered `BezierPiece`s from this `CpNode` to the next `CpNode`
8
+ * on the boundary.
9
9
  *
10
- * * returns `undefined` if the next `CpNode` is on a different loop,
11
- * as this is a hole-closer and there are no boundary beziers between them.
10
+ * * returns `[]` if (and only if) the next `CpNode` is on a different loop;
11
+ * this differs from "returns `[]` if (and only if) the next `CpNode` is a
12
+ * hole-closer" as half of hole-closers are on the same loop.
12
13
  *
13
- * @param cpNode
14
+ * @param cpNode
14
15
  */
15
16
  function getBoundaryBezierPartsToNext(
16
17
  cpNode: CpNode): BezierPiece[] {
@@ -4,14 +4,10 @@ import { getBoundaryBezierPartsToNext } from './get-boundary-bezier-parts-to-nex
4
4
 
5
5
 
6
6
  /**
7
- // * Returns the boundary beziers between this `CpNode` and the next
8
- // * one.
9
- // *
10
- // * * returns `[]` if the next `CpNode` is on a different loop,
11
- // * as this is a hole-closer and there are no boundary beziers between them.
12
- // *
13
- // * @param cpNode
14
- // */
7
+ * Returns the ordered bezier curves from this `CpNode` to the next `CpNode`
8
+ * on the boundary.
9
+ * @param cpNode
10
+ */
15
11
  function getBoundaryBeziersToNext(
16
12
  cpNode: CpNode): number[][][] {
17
13