flo-mat 4.1.1 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/index.js +137 -2
- package/browser/index.min.js +1 -1
- package/node/cp-node/stringification/cp-node-stringifyable.d.ts +29 -0
- package/node/cp-node/stringification/cp-node-stringifyable.js +7 -0
- package/node/cp-node/stringification/cp-node-stringifyable.js.map +1 -0
- package/node/cp-node/stringification/from-stringifyable.d.ts +4 -0
- package/node/cp-node/stringification/from-stringifyable.js +43 -0
- package/node/cp-node/stringification/from-stringifyable.js.map +1 -0
- package/node/cp-node/stringification/loop-from-stringifyable.d.ts +4 -0
- package/node/cp-node/stringification/loop-from-stringifyable.js +7 -0
- package/node/cp-node/stringification/loop-from-stringifyable.js.map +1 -0
- package/node/cp-node/stringification/loop-stringifyable.d.ts +5 -0
- package/node/cp-node/stringification/loop-stringifyable.js +2 -0
- package/node/cp-node/stringification/loop-stringifyable.js.map +1 -0
- package/node/cp-node/stringification/loop-to-stringifyable.d.ts +4 -0
- package/node/cp-node/stringification/loop-to-stringifyable.js +6 -0
- package/node/cp-node/stringification/loop-to-stringifyable.js.map +1 -0
- package/node/cp-node/stringification/to-stringifyable.d.ts +9 -0
- package/node/cp-node/stringification/to-stringifyable.js +46 -0
- package/node/cp-node/stringification/to-stringifyable.js.map +1 -0
- package/node/index.d.ts +5 -0
- package/node/index.js +5 -0
- package/node/index.js.map +1 -1
- package/node/mat/get-branches.js.map +1 -1
- package/node/mat/get-largest-3-prong.d.ts +3 -0
- package/node/mat/get-largest-3-prong.js +16 -0
- package/node/mat/get-largest-3-prong.js.map +1 -0
- package/node/mat/get-largest-vertex.d.ts +0 -1
- package/node/mat/get-largest-vertex.js +0 -1
- package/node/mat/get-largest-vertex.js.map +1 -1
- package/package.json +1 -1
- package/src/cp-node/stringification/from-stringifyable.ts +2 -2
- package/src/cp-node/stringification/to-stringifyable.ts +2 -2
- package/src/index.ts +6 -1
- package/src/mat/get-branches.ts +1 -3
- package/src/mat/get-largest-3-prong.ts +3 -2
- package/src/mat/get-largest-vertex.ts +3 -2
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PointOnShape } from "../../point-on-shape/point-on-shape";
|
|
2
|
+
import type { CpNode } from "../cp-node";
|
|
3
|
+
import type { LoopStringifyable } from "./loop-stringifyable";
|
|
4
|
+
/** @internal */
|
|
5
|
+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
6
|
+
/** @internal */
|
|
7
|
+
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
8
|
+
/** @internal */
|
|
9
|
+
type Edge = 'prev' | 'next' | 'prevOnCircle' | 'nextOnCircle' | 'holeCloserTwin';
|
|
10
|
+
/** @internal */
|
|
11
|
+
type PointOnShapeSimplified = Omit<PointOnShape, 'curve'> & {
|
|
12
|
+
readonly loopIdx: number;
|
|
13
|
+
readonly curveIdx: number;
|
|
14
|
+
};
|
|
15
|
+
/** @internal */
|
|
16
|
+
type CpNodeSimplified = Omit<CpNode, 'pointOnShape'> & {
|
|
17
|
+
readonly pointOnShape: PointOnShapeSimplified;
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
type CpNodeSimplifiedEdgeless = Omit<CpNodeSimplified, Edge>;
|
|
21
|
+
/** @internal */
|
|
22
|
+
type CpNodeWithAnyEdges = PartialBy<CpNodeSimplifiedEdgeless & Record<Edge, CpNode | number>, 'holeCloserTwin'>;
|
|
23
|
+
interface CpNodeStringifyable {
|
|
24
|
+
readonly cpNodes: CpNodeWithAnyEdges[];
|
|
25
|
+
readonly loops: LoopStringifyable[];
|
|
26
|
+
}
|
|
27
|
+
declare const EDGES: Edge[];
|
|
28
|
+
export { EDGES };
|
|
29
|
+
export type { PointOnShapeSimplified, CpNodeSimplified, CpNodeSimplifiedEdgeless, CpNodeStringifyable, CpNodeWithAnyEdges, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cp-node-stringifyable.js","sourceRoot":"","sources":["../../../src/cp-node/stringification/cp-node-stringifyable.ts"],"names":[],"mappings":"AA8CA,MAAM,KAAK,GAAW;IAClB,MAAM,EAAE,MAAM;IACd,cAAc,EAAE,cAAc;IAC9B,gBAAgB;CACnB,CAAC;AAGF,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EDGES } from "./cp-node-stringifyable";
|
|
2
|
+
import { loopFromStringifyable } from './loop-from-stringifyable.js';
|
|
3
|
+
function fromStringifyable(cpNodesStringifyable) {
|
|
4
|
+
const { cpNodes: _cpNodes, loops: _loops } = cpNodesStringifyable;
|
|
5
|
+
const loops = _loops.map(loopFromStringifyable);
|
|
6
|
+
//--------------------------------------------------------------------------
|
|
7
|
+
// First pass: build all CpNode objects with proper `cp`.
|
|
8
|
+
// Edges still hold number ids at this point.
|
|
9
|
+
//--------------------------------------------------------------------------
|
|
10
|
+
const cpNodes = _cpNodes.map(cpNode_ => {
|
|
11
|
+
const { id, pointOnShape, isHoleClosing, isIntersection } = cpNode_;
|
|
12
|
+
const { circle, order, order2 } = pointOnShape;
|
|
13
|
+
const { curveIdx, loopIdx, p, pDd, t, isSource } = pointOnShape;
|
|
14
|
+
const curve = loops[loopIdx].curves[curveIdx];
|
|
15
|
+
const pointOnShape_ = {
|
|
16
|
+
circle,
|
|
17
|
+
curve, p, pDd, t, isSource,
|
|
18
|
+
order, order2
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
...cpNode_,
|
|
22
|
+
id, isHoleClosing, isIntersection,
|
|
23
|
+
pointOnShape: pointOnShape_
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
//--------------------------------------------------------------------------
|
|
27
|
+
// Second pass: replace number id edges with real CpNode references.
|
|
28
|
+
//--------------------------------------------------------------------------
|
|
29
|
+
const nodeMap = new Map(cpNodes.map(n => [n.id, n]));
|
|
30
|
+
for (const cpNode of cpNodes) {
|
|
31
|
+
for (const edge of EDGES) {
|
|
32
|
+
const id = cpNode[edge];
|
|
33
|
+
if (id === undefined) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
cpNode[edge] = nodeMap.get(id);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return cpNodes[0];
|
|
41
|
+
}
|
|
42
|
+
export { fromStringifyable };
|
|
43
|
+
//# sourceMappingURL=from-stringifyable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"from-stringifyable.js","sourceRoot":"","sources":["../../../src/cp-node/stringification/from-stringifyable.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,SAAS,iBAAiB,CAClB,oBAAyC;IAE7C,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAAC;IAClE,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAEhD,4EAA4E;IAC5E,yDAAyD;IACzD,6CAA6C;IAC7C,4EAA4E;IAC5E,MAAM,OAAO,GAAa,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QAC7C,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;QACpE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC;QAC/C,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC;QAEhE,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAE9C,MAAM,aAAa,GAAiB;YAChC,MAAM;YACN,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ;YAC1B,KAAK,EAAE,MAAM;SAChB,CAAC;QAEF,OAAO;YACH,GAAG,OAAO;YACV,EAAE,EAAE,aAAa,EAAE,cAAc;YACjC,YAAY,EAAE,aAAa;SACpB,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,4EAA4E;IAC5E,oEAAoE;IACpE,4EAA4E;IAC5E,MAAM,OAAO,GAAG,IAAI,GAAG,CAAiB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAErE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAkC,CAAC;YACzD,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;gBAAC,SAAS;YAAC,CAAC;YAEnC,aAAa;YACb,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAE,CAAC;QACpC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC;AAGD,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { loopFromBeziers } from "flo-boolean";
|
|
2
|
+
function loopFromStringifyable(loopStringifyable) {
|
|
3
|
+
const { idx, beziers } = loopStringifyable;
|
|
4
|
+
return loopFromBeziers(beziers, idx);
|
|
5
|
+
}
|
|
6
|
+
export { loopFromStringifyable };
|
|
7
|
+
//# sourceMappingURL=loop-from-stringifyable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-from-stringifyable.js","sourceRoot":"","sources":["../../../src/cp-node/stringification/loop-from-stringifyable.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,SAAS,qBAAqB,CACtB,iBAAoC;IAExC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC;IAE3C,OAAO,eAAe,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACzC,CAAC;AAGD,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-stringifyable.js","sourceRoot":"","sources":["../../../src/cp-node/stringification/loop-stringifyable.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-to-stringifyable.js","sourceRoot":"","sources":["../../../src/cp-node/stringification/loop-to-stringifyable.ts"],"names":[],"mappings":"AAIA,SAAS,mBAAmB,CACpB,IAAU;IAEd,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAE9B,OAAO,EAAE,GAAG,EAAE,GAAI,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC;AAGD,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CpNodeStringifyable } from "./cp-node-stringifyable.js";
|
|
2
|
+
import type { CpNode } from "../cp-node.js";
|
|
3
|
+
/**
|
|
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
|
+
*/
|
|
8
|
+
declare function toStringifyable(cpNode: CpNode): CpNodeStringifyable;
|
|
9
|
+
export { toStringifyable };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { loopToStringifyable } from "./loop-to-stringifyable.js";
|
|
2
|
+
/**
|
|
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
|
+
*/
|
|
7
|
+
function toStringifyable(cpNode) {
|
|
8
|
+
const cpNodes_ = [];
|
|
9
|
+
const loopSet = new Set();
|
|
10
|
+
//--------------------------------------------------------------------------
|
|
11
|
+
// Clone `CpNode`s with edges replaced with ids AND
|
|
12
|
+
// set the `nodeMap` to map original `CpNode`s to their ids.
|
|
13
|
+
//--------------------------------------------------------------------------
|
|
14
|
+
const cpStart = cpNode;
|
|
15
|
+
do {
|
|
16
|
+
const { id, isHoleClosing, isIntersection, pointOnShape, prev, next, nextOnCircle, prevOnCircle, holeCloserTwin, } = cpNode;
|
|
17
|
+
const { curve, p, pDd, t, isSource, circle, order, order2 } = pointOnShape;
|
|
18
|
+
const { idx: curveIdx, loop, ps, prev: prevCurve, next: nextCurve } = curve;
|
|
19
|
+
if (!loopSet.has(loop)) {
|
|
20
|
+
loopSet.add(loop);
|
|
21
|
+
}
|
|
22
|
+
const posSimplified = {
|
|
23
|
+
curveIdx, loopIdx: loop.idx, p, t, isSource,
|
|
24
|
+
circle, order, order2, pDd,
|
|
25
|
+
};
|
|
26
|
+
cpNodes_.push({
|
|
27
|
+
id, isHoleClosing, isIntersection,
|
|
28
|
+
pointOnShape: posSimplified,
|
|
29
|
+
prev: prev.id,
|
|
30
|
+
next: next.id,
|
|
31
|
+
prevOnCircle: prevOnCircle.id,
|
|
32
|
+
nextOnCircle: nextOnCircle.id,
|
|
33
|
+
holeCloserTwin: holeCloserTwin?.id
|
|
34
|
+
});
|
|
35
|
+
cpNode = cpNode.next;
|
|
36
|
+
} while (cpNode !== cpStart);
|
|
37
|
+
//--------------------------------------------------------------------------
|
|
38
|
+
const loops = Array.from(loopSet).sort((a, b) => a.idx - b.idx);
|
|
39
|
+
const loops_ = loops.map(loopToStringifyable);
|
|
40
|
+
return {
|
|
41
|
+
cpNodes: cpNodes_,
|
|
42
|
+
loops: loops_
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export { toStringifyable };
|
|
46
|
+
//# sourceMappingURL=to-stringifyable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-stringifyable.js","sourceRoot":"","sources":["../../../src/cp-node/stringification/to-stringifyable.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE;;;;GAIG;AACH,SAAS,eAAe,CAChB,MAAc;IAElB,MAAM,QAAQ,GAAyB,EAAE,CAAC;IAC1C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAQ,CAAC;IAEhC,4EAA4E;IAC5E,mDAAmD;IACnD,4DAA4D;IAC5D,4EAA4E;IAC5E,MAAM,OAAO,GAAG,MAAM,CAAC;IACvB,GAAG,CAAC;QACA,MAAM,EACF,EAAE,EAAE,aAAa,EAAE,cAAc,EACjC,YAAY,EACZ,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,GACzD,GAAG,MAAM,CAAA;QAEV,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC;QAC3E,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;QAE5E,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;QAED,MAAM,aAAa,GAA2B;YAC1C,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,GAAI,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ;YAC5C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG;SAC7B,CAAC;QAEF,QAAQ,CAAC,IAAI,CAAC;YACV,EAAE,EAAE,aAAa,EAAE,cAAc;YACjC,YAAY,EAAE,aAAa;YAC3B,IAAI,EAAE,IAAI,CAAC,EAAE;YACb,IAAI,EAAE,IAAI,CAAC,EAAE;YACb,YAAY,EAAE,YAAY,CAAC,EAAE;YAC7B,YAAY,EAAE,YAAY,CAAC,EAAE;YAC7B,cAAc,EAAE,cAAc,EAAE,EAAE;SACrC,CAAC,CAAC;QAEH,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;IACzB,CAAC,QAAQ,MAAM,KAAK,OAAO,EAAE;IAC7B,4EAA4E;IAE5E,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAI,GAAG,CAAC,CAAC,GAAI,CAAC,CAAC;IAClE,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAE9C,OAAO;QACH,OAAO,EAAE,QAAQ;QACjB,KAAK,EAAE,MAAM;KAChB,CAAC;AACN,CAAC;AAGD,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
package/node/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export { findMats } from './find-mat/find-mats.js';
|
|
|
16
16
|
export { trimMat } from './mat/trim-mat.js';
|
|
17
17
|
export { toScaleAxis } from './sat/to-scale-axis.js';
|
|
18
18
|
export { getBranches } from './mat/get-branches.js';
|
|
19
|
+
export { getLargestVertex } from './mat/get-largest-vertex.js';
|
|
20
|
+
export { getLargest3Prong } from './mat/get-largest-3-prong.js';
|
|
19
21
|
export { enableDebugForMat } from './debug/debug.js';
|
|
20
22
|
export { getShapeBounds } from './svg/get-shape-bounds.js';
|
|
21
23
|
export { getBoundaryPieceBeziers } from './mat/get-boundary-piece-beziers.js';
|
|
@@ -35,6 +37,8 @@ export { getPartialMeta } from './find-mat/get-meta.js';
|
|
|
35
37
|
export { findAndAddHoleClosing2Prongs } from './find-2-prong/find-and-add-hole-closing-2-prongs.js';
|
|
36
38
|
export { reconstructFromMats } from './reconstruct-from-mat/reconstruct-from-mat.js';
|
|
37
39
|
export { getOsculatingCircle } from './point-on-shape/get-osculating-circle.js';
|
|
40
|
+
export { toStringifyable } from './cp-node/stringification/to-stringifyable.js';
|
|
41
|
+
export { fromStringifyable } from './cp-node/stringification/from-stringifyable.js';
|
|
38
42
|
export { getChildren } from './cp-node/fs/get-children.js';
|
|
39
43
|
export { getVertexForwardChildren } from './cp-node/fs/get-vertex-forward-children.js';
|
|
40
44
|
export { getAllOnLoop } from './cp-node/fs/get-all-on-loop.js';
|
|
@@ -72,3 +76,4 @@ export { isTrivial } from './cp-node/fs/is-trivial.js';
|
|
|
72
76
|
export { scaleCircle } from './geometry/circle.js';
|
|
73
77
|
export { isOnSameLoop } from './cp-node/fs/is-on-same-loop.js';
|
|
74
78
|
export { getAllOnLoop_ByLoop } from './cp-node/fs/get-all-on-loop-by-loop.js';
|
|
79
|
+
export { getNonTerminatingOnCircle } from './cp-node/fs/get-non-terminating-on-circle.js';
|
package/node/index.js
CHANGED
|
@@ -6,6 +6,8 @@ export { findMats } from './find-mat/find-mats.js';
|
|
|
6
6
|
export { trimMat } from './mat/trim-mat.js';
|
|
7
7
|
export { toScaleAxis } from './sat/to-scale-axis.js';
|
|
8
8
|
export { getBranches } from './mat/get-branches.js';
|
|
9
|
+
export { getLargestVertex } from './mat/get-largest-vertex.js';
|
|
10
|
+
export { getLargest3Prong } from './mat/get-largest-3-prong.js';
|
|
9
11
|
export { enableDebugForMat } from './debug/debug.js';
|
|
10
12
|
export { getShapeBounds } from './svg/get-shape-bounds.js';
|
|
11
13
|
export { getBoundaryPieceBeziers } from './mat/get-boundary-piece-beziers.js';
|
|
@@ -25,6 +27,8 @@ export { getPartialMeta } from './find-mat/get-meta.js';
|
|
|
25
27
|
export { findAndAddHoleClosing2Prongs } from './find-2-prong/find-and-add-hole-closing-2-prongs.js';
|
|
26
28
|
export { reconstructFromMats } from './reconstruct-from-mat/reconstruct-from-mat.js';
|
|
27
29
|
export { getOsculatingCircle } from './point-on-shape/get-osculating-circle.js';
|
|
30
|
+
export { toStringifyable } from './cp-node/stringification/to-stringifyable.js';
|
|
31
|
+
export { fromStringifyable } from './cp-node/stringification/from-stringifyable.js';
|
|
28
32
|
// CpNodeFs functions
|
|
29
33
|
export { getChildren } from './cp-node/fs/get-children.js';
|
|
30
34
|
export { getVertexForwardChildren } from './cp-node/fs/get-vertex-forward-children.js';
|
|
@@ -63,4 +67,5 @@ export { isTrivial } from './cp-node/fs/is-trivial.js';
|
|
|
63
67
|
export { scaleCircle } from './geometry/circle.js';
|
|
64
68
|
export { isOnSameLoop } from './cp-node/fs/is-on-same-loop.js';
|
|
65
69
|
export { getAllOnLoop_ByLoop } from './cp-node/fs/get-all-on-loop-by-loop.js';
|
|
70
|
+
export { getNonTerminatingOnCircle } from './cp-node/fs/get-non-terminating-on-circle.js';
|
|
66
71
|
//# sourceMappingURL=index.js.map
|
package/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAYpF,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,E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QAE3B,MAAM,SAAS,GAAG,yBAAyB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC3D,MAAM,SAAS,GAAG,yBAAyB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QAExE,KAAK,MAAM,MAAM,IAAI,QAAQ,EAAE,CAAC;YAC5B,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC;QACD,KAAK,MAAM,MAAM,IAAI,QAAQ,EAAE,CAAC;YAC5B,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC;QAED,WAAW,CAAC,IAAI,CAAC,GAAG,QAAQ,EAAE,GAAG,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAGD,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getAllOnLoop } from '../cp-node/fs/get-all-on-loop.js';
|
|
2
|
+
import { getRealProngCount } from '../cp-node/fs/get-real-prong-count.js';
|
|
3
|
+
function getLargest3Prong(cpNode) {
|
|
4
|
+
const cpNodes = getAllOnLoop(cpNode)
|
|
5
|
+
.filter(cpNode => getRealProngCount(cpNode) >= 3);
|
|
6
|
+
if (cpNodes.length === 0) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
return cpNodes.reduce(function (maxCpNode, cpNode) {
|
|
10
|
+
return maxCpNode.pointOnShape.circle.radius >= cpNode.pointOnShape.circle.radius
|
|
11
|
+
? maxCpNode
|
|
12
|
+
: cpNode;
|
|
13
|
+
}, cpNodes[0]);
|
|
14
|
+
}
|
|
15
|
+
export { getLargest3Prong };
|
|
16
|
+
//# sourceMappingURL=get-largest-3-prong.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-largest-3-prong.js","sourceRoot":"","sources":["../../src/mat/get-largest-3-prong.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAG1E,SAAS,gBAAgB,CACjB,MAAc;IAElB,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC;SAC/B,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAEtD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAAC,OAAO,SAAS,CAAC;IAAC,CAAC;IAE/C,OAAO,OAAO,CAAC,MAAM,CAAC,UAAS,SAAiB,EAAE,MAAc;QAC5D,OAAO,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM;YAC5E,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,MAAM,CAAA;IAChB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-largest-vertex.js","sourceRoot":"","sources":["../../src/mat/get-largest-vertex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGhE,
|
|
1
|
+
{"version":3,"file":"get-largest-vertex.js","sourceRoot":"","sources":["../../src/mat/get-largest-vertex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGhE,SAAS,gBAAgB,CACjB,MAAc;IAElB,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAErC,OAAO,OAAO,CAAC,MAAM,CAAC,UAAS,SAAiB,EAAE,MAAc;QAC5D,OAAO,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM;YAC5E,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,MAAM,CAAA;IAChB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -18,13 +18,13 @@ function fromStringifyable(
|
|
|
18
18
|
const cpNodes: CpNode[] = _cpNodes.map(cpNode_ => {
|
|
19
19
|
const { id, pointOnShape, isHoleClosing, isIntersection } = cpNode_;
|
|
20
20
|
const { circle, order, order2 } = pointOnShape;
|
|
21
|
-
const { curveIdx, loopIdx, p, t, isSource } = pointOnShape;
|
|
21
|
+
const { curveIdx, loopIdx, p, pDd, t, isSource } = pointOnShape;
|
|
22
22
|
|
|
23
23
|
const curve = loops[loopIdx].curves[curveIdx];
|
|
24
24
|
|
|
25
25
|
const pointOnShape_: PointOnShape = {
|
|
26
26
|
circle,
|
|
27
|
-
curve, p, t, isSource,
|
|
27
|
+
curve, p, pDd, t, isSource,
|
|
28
28
|
order, order2
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -27,7 +27,7 @@ function toStringifyable(
|
|
|
27
27
|
prev, next, nextOnCircle, prevOnCircle, holeCloserTwin,
|
|
28
28
|
} = cpNode
|
|
29
29
|
|
|
30
|
-
const { curve, p, t, isSource, circle, order, order2 } = pointOnShape;
|
|
30
|
+
const { curve, p, pDd, t, isSource, circle, order, order2 } = pointOnShape;
|
|
31
31
|
const { idx: curveIdx, loop, ps, prev: prevCurve, next: nextCurve } = curve;
|
|
32
32
|
|
|
33
33
|
if (!loopSet.has(loop)) {
|
|
@@ -36,7 +36,7 @@ function toStringifyable(
|
|
|
36
36
|
|
|
37
37
|
const posSimplified: PointOnShapeSimplified = {
|
|
38
38
|
curveIdx, loopIdx: loop.idx!, p, t, isSource,
|
|
39
|
-
circle, order, order2
|
|
39
|
+
circle, order, order2, pDd,
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
cpNodes_.push({
|
package/src/index.ts
CHANGED
|
@@ -18,6 +18,8 @@ export { findMats } from './find-mat/find-mats.js';
|
|
|
18
18
|
export { trimMat } from './mat/trim-mat.js';
|
|
19
19
|
export { toScaleAxis } from './sat/to-scale-axis.js';
|
|
20
20
|
export { getBranches } from './mat/get-branches.js';
|
|
21
|
+
export { getLargestVertex } from './mat/get-largest-vertex.js';
|
|
22
|
+
export { getLargest3Prong } from './mat/get-largest-3-prong.js';
|
|
21
23
|
export { enableDebugForMat } from './debug/debug.js';
|
|
22
24
|
export { getShapeBounds } from './svg/get-shape-bounds.js';
|
|
23
25
|
export { getBoundaryPieceBeziers } from './mat/get-boundary-piece-beziers.js';
|
|
@@ -37,6 +39,8 @@ export { getPartialMeta } from './find-mat/get-meta.js';
|
|
|
37
39
|
export { findAndAddHoleClosing2Prongs } from './find-2-prong/find-and-add-hole-closing-2-prongs.js';
|
|
38
40
|
export { reconstructFromMats } from './reconstruct-from-mat/reconstruct-from-mat.js';
|
|
39
41
|
export { getOsculatingCircle } from './point-on-shape/get-osculating-circle.js';
|
|
42
|
+
export { toStringifyable } from './cp-node/stringification/to-stringifyable.js';
|
|
43
|
+
export { fromStringifyable } from './cp-node/stringification/from-stringifyable.js';
|
|
40
44
|
|
|
41
45
|
|
|
42
46
|
// CpNodeFs functions
|
|
@@ -76,4 +80,5 @@ export { getAllVertices } from './cp-node/fs/get-all-vertices.js';
|
|
|
76
80
|
export { isTrivial } from './cp-node/fs/is-trivial.js';
|
|
77
81
|
export { scaleCircle } from './geometry/circle.js';
|
|
78
82
|
export { isOnSameLoop } from './cp-node/fs/is-on-same-loop.js';
|
|
79
|
-
export { getAllOnLoop_ByLoop } from './cp-node/fs/get-all-on-loop-by-loop.js';
|
|
83
|
+
export { getAllOnLoop_ByLoop } from './cp-node/fs/get-all-on-loop-by-loop.js';
|
|
84
|
+
export { getNonTerminatingOnCircle } from './cp-node/fs/get-non-terminating-on-circle.js';
|
package/src/mat/get-branches.ts
CHANGED
|
@@ -3,8 +3,9 @@ import { getAllOnLoop } from '../cp-node/fs/get-all-on-loop.js';
|
|
|
3
3
|
import { getRealProngCount } from '../cp-node/fs/get-real-prong-count.js';
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
function getLargest3Prong(
|
|
7
|
+
cpNode: CpNode) {
|
|
8
|
+
|
|
8
9
|
const cpNodes = getAllOnLoop(cpNode)
|
|
9
10
|
.filter(cpNode => getRealProngCount(cpNode) >= 3);
|
|
10
11
|
|
|
@@ -2,8 +2,9 @@ import type { CpNode } from '../cp-node/cp-node.js';
|
|
|
2
2
|
import { getAllOnLoop } from '../cp-node/fs/get-all-on-loop.js';
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
function getLargestVertex(
|
|
6
|
+
cpNode: CpNode) {
|
|
7
|
+
|
|
7
8
|
const cpNodes = getAllOnLoop(cpNode);
|
|
8
9
|
|
|
9
10
|
return cpNodes.reduce(function(maxCpNode: CpNode, cpNode: CpNode) {
|