flo-mat 3.0.5 → 3.0.7
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.
- package/__tests__/cp-node/fs/add-distance-from.spec.ts +7 -0
- package/__tests__/cp-node/fs/check-jsog-eql-calc.spec.ts +30 -0
- package/__tests__/cp-node/fs/clone.spec.ts +7 -0
- package/__tests__/cp-node/fs/cp-nodes-to-boundary-beziers.spec.ts +7 -0
- package/__tests__/cp-node/fs/create-cp-node.spec.ts +7 -0
- package/__tests__/cp-node/fs/enhance-cp-node.spec.ts +7 -0
- package/__tests__/cp-node/fs/find-first.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-all-between.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-all-on-circle.spec.ts +92 -0
- package/__tests__/cp-node/fs/get-all-on-loop.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-all-vertices.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-angle-between-mat-curves.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-avg-speed.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-boundary-bezier-parts-to-next.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-boundary-beziers-between.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-boundary-beziers-to-next.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-boundary-distance-to-next.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-branch-beziers.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-branch.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-children.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-cp-node-ordering.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-distance-between.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-distance-to-next.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-edge-direction.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-first-exit.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-hole-closers.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-implied-boundary-bezier-between.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-mat-curve-between.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-mat-curve-to-next.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-mat-curves-between.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-non-terminating-on-circle.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-prong-count.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-real-prong-count.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-salience.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-smoothed-speed.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-smoothed.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-speed.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-terminating-on-circle.spec.ts +7 -0
- package/__tests__/cp-node/fs/get-vertex-forward-children.spec.ts +7 -0
- package/__tests__/cp-node/fs/insert-cp-node.spec.ts +7 -0
- package/__tests__/cp-node/fs/is-fully-terminating.spec.ts +7 -0
- package/__tests__/cp-node/fs/is-on-same-circle.spec.ts +7 -0
- package/__tests__/cp-node/fs/is-one-prong.spec.ts +7 -0
- package/__tests__/cp-node/fs/is-order-correct.spec.ts +7 -0
- package/__tests__/cp-node/fs/is-sharp.spec.ts +7 -0
- package/__tests__/cp-node/fs/is-single-3-prong.spec.ts +7 -0
- package/__tests__/cp-node/fs/is-special.spec.ts +7 -0
- package/__tests__/cp-node/fs/is-terminating.spec.ts +7 -0
- package/__tests__/cp-node/fs/is-trivial.spec.ts +7 -0
- package/__tests__/cp-node/fs/is-two-prong.spec.ts +7 -0
- package/__tests__/cp-node/fs/is-vertex-special.spec.ts +7 -0
- package/__tests__/cp-node/fs/is-vertex.spec.ts +7 -0
- package/__tests__/cp-node/fs/iterate-all-on-loop.spec.ts +7 -0
- package/__tests__/cp-node/fs/mat-dummys.ts +6716 -0
- package/__tests__/cp-node/fs/remove-cp-node.spec.ts +7 -0
- package/__tests__/cp-node/fs/traverse-all-forward.spec.ts +7 -0
- package/__tests__/cp-node/fs/traverse-cp.spec.ts +7 -0
- package/__tests__/cp-node/fs/traverse-edges.spec.ts +7 -0
- package/__tests__/cp-node/fs/traverse-vertices.spec.ts +7 -0
- package/__tests__/lib-load.spec.ts +9 -10
- package/browser/index.js +247 -189
- package/browser/index.min.js +1 -1
- package/jest.config.cjs +32 -0
- package/node/corner/get-interface-ccw.js +0 -1
- package/node/corner/get-interface-ccw.js.map +1 -1
- package/node/cp-node/cp-node-fs.d.ts +32 -32
- package/node/cp-node/cp-node-fs.js +32 -32
- package/node/cp-node/cp-node.d.ts +13 -21
- package/node/cp-node/fs/clone.d.ts +3 -3
- package/node/cp-node/fs/clone.js +3 -3
- package/node/cp-node/fs/enhance-cp-node.d.ts +1 -5
- package/node/cp-node/fs/enhance-cp-node.js.map +1 -1
- package/node/cp-node/fs/get-all-between.d.ts +3 -3
- package/node/cp-node/fs/get-all-between.js +3 -3
- package/node/cp-node/fs/get-all-between.js.map +1 -1
- package/node/cp-node/fs/get-all-on-circle.d.ts +7 -1
- package/node/cp-node/fs/get-all-on-circle.js +11 -7
- package/node/cp-node/fs/get-all-on-circle.js.map +1 -1
- package/node/cp-node/fs/get-all-on-loop.d.ts +1 -1
- package/node/cp-node/fs/get-all-on-loop.js.map +1 -1
- package/node/cp-node/fs/get-boundary-bezier-parts-to-next.d.ts +12 -3
- package/node/cp-node/fs/get-boundary-bezier-parts-to-next.js +22 -7
- package/node/cp-node/fs/get-boundary-bezier-parts-to-next.js.map +1 -1
- package/node/cp-node/fs/get-boundary-beziers-between.d.ts +1 -1
- package/node/cp-node/fs/get-boundary-beziers-between.js.map +1 -1
- package/node/cp-node/fs/get-boundary-beziers-to-next.js.map +1 -1
- package/node/cp-node/fs/insert-cp-node.d.ts +3 -1
- package/node/cp-node/fs/insert-cp-node.js +12 -2
- package/node/cp-node/fs/insert-cp-node.js.map +1 -1
- package/node/cp-node/fs/is-fully-terminating.d.ts +7 -0
- package/node/cp-node/fs/is-fully-terminating.js +7 -0
- package/node/cp-node/fs/is-fully-terminating.js.map +1 -1
- package/node/cp-node/fs/is-terminating.d.ts +1 -1
- package/node/cp-node/fs/remove-cp-node.d.ts +3 -4
- package/node/cp-node/fs/remove-cp-node.js +3 -1
- package/node/cp-node/fs/remove-cp-node.js.map +1 -1
- package/node/curve/curve.d.ts +18 -11
- package/node/find-2-prong/add-1-prong.js +1 -1
- package/node/find-2-prong/add-1-prong.js.map +1 -1
- package/node/find-2-prong/add-2-prong.js +9 -7
- package/node/find-2-prong/add-2-prong.js.map +1 -1
- package/node/find-2-prong/calc-seperation-tolerance.d.ts +8 -1
- package/node/find-2-prong/calc-seperation-tolerance.js +73 -59
- package/node/find-2-prong/calc-seperation-tolerance.js.map +1 -1
- package/node/find-2-prong/find-2-prong.js +2 -2
- package/node/find-2-prong/find-2-prong.js.map +1 -1
- package/node/find-2-prong/get-initial-bezier-pieces.d.ts +2 -3
- package/node/find-2-prong/get-initial-bezier-pieces.js +4 -1
- package/node/find-2-prong/get-initial-bezier-pieces.js.map +1 -1
- package/node/find-3-prong.ts/find-and-add-3-prong.js +1 -1
- package/node/find-3-prong.ts/find-and-add-3-prong.js.map +1 -1
- package/node/find-3-prong.ts/find-and-add-3-prongs-on-loop.d.ts +2 -2
- package/node/find-3-prong.ts/find-and-add-3-prongs-on-loop.js +8 -3
- package/node/find-3-prong.ts/find-and-add-3-prongs-on-loop.js.map +1 -1
- package/node/find-mat/create-initial-cp-tree.d.ts +7 -3
- package/node/find-mat/create-initial-cp-tree.js +7 -5
- package/node/find-mat/create-initial-cp-tree.js.map +1 -1
- package/node/find-mat/find-mat.d.ts +2 -1
- package/node/find-mat/find-mat.js +10 -4
- package/node/find-mat/find-mat.js.map +1 -1
- package/node/find-mat/get-meta.d.ts +5 -2
- package/node/find-mat/get-meta.js +15 -14
- package/node/find-mat/get-meta.js.map +1 -1
- package/node/index.d.ts +0 -1
- package/node/index.js +1 -1
- package/node/index.js.map +1 -1
- package/node/mat/add-to-cp-tree.d.ts +5 -6
- package/node/mat/add-to-cp-tree.js +5 -2
- package/node/mat/add-to-cp-tree.js.map +1 -1
- package/node/mat/get-branches.d.ts +7 -0
- package/node/mat/get-branches.js +7 -0
- package/node/mat/get-branches.js.map +1 -1
- package/node/mat/mat-meta.d.ts +8 -1
- package/node/mat/mat.d.ts +3 -3
- package/node/mat/simplify-mat.js +1 -1
- package/node/mat/simplify-mat.js.map +1 -1
- package/node/point-on-shape/point-on-shape.d.ts +1 -1
- package/node/vertex/remove-vertex.d.ts +3 -4
- package/node/vertex/remove-vertex.js +3 -2
- package/node/vertex/remove-vertex.js.map +1 -1
- package/package.json +10 -7
- package/src/corner/get-interface-ccw.ts +0 -1
- package/src/cp-node/cp-node-fs.ts +43 -43
- package/src/cp-node/cp-node.ts +27 -39
- package/src/cp-node/fs/clone.ts +3 -3
- package/src/cp-node/fs/enhance-cp-node.ts +0 -1
- package/src/cp-node/fs/get-all-between.ts +31 -28
- package/src/cp-node/fs/get-all-on-circle.ts +13 -8
- package/src/cp-node/fs/get-all-on-loop.ts +12 -10
- package/src/cp-node/fs/get-boundary-bezier-parts-to-next.ts +39 -22
- package/src/cp-node/fs/get-boundary-beziers-between.ts +6 -2
- package/src/cp-node/fs/get-boundary-beziers-to-next.ts +6 -4
- package/src/cp-node/fs/insert-cp-node.ts +13 -2
- package/src/cp-node/fs/is-fully-terminating.ts +7 -0
- package/src/cp-node/fs/is-terminating.ts +1 -1
- package/src/cp-node/fs/remove-cp-node.ts +8 -4
- package/src/curve/curve.ts +19 -13
- package/src/debug/functions/check-ordering.ts +7 -3
- package/src/find-2-prong/add-1-prong.ts +1 -1
- package/src/find-2-prong/add-2-prong.ts +79 -74
- package/src/find-2-prong/calc-seperation-tolerance.ts +88 -78
- package/src/find-2-prong/find-2-prong.ts +2 -2
- package/src/find-2-prong/get-initial-bezier-pieces.ts +5 -1
- package/src/find-3-prong.ts/add-3-prong.ts +73 -70
- package/src/find-3-prong.ts/find-and-add-3-prong.ts +1 -1
- package/src/find-3-prong.ts/find-and-add-3-prongs-on-loop.ts +9 -8
- package/src/find-mat/create-initial-cp-tree.ts +10 -6
- package/src/find-mat/find-mat.ts +12 -5
- package/src/find-mat/get-meta.ts +30 -20
- package/src/get-curve/get-curve-between.ts +2 -2
- package/src/index.ts +1 -1
- package/src/mat/add-to-cp-tree.ts +18 -9
- package/src/mat/get-branches.ts +35 -28
- package/src/mat/mat-meta.ts +6 -1
- package/src/mat/mat.ts +3 -3
- package/src/mat/simplify-mat.ts +1 -1
- package/src/point-on-shape/compare-poss.ts +3 -3
- package/src/point-on-shape/get-osculating-circle.ts +1 -1
- package/src/point-on-shape/is-pos-dull-corner.ts +1 -1
- package/src/point-on-shape/point-on-shape.ts +1 -1
- package/src/point-on-shape/pos-to-human-string.ts +1 -1
- package/src/sat/to-scale-axis.ts +1 -1
- package/src/vertex/remove-vertex.ts +7 -5
- package/.mocharc.cjs +0 -17
- package/src/debug/functions/draw-elem/branch.ts +0 -26
- package/src/find-mat/create-initial-cp-graph.ts +0 -59
package/jest.config.cjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
const esModules = [
|
|
3
|
+
'flo-bezier3',
|
|
4
|
+
'flo-graham-scan',
|
|
5
|
+
'flo-poly',
|
|
6
|
+
'flo-gauss-quadrature',
|
|
7
|
+
'flo-vector2d',
|
|
8
|
+
'big-float-ts',
|
|
9
|
+
'double-double',
|
|
10
|
+
'flo-boolean',
|
|
11
|
+
'flo-draw',
|
|
12
|
+
'flo-memoize',
|
|
13
|
+
'flo-ll-rb-tree',
|
|
14
|
+
'flo-lines-intersections',
|
|
15
|
+
'squares-rng'
|
|
16
|
+
].join('|');
|
|
17
|
+
|
|
18
|
+
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
19
|
+
module.exports = {
|
|
20
|
+
testEnvironment: 'node',
|
|
21
|
+
resolver: "jest-ts-webcompat-resolver",
|
|
22
|
+
testMatch: [ "**/__tests__/**/*.spec.ts"],
|
|
23
|
+
collectCoverage: false, // Make true again!
|
|
24
|
+
coverageProvider: 'v8',
|
|
25
|
+
testTimeout: 15000,
|
|
26
|
+
transform: {
|
|
27
|
+
"^.+\\.(t|j)sx?$": "@swc/jest"
|
|
28
|
+
},
|
|
29
|
+
transformIgnorePatterns: [
|
|
30
|
+
`/node_modules/(?!${esModules})`
|
|
31
|
+
]
|
|
32
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { eAdd, eEstimate, eMult, eNegativeOf, twoDiff } from 'big-float-ts';
|
|
2
|
-
// import { dot } from "flo-vector2d";
|
|
3
2
|
import { compareCurvaturesAtInterface } from "./compare-curvatures-at-interface.js";
|
|
4
3
|
/**
|
|
5
4
|
* Returns a positive value if the second bezier (of order 1, 2 or 3) curves
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-interface-ccw.js","sourceRoot":"","sources":["../../src/corner/get-interface-ccw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAa,SAAS,EAAE,KAAK,EAAE,WAAW,EAAsB,OAAO,EAAE,MAAM,cAAc,CAAC;AAC3G,
|
|
1
|
+
{"version":3,"file":"get-interface-ccw.js","sourceRoot":"","sources":["../../src/corner/get-interface-ccw.ts"],"names":[],"mappings":"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"}
|
|
@@ -34,7 +34,7 @@ import { getInitialDegAngleBetweenMatCurves } from "./fs/get-angle-between-mat-c
|
|
|
34
34
|
import { getAllVertices } from "./fs/get-all-vertices.js";
|
|
35
35
|
declare const CpNodeFs: {
|
|
36
36
|
/**
|
|
37
|
-
* Returns the children of this
|
|
37
|
+
* Returns the children of this `CpNode` when seen as a MAT edge. Only
|
|
38
38
|
* children in a 'forward' direction are returned. These include all edges
|
|
39
39
|
* except the 'backward' edge given by [[prevOnCircle]], even terminating
|
|
40
40
|
* edges.
|
|
@@ -42,7 +42,7 @@ declare const CpNodeFs: {
|
|
|
42
42
|
getChildren: typeof getChildren;
|
|
43
43
|
/**
|
|
44
44
|
* Similar to [[getChildren]] but returns the child nodes of the tree when
|
|
45
|
-
*
|
|
45
|
+
* `CpNode` is seen as a MAT vertex point (as opposed to edge). In this
|
|
46
46
|
* way the dual graph of the tree can easily be traversed - see e.g.
|
|
47
47
|
* [[traverseVertices]]. Generally, however, traversing the edges is
|
|
48
48
|
* preferred as it returns the entire Medial Axis (by utilizing
|
|
@@ -50,7 +50,7 @@ declare const CpNodeFs: {
|
|
|
50
50
|
*/
|
|
51
51
|
getVertexForwardChildren: typeof getVertexForwardChildren;
|
|
52
52
|
/**
|
|
53
|
-
* Returns all
|
|
53
|
+
* Returns all `CpNode`s on the MAT that this `CpNode` is part of
|
|
54
54
|
* starting from the current one and going anti-clockwise around the shape.
|
|
55
55
|
*/
|
|
56
56
|
getAllOnLoop: typeof getAllOnLoop;
|
|
@@ -58,18 +58,18 @@ declare const CpNodeFs: {
|
|
|
58
58
|
* Return this (except if exclThis is truthy) and the the other CpNodes
|
|
59
59
|
* around the maximal disk vertex circle in an anti-clockwise order.
|
|
60
60
|
* @param exclThis If true the returned array does not include this
|
|
61
|
-
*
|
|
61
|
+
* `CpNode`.
|
|
62
62
|
*/
|
|
63
63
|
getAllOnCircle: typeof getAllOnCircle;
|
|
64
64
|
/**
|
|
65
|
-
* Returns true if the 2 given
|
|
65
|
+
* Returns true if the 2 given `CpNode`s are on the same maximal disk
|
|
66
66
|
* circle.
|
|
67
|
-
* @param cpNode1 A
|
|
68
|
-
* @param cpNode2 Another
|
|
67
|
+
* @param cpNode1 A `CpNode`.
|
|
68
|
+
* @param cpNode2 Another `CpNode`
|
|
69
69
|
*/
|
|
70
70
|
isOnSameCircle: typeof isOnSameCircle;
|
|
71
71
|
/**
|
|
72
|
-
* Returns true if this
|
|
72
|
+
* Returns true if this `CpNode` is terminating, i.e. implies a leaf MAT
|
|
73
73
|
* vertex.
|
|
74
74
|
*
|
|
75
75
|
* This is always the case for sharp corners and maximal disks with
|
|
@@ -77,7 +77,7 @@ declare const CpNodeFs: {
|
|
|
77
77
|
* two contact points stored (sitting 'on top' of each other) for the
|
|
78
78
|
* maximal disk. It can be seen as a limiting case of a two-prong where the
|
|
79
79
|
* distance between two of the contact points tend to zero. One point
|
|
80
|
-
* (represented by a
|
|
80
|
+
* (represented by a `CpNode` of course) will be terminating with the
|
|
81
81
|
* other point being its [[next]], whereas the other point will *not* be
|
|
82
82
|
* terminating and 'points' back into the shape.
|
|
83
83
|
*/
|
|
@@ -88,30 +88,30 @@ declare const CpNodeFs: {
|
|
|
88
88
|
*/
|
|
89
89
|
isFullyTerminating: typeof isFullyTerminating;
|
|
90
90
|
/**
|
|
91
|
-
* Returns the first
|
|
91
|
+
* Returns the first `CpNode` (from this one by successively applying
|
|
92
92
|
* .nextOnCircle) that exits the circle.
|
|
93
93
|
*/
|
|
94
94
|
getFirstExit: typeof getFirstExit;
|
|
95
95
|
/**
|
|
96
|
-
* Returns true if this
|
|
96
|
+
* Returns true if this `CpNode` represents a sharp corner, i.e. the
|
|
97
97
|
* limiting case of a two-prong having zero radius.
|
|
98
98
|
*
|
|
99
|
-
* Note that two
|
|
99
|
+
* Note that two `CpNode`s are stored for each sharp corner, one being
|
|
100
100
|
* terminating and one not. See [[isTerminating]] for more details.
|
|
101
101
|
*/
|
|
102
102
|
isSharp: typeof isSharp;
|
|
103
103
|
/**
|
|
104
|
-
* Returns true if this
|
|
104
|
+
* Returns true if this `CpNode`'s maximal disk has only one contact point
|
|
105
105
|
* on the shape boundary (up to planar coordinates). These includes sharp
|
|
106
106
|
* corners.
|
|
107
107
|
*
|
|
108
|
-
* Note, however, that two
|
|
108
|
+
* Note, however, that two `CpNode`s are stored for each such point to
|
|
109
109
|
* preserve symmetry - see [[isTerminating]] for more details.
|
|
110
110
|
*/
|
|
111
111
|
isOneProng: typeof isOneProng;
|
|
112
112
|
/**
|
|
113
113
|
* Returns the number of contact points on the maximal disk circle implied
|
|
114
|
-
* by this
|
|
114
|
+
* by this `CpNode`.
|
|
115
115
|
*
|
|
116
116
|
* Note, however, that even one-prongs and sharp corners will return 2 (see
|
|
117
117
|
* [[isTerminating]] for more details); if this is not desired use
|
|
@@ -120,7 +120,7 @@ declare const CpNodeFs: {
|
|
|
120
120
|
getProngCount: typeof getProngCount;
|
|
121
121
|
/**
|
|
122
122
|
* Returns the number of contact points (up to planar coordinates) on the
|
|
123
|
-
* maximal disk circle implied by this
|
|
123
|
+
* maximal disk circle implied by this `CpNode`.
|
|
124
124
|
*
|
|
125
125
|
* See also [[getProngCount]].
|
|
126
126
|
*/
|
|
@@ -128,8 +128,8 @@ declare const CpNodeFs: {
|
|
|
128
128
|
/**
|
|
129
129
|
* Primarily for internal use.
|
|
130
130
|
*
|
|
131
|
-
* Compares the order of two
|
|
132
|
-
* on a
|
|
131
|
+
* Compares the order of two `CpNode`s. The order is cyclic and depends
|
|
132
|
+
* on a `CpNode`'s relative position along the shape boundary.
|
|
133
133
|
*/
|
|
134
134
|
cpNodeComparator: (a: CpNode, b: CpNode) => number;
|
|
135
135
|
/**
|
|
@@ -149,26 +149,26 @@ declare const CpNodeFs: {
|
|
|
149
149
|
traverseCp: typeof traverseCp;
|
|
150
150
|
/**
|
|
151
151
|
* Traverses all edges (depth first) of the given MAT tree starting at the given
|
|
152
|
-
* vertex (represented by a
|
|
153
|
-
* @param cpNode Any
|
|
152
|
+
* vertex (represented by a `CpNode`).
|
|
153
|
+
* @param cpNode Any `CpNode` representing the start vertex.
|
|
154
154
|
* @param traverseEdgesCallback A callback function for each CpNode representing the vertex at the
|
|
155
155
|
* start of an edge.
|
|
156
156
|
*/
|
|
157
157
|
traverseEdges: typeof traverseEdges;
|
|
158
158
|
/**
|
|
159
159
|
* Traverses the MAT tree and calls the given callback function for each vertex
|
|
160
|
-
* (represented by a
|
|
160
|
+
* (represented by a `CpNode`) on the MAT.
|
|
161
161
|
*
|
|
162
162
|
* It is usually preferable to use [[traverseEdges]] as it allows for the
|
|
163
163
|
* traversal of all the smooth curves representing the MAT.
|
|
164
|
-
* @param cpNode Any
|
|
165
|
-
* @param traverseVerticesCallback A callback function taking a single
|
|
164
|
+
* @param cpNode Any `CpNode` representing the start vertex.
|
|
165
|
+
* @param traverseVerticesCallback A callback function taking a single `CpNode` as parameter.
|
|
166
166
|
*/
|
|
167
167
|
traverseVertices: typeof traverseVertices;
|
|
168
168
|
/**
|
|
169
|
-
* Returns a deep clone of this
|
|
170
|
-
* since cloning a single
|
|
171
|
-
*
|
|
169
|
+
* Returns a deep clone of this `CpNode`. Can be used to copy the MAT
|
|
170
|
+
* since cloning a single `CpNode` necessarily implies cloning all
|
|
171
|
+
* `CpNode`s on the same MAT tree.
|
|
172
172
|
*/
|
|
173
173
|
clone: typeof clone;
|
|
174
174
|
/**
|
|
@@ -185,13 +185,13 @@ declare const CpNodeFs: {
|
|
|
185
185
|
getBoundaryBeziersToNext: typeof getBoundaryBeziersToNext;
|
|
186
186
|
/**
|
|
187
187
|
* Removes a cpNode from the MAT.
|
|
188
|
-
* @param cpTree The tree graph holding the
|
|
189
|
-
* @param cpNode The
|
|
188
|
+
* @param cpTree The tree graph holding the `CpNodes` of the MAT.
|
|
189
|
+
* @param cpNode The `CpNode` to remove.
|
|
190
190
|
*/
|
|
191
191
|
removeVertex: typeof removeVertex;
|
|
192
192
|
/**
|
|
193
|
-
* Returns the bezier curve from the maximal disk of the given
|
|
194
|
-
* next
|
|
193
|
+
* Returns the bezier curve from the maximal disk of the given `CpNode` to the
|
|
194
|
+
* next `CpNode`'s maximal disk and thus directly represents a piece of the
|
|
195
195
|
* medial axis.
|
|
196
196
|
* @param cpNode
|
|
197
197
|
*/
|
|
@@ -201,8 +201,8 @@ declare const CpNodeFs: {
|
|
|
201
201
|
getBranchBeziers: typeof getBranchBeziers;
|
|
202
202
|
getSalience: typeof getSalience;
|
|
203
203
|
/**
|
|
204
|
-
* Returns the bezier curve from the maximal disk of one
|
|
205
|
-
*
|
|
204
|
+
* Returns the bezier curve from the maximal disk of one `CpNode` to another
|
|
205
|
+
* `CpNode`'s maximal disk.
|
|
206
206
|
* @param cpNodeFrom
|
|
207
207
|
* @param cpNodeTo
|
|
208
208
|
*/
|
|
@@ -36,7 +36,7 @@ import { getAllVertices } from "./fs/get-all-vertices.js";
|
|
|
36
36
|
const cpNodeComparator = (a, b) => compareCps(a.cp, b.cp);
|
|
37
37
|
const CpNodeFs = {
|
|
38
38
|
/**
|
|
39
|
-
* Returns the children of this
|
|
39
|
+
* Returns the children of this `CpNode` when seen as a MAT edge. Only
|
|
40
40
|
* children in a 'forward' direction are returned. These include all edges
|
|
41
41
|
* except the 'backward' edge given by [[prevOnCircle]], even terminating
|
|
42
42
|
* edges.
|
|
@@ -44,7 +44,7 @@ const CpNodeFs = {
|
|
|
44
44
|
getChildren,
|
|
45
45
|
/**
|
|
46
46
|
* Similar to [[getChildren]] but returns the child nodes of the tree when
|
|
47
|
-
*
|
|
47
|
+
* `CpNode` is seen as a MAT vertex point (as opposed to edge). In this
|
|
48
48
|
* way the dual graph of the tree can easily be traversed - see e.g.
|
|
49
49
|
* [[traverseVertices]]. Generally, however, traversing the edges is
|
|
50
50
|
* preferred as it returns the entire Medial Axis (by utilizing
|
|
@@ -52,7 +52,7 @@ const CpNodeFs = {
|
|
|
52
52
|
*/
|
|
53
53
|
getVertexForwardChildren,
|
|
54
54
|
/**
|
|
55
|
-
* Returns all
|
|
55
|
+
* Returns all `CpNode`s on the MAT that this `CpNode` is part of
|
|
56
56
|
* starting from the current one and going anti-clockwise around the shape.
|
|
57
57
|
*/
|
|
58
58
|
getAllOnLoop,
|
|
@@ -60,18 +60,18 @@ const CpNodeFs = {
|
|
|
60
60
|
* Return this (except if exclThis is truthy) and the the other CpNodes
|
|
61
61
|
* around the maximal disk vertex circle in an anti-clockwise order.
|
|
62
62
|
* @param exclThis If true the returned array does not include this
|
|
63
|
-
*
|
|
63
|
+
* `CpNode`.
|
|
64
64
|
*/
|
|
65
65
|
getAllOnCircle,
|
|
66
66
|
/**
|
|
67
|
-
* Returns true if the 2 given
|
|
67
|
+
* Returns true if the 2 given `CpNode`s are on the same maximal disk
|
|
68
68
|
* circle.
|
|
69
|
-
* @param cpNode1 A
|
|
70
|
-
* @param cpNode2 Another
|
|
69
|
+
* @param cpNode1 A `CpNode`.
|
|
70
|
+
* @param cpNode2 Another `CpNode`
|
|
71
71
|
*/
|
|
72
72
|
isOnSameCircle,
|
|
73
73
|
/**
|
|
74
|
-
* Returns true if this
|
|
74
|
+
* Returns true if this `CpNode` is terminating, i.e. implies a leaf MAT
|
|
75
75
|
* vertex.
|
|
76
76
|
*
|
|
77
77
|
* This is always the case for sharp corners and maximal disks with
|
|
@@ -79,7 +79,7 @@ const CpNodeFs = {
|
|
|
79
79
|
* two contact points stored (sitting 'on top' of each other) for the
|
|
80
80
|
* maximal disk. It can be seen as a limiting case of a two-prong where the
|
|
81
81
|
* distance between two of the contact points tend to zero. One point
|
|
82
|
-
* (represented by a
|
|
82
|
+
* (represented by a `CpNode` of course) will be terminating with the
|
|
83
83
|
* other point being its [[next]], whereas the other point will *not* be
|
|
84
84
|
* terminating and 'points' back into the shape.
|
|
85
85
|
*/
|
|
@@ -90,30 +90,30 @@ const CpNodeFs = {
|
|
|
90
90
|
*/
|
|
91
91
|
isFullyTerminating,
|
|
92
92
|
/**
|
|
93
|
-
* Returns the first
|
|
93
|
+
* Returns the first `CpNode` (from this one by successively applying
|
|
94
94
|
* .nextOnCircle) that exits the circle.
|
|
95
95
|
*/
|
|
96
96
|
getFirstExit,
|
|
97
97
|
/**
|
|
98
|
-
* Returns true if this
|
|
98
|
+
* Returns true if this `CpNode` represents a sharp corner, i.e. the
|
|
99
99
|
* limiting case of a two-prong having zero radius.
|
|
100
100
|
*
|
|
101
|
-
* Note that two
|
|
101
|
+
* Note that two `CpNode`s are stored for each sharp corner, one being
|
|
102
102
|
* terminating and one not. See [[isTerminating]] for more details.
|
|
103
103
|
*/
|
|
104
104
|
isSharp,
|
|
105
105
|
/**
|
|
106
|
-
* Returns true if this
|
|
106
|
+
* Returns true if this `CpNode`'s maximal disk has only one contact point
|
|
107
107
|
* on the shape boundary (up to planar coordinates). These includes sharp
|
|
108
108
|
* corners.
|
|
109
109
|
*
|
|
110
|
-
* Note, however, that two
|
|
110
|
+
* Note, however, that two `CpNode`s are stored for each such point to
|
|
111
111
|
* preserve symmetry - see [[isTerminating]] for more details.
|
|
112
112
|
*/
|
|
113
113
|
isOneProng,
|
|
114
114
|
/**
|
|
115
115
|
* Returns the number of contact points on the maximal disk circle implied
|
|
116
|
-
* by this
|
|
116
|
+
* by this `CpNode`.
|
|
117
117
|
*
|
|
118
118
|
* Note, however, that even one-prongs and sharp corners will return 2 (see
|
|
119
119
|
* [[isTerminating]] for more details); if this is not desired use
|
|
@@ -122,7 +122,7 @@ const CpNodeFs = {
|
|
|
122
122
|
getProngCount,
|
|
123
123
|
/**
|
|
124
124
|
* Returns the number of contact points (up to planar coordinates) on the
|
|
125
|
-
* maximal disk circle implied by this
|
|
125
|
+
* maximal disk circle implied by this `CpNode`.
|
|
126
126
|
*
|
|
127
127
|
* See also [[getProngCount]].
|
|
128
128
|
*/
|
|
@@ -130,8 +130,8 @@ const CpNodeFs = {
|
|
|
130
130
|
/**
|
|
131
131
|
* Primarily for internal use.
|
|
132
132
|
*
|
|
133
|
-
* Compares the order of two
|
|
134
|
-
* on a
|
|
133
|
+
* Compares the order of two `CpNode`s. The order is cyclic and depends
|
|
134
|
+
* on a `CpNode`'s relative position along the shape boundary.
|
|
135
135
|
*/
|
|
136
136
|
cpNodeComparator,
|
|
137
137
|
/**
|
|
@@ -151,26 +151,26 @@ const CpNodeFs = {
|
|
|
151
151
|
traverseCp,
|
|
152
152
|
/**
|
|
153
153
|
* Traverses all edges (depth first) of the given MAT tree starting at the given
|
|
154
|
-
* vertex (represented by a
|
|
155
|
-
* @param cpNode Any
|
|
154
|
+
* vertex (represented by a `CpNode`).
|
|
155
|
+
* @param cpNode Any `CpNode` representing the start vertex.
|
|
156
156
|
* @param traverseEdgesCallback A callback function for each CpNode representing the vertex at the
|
|
157
157
|
* start of an edge.
|
|
158
158
|
*/
|
|
159
159
|
traverseEdges,
|
|
160
160
|
/**
|
|
161
161
|
* Traverses the MAT tree and calls the given callback function for each vertex
|
|
162
|
-
* (represented by a
|
|
162
|
+
* (represented by a `CpNode`) on the MAT.
|
|
163
163
|
*
|
|
164
164
|
* It is usually preferable to use [[traverseEdges]] as it allows for the
|
|
165
165
|
* traversal of all the smooth curves representing the MAT.
|
|
166
|
-
* @param cpNode Any
|
|
167
|
-
* @param traverseVerticesCallback A callback function taking a single
|
|
166
|
+
* @param cpNode Any `CpNode` representing the start vertex.
|
|
167
|
+
* @param traverseVerticesCallback A callback function taking a single `CpNode` as parameter.
|
|
168
168
|
*/
|
|
169
169
|
traverseVertices,
|
|
170
170
|
/**
|
|
171
|
-
* Returns a deep clone of this
|
|
172
|
-
* since cloning a single
|
|
173
|
-
*
|
|
171
|
+
* Returns a deep clone of this `CpNode`. Can be used to copy the MAT
|
|
172
|
+
* since cloning a single `CpNode` necessarily implies cloning all
|
|
173
|
+
* `CpNode`s on the same MAT tree.
|
|
174
174
|
*/
|
|
175
175
|
clone,
|
|
176
176
|
/**
|
|
@@ -187,13 +187,13 @@ const CpNodeFs = {
|
|
|
187
187
|
getBoundaryBeziersToNext,
|
|
188
188
|
/**
|
|
189
189
|
* Removes a cpNode from the MAT.
|
|
190
|
-
* @param cpTree The tree graph holding the
|
|
191
|
-
* @param cpNode The
|
|
190
|
+
* @param cpTree The tree graph holding the `CpNodes` of the MAT.
|
|
191
|
+
* @param cpNode The `CpNode` to remove.
|
|
192
192
|
*/
|
|
193
193
|
removeVertex,
|
|
194
194
|
/**
|
|
195
|
-
* Returns the bezier curve from the maximal disk of the given
|
|
196
|
-
* next
|
|
195
|
+
* Returns the bezier curve from the maximal disk of the given `CpNode` to the
|
|
196
|
+
* next `CpNode`'s maximal disk and thus directly represents a piece of the
|
|
197
197
|
* medial axis.
|
|
198
198
|
* @param cpNode
|
|
199
199
|
*/
|
|
@@ -203,8 +203,8 @@ const CpNodeFs = {
|
|
|
203
203
|
getBranchBeziers,
|
|
204
204
|
getSalience,
|
|
205
205
|
/**
|
|
206
|
-
* Returns the bezier curve from the maximal disk of one
|
|
207
|
-
*
|
|
206
|
+
* Returns the bezier curve from the maximal disk of one `CpNode` to another
|
|
207
|
+
* `CpNode`'s maximal disk.
|
|
208
208
|
* @param cpNodeFrom
|
|
209
209
|
* @param cpNodeTo
|
|
210
210
|
*/
|
|
@@ -5,7 +5,7 @@ import { ContactPoint } from '../contact-point/contact-point.js';
|
|
|
5
5
|
* Since the MAT is a full representation of the shape boundary an instance of
|
|
6
6
|
* this class contains both the information of a boundary point and a medial
|
|
7
7
|
* axis point (and edge to the next point(s)). It also contains edges to other
|
|
8
|
-
*
|
|
8
|
+
* `CpNode`s which allows for traversal of the MAT and thus implictly
|
|
9
9
|
* represents the entire MAT.
|
|
10
10
|
*
|
|
11
11
|
* To get the maximal disk circle (of which the center is on the medial axis)
|
|
@@ -14,7 +14,7 @@ import { ContactPoint } from '../contact-point/contact-point.js';
|
|
|
14
14
|
* To get the boundary point, use [[cp]].pointOnShape.
|
|
15
15
|
*
|
|
16
16
|
* The edge [[next]] (resp. [[prev]]) allows one to move anti-clockwise (resp.
|
|
17
|
-
* clockwise) on the shape boundary to the next
|
|
17
|
+
* clockwise) on the shape boundary to the next `CpNode`. This also imposes a
|
|
18
18
|
* direction of traversal of the MAT edges and vertices.
|
|
19
19
|
*
|
|
20
20
|
* The edge [[nextOnCircle]] (resp. [[prevOnCircle]]) allows one to go
|
|
@@ -24,19 +24,19 @@ import { ContactPoint } from '../contact-point/contact-point.js';
|
|
|
24
24
|
*
|
|
25
25
|
* Call [[getMatCurveBetween]](cpNodeFrom, cpNodeTo) or getMatCurveToNext(cpNode)
|
|
26
26
|
* (replacing the older CpNode.[[matCurveToNextVertex]]) to get a bezier curve
|
|
27
|
-
* from the maximal disk of this
|
|
27
|
+
* from the maximal disk of this `CpNode` to the next `CpNode`'s
|
|
28
28
|
* maximal disk and thus directly representing a piece of the medial axis.
|
|
29
29
|
*
|
|
30
|
-
* The function, [[getChildren]], returns the children of this
|
|
30
|
+
* The function, [[getChildren]], returns the children of this `CpNode` when
|
|
31
31
|
* seen as a MAT edge. Only children in a 'forward' direction are returned. These
|
|
32
32
|
* include all edges except the 'backward' edge given by [[prevOnCircle]]. For
|
|
33
|
-
*
|
|
33
|
+
* `CpNode`s having a maximal disk with 2 contact points (a 2-prong, the usual
|
|
34
34
|
* case) the children will be the single edge [[next]]. For a 3-prong this will
|
|
35
35
|
* be the edges [[next]] and [[nextOnCircle]], etc. [[getChildren]] allows one to
|
|
36
36
|
* easily traverse the MAT tree - see e.g. the implementation of [[traverseEdges]].
|
|
37
37
|
*
|
|
38
38
|
* The getter, [[getVertexForwardChildren]], is similar to [[getChildren]] but returns the
|
|
39
|
-
* child nodes of the tree when
|
|
39
|
+
* child nodes of the tree when `CpNode` is seen as a MAT vertex point (as
|
|
40
40
|
* opposed to edge). In this way the dual graph of the tree can easily be
|
|
41
41
|
* traversed - see e.g. [[traverseVertices]]. Generally, however, traversing the
|
|
42
42
|
* edges is preferred as it returns the entire Medial Axis (by utilizing
|
|
@@ -48,23 +48,23 @@ import { ContactPoint } from '../contact-point/contact-point.js';
|
|
|
48
48
|
* in opposite directions.
|
|
49
49
|
*/
|
|
50
50
|
interface CpNode {
|
|
51
|
-
/** The shape boundary contact point, i.e. a
|
|
51
|
+
/** The shape boundary contact point, i.e. a `CpNode` without its edges. */
|
|
52
52
|
cp: ContactPoint;
|
|
53
|
-
/** If true, this
|
|
53
|
+
/** If true, this `CpNode` belongs to a hole-closing maximal disk. */
|
|
54
54
|
isHoleClosing: boolean;
|
|
55
55
|
/** true if this cpNode is at a shape boundary intersection point, false otherwise */
|
|
56
56
|
isIntersection: boolean;
|
|
57
|
-
/** The previous (going clockwise around the boundary) contact point (
|
|
57
|
+
/** The previous (going clockwise around the boundary) contact point (`CpNode`).*/
|
|
58
58
|
prev: CpNode;
|
|
59
|
-
/** The next (going anti-clockwise around the boundary) contact point (
|
|
59
|
+
/** The next (going anti-clockwise around the boundary) contact point (`CpNode`). */
|
|
60
60
|
next: CpNode;
|
|
61
61
|
/**
|
|
62
|
-
* The previous
|
|
62
|
+
* The previous `CpNode` (going clockwise around the inscribed circle
|
|
63
63
|
* defined by the maximal disk).
|
|
64
64
|
*/
|
|
65
65
|
prevOnCircle: CpNode;
|
|
66
66
|
/**
|
|
67
|
-
* The next
|
|
67
|
+
* The next `CpNode` (going anti-clockwise around
|
|
68
68
|
* the inscribed circle defined by the maximal disk).
|
|
69
69
|
*/
|
|
70
70
|
nextOnCircle: CpNode;
|
|
@@ -77,14 +77,6 @@ interface CpNode {
|
|
|
77
77
|
*/
|
|
78
78
|
holeCloserPrev?: CpNode | undefined;
|
|
79
79
|
/** Only used in export */
|
|
80
|
-
id
|
|
81
|
-
/** Only used in export */
|
|
82
|
-
children?: number[];
|
|
83
|
-
/** Only used in export */
|
|
84
|
-
isRoot?: boolean;
|
|
85
|
-
/** Only used in export */
|
|
86
|
-
parentId?: number;
|
|
87
|
-
/** Only used in export */
|
|
88
|
-
childId?: number;
|
|
80
|
+
id: number;
|
|
89
81
|
}
|
|
90
82
|
export { CpNode };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CpNode } from "../cp-node.js";
|
|
2
2
|
/**
|
|
3
|
-
* Returns a deep clone of this
|
|
4
|
-
* since cloning a single
|
|
5
|
-
*
|
|
3
|
+
* Returns a deep clone of this `CpNode`. Can be used to copy the MAT
|
|
4
|
+
* since cloning a single `CpNode` necessarily implies cloning all
|
|
5
|
+
* `CpNode`s on the same MAT tree.
|
|
6
6
|
*/
|
|
7
7
|
declare function clone(cpNode: CpNode): CpNode;
|
|
8
8
|
export { clone };
|
package/node/cp-node/fs/clone.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @internal */
|
|
2
2
|
const EDGES = ['prev', 'next', 'prevOnCircle', 'nextOnCircle'];
|
|
3
3
|
/**
|
|
4
|
-
* Returns a deep clone of this
|
|
5
|
-
* since cloning a single
|
|
6
|
-
*
|
|
4
|
+
* Returns a deep clone of this `CpNode`. Can be used to copy the MAT
|
|
5
|
+
* since cloning a single `CpNode` necessarily implies cloning all
|
|
6
|
+
* `CpNode`s on the same MAT tree.
|
|
7
7
|
*/
|
|
8
8
|
function clone(cpNode) {
|
|
9
9
|
// Don't change this function to be recursive, the call stack may
|
|
@@ -25,10 +25,6 @@ declare function enhanceCpNode(cpNode: CpNode): {
|
|
|
25
25
|
nextOnCircle: CpNode;
|
|
26
26
|
holeCloserNext?: CpNode | undefined;
|
|
27
27
|
holeCloserPrev?: CpNode | undefined;
|
|
28
|
-
id
|
|
29
|
-
children?: number[];
|
|
30
|
-
isRoot?: boolean;
|
|
31
|
-
parentId?: number;
|
|
32
|
-
childId?: number;
|
|
28
|
+
id: number;
|
|
33
29
|
};
|
|
34
30
|
export { enhanceCpNode };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enhance-cp-node.js","sourceRoot":"","sources":["../../../src/cp-node/fs/enhance-cp-node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"enhance-cp-node.js","sourceRoot":"","sources":["../../../src/cp-node/fs/enhance-cp-node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,SAAS,aAAa,CAAC,MAAc;IACjC,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;IACrB,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC;IAC5B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IAExB,OAAO;QACH,GAAG,MAAM;QACT,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC,YAAY;QAC3B,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;QAC3B,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;QAC3B,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC;QACpC,kBAAkB,EAAE,kBAAkB,CAAC,MAAM,CAAC;QAC9C,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC;QACxB,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC;QACjC,iBAAiB,EAAE,iBAAiB,CAAC,MAAM,CAAC;QAC5C,QAAQ,EAAE,iBAAiB,CAAC,MAAM,CAAC;QACnC,KAAK;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;KACnB,CAAA;AACL,CAAC;AAGD,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { CpNode } from "../cp-node.js";
|
|
2
2
|
/**
|
|
3
|
-
* Returns all `CpNode`s between the two given ones (
|
|
3
|
+
* Returns all `CpNode`s between the two given ones (excluding the last one).
|
|
4
4
|
*
|
|
5
5
|
* * If the second `CpNode` is never encountered all on the loop will be
|
|
6
6
|
* returned.
|
|
7
7
|
*
|
|
8
|
-
* @param cpNodeS
|
|
9
|
-
* @param cpNodeE
|
|
8
|
+
* @param cpNodeS start `CpNode`
|
|
9
|
+
* @param cpNodeE end `CpNode`
|
|
10
10
|
* @param inclAllIfEqual if `true` and first and last `CpNode`s are equal then
|
|
11
11
|
* include all `CpNode`s around the loop, otherwise include none.
|
|
12
12
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Returns all `CpNode`s between the two given ones (
|
|
2
|
+
* Returns all `CpNode`s between the two given ones (excluding the last one).
|
|
3
3
|
*
|
|
4
4
|
* * If the second `CpNode` is never encountered all on the loop will be
|
|
5
5
|
* returned.
|
|
6
6
|
*
|
|
7
|
-
* @param cpNodeS
|
|
8
|
-
* @param cpNodeE
|
|
7
|
+
* @param cpNodeS start `CpNode`
|
|
8
|
+
* @param cpNodeE end `CpNode`
|
|
9
9
|
* @param inclAllIfEqual if `true` and first and last `CpNode`s are equal then
|
|
10
10
|
* include all `CpNode`s around the loop, otherwise include none.
|
|
11
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-all-between.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-all-between.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,SAAS,aAAa,
|
|
1
|
+
{"version":3,"file":"get-all-between.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-all-between.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,SAAS,aAAa,CACd,OAAe,EACf,OAAe,EACf,cAAc,GAAG,IAAI;IAKzB,IAAI,CAAC,cAAc,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACzC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,CAAA;IAChD,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC;IACxB,MAAM,OAAO,GAAa,CAAC,OAAO,CAAC,CAAC;IAEpC,IAAI,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAC3B,IAAI,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAE1C,OAAO,OAAO,KAAK,OAAO;QACnB,OAAO,KAAK,OAAO,EAAE,CAAC;QAEzB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YACxB,aAAa,GAAG,IAAI,CAAC;QACzB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;AACtC,CAAC;AAGD,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import { CpNode } from "../cp-node.js";
|
|
1
|
+
import type { CpNode } from "../cp-node.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns all the `CpNode`s on the same circle.
|
|
4
|
+
*
|
|
5
|
+
* @param cpNode
|
|
6
|
+
* @param exclThis
|
|
7
|
+
*/
|
|
2
8
|
declare function getAllOnCircle(cpNode: CpNode, exclThis?: boolean): CpNode[];
|
|
3
9
|
export { getAllOnCircle };
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns all the `CpNode`s on the same circle.
|
|
3
|
+
*
|
|
4
|
+
* @param cpNode
|
|
5
|
+
* @param exclThis
|
|
6
|
+
*/
|
|
1
7
|
function getAllOnCircle(cpNode, exclThis = false) {
|
|
2
8
|
const startCpNode = cpNode;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
cpNodes.push(cpNode_);
|
|
8
|
-
}
|
|
9
|
+
const cpNodes = exclThis ? [] : [cpNode];
|
|
10
|
+
let cpNode_ = cpNode.nextOnCircle;
|
|
11
|
+
while (cpNode_ !== startCpNode) {
|
|
12
|
+
cpNodes.push(cpNode_);
|
|
9
13
|
cpNode_ = cpNode_.nextOnCircle;
|
|
10
|
-
}
|
|
14
|
+
}
|
|
11
15
|
return cpNodes;
|
|
12
16
|
}
|
|
13
17
|
export { getAllOnCircle };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-all-on-circle.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-all-on-circle.ts"],"names":[],"mappings":"AAGA,SAAS,cAAc,CACf,MAAc,EACd,QAAQ,GAAG,KAAK;IAEpB,MAAM,WAAW,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"get-all-on-circle.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-all-on-circle.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,SAAS,cAAc,CACf,MAAc,EACd,QAAQ,GAAG,KAAK;IAEpB,MAAM,WAAW,GAAG,MAAM,CAAC;IAE3B,MAAM,OAAO,GAAa,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAEnD,IAAI,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC;IAClC,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QAC7B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC;IACnC,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAGD,OAAO,EAAE,cAAc,EAAE,CAAA"}
|