flo-mat 4.1.0 → 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/__tests__/helpers/jest.setup.ts +35 -0
- package/__tests__/specific-cases/specific-cases.spec.ts +1 -1
- package/browser/index.js +10665 -10243
- package/browser/index.min.js +1 -1
- package/node/cp-node/fs/get-implied-boundary-bezier-between.js.map +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/find-mat/find-mats.js +3 -1
- package/node/find-mat/find-mats.js.map +1 -1
- 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 +14 -14
- package/src/cp-node/fs/get-implied-boundary-bezier-between.ts +0 -1
- package/src/cp-node/stringification/from-stringifyable.ts +2 -2
- package/src/cp-node/stringification/to-stringifyable.ts +2 -2
- package/src/find-mat/find-mats.ts +3 -1
- 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
- package/src/debug/functions/draw/draw-bezier-pieces.ts +0 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-implied-boundary-bezier-between.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-implied-boundary-bezier-between.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"get-implied-boundary-bezier-between.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-implied-boundary-bezier-between.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EACH,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,YAAY,EACpE,MAAM,cAAc,CAAC;AAItB,gBAAgB;AAChB,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,gBAAgB;AAChB,MAAM,kBAAkB,GAAG,MAAM,CAAC,CAAC,aAAa;AAGhD,SAAS,+BAA+B,CAChC,OAAe,EACf,OAAe;IAEnB,MAAM,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC;IAElC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;IAC3C,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,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
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-st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AI,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"}
|
|
@@ -39,7 +39,9 @@ function findMats(bezierLoops, options) {
|
|
|
39
39
|
...(options || {})
|
|
40
40
|
});
|
|
41
41
|
const { applySat, simplify, satScale, simplifyTolerance } = options_;
|
|
42
|
-
const loopss = simplifyPaths(bezierLoops,
|
|
42
|
+
const loopss = simplifyPaths(bezierLoops, {
|
|
43
|
+
forceOrientationNegative: true,
|
|
44
|
+
});
|
|
43
45
|
// console.log(loopsToSvgPathStr(bezierLoops));
|
|
44
46
|
const mats = [];
|
|
45
47
|
for (const loops of loopss) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-mats.js","sourceRoot":"","sources":["../../src/find-mat/find-mats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,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AClB,KAAqB;IAEzB,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,GAAG,GAAG,GAAG,GAAG,mBAAmB,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACjD,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAGD,OAAO,EAAE,QAAQ,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,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAC;AACnG,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,E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AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-branches.js","sourceRoot":"","sources":["../../src/mat/get-branches.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAC;AAG3F;;;;;;GAMG;AACH,SAAS,WAAW,CACZ,MAAc;IAElB,MAAM,QAAQ,GAAe,EAAE,CAAC;IAChC,MAAM,WAAW,GAAa,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,aAAa,GAAgB,IAAI,GAAG,EAAE,CAAC;IAC7C,OAAO,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAG,CAAC;QAClC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAEjC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"get-branches.js","sourceRoot":"","sources":["../../src/mat/get-branches.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,yBAA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AG,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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "flo-mat",
|
|
3
3
|
"sideEffects": false,
|
|
4
4
|
"description": "Medial / Scale Axis Transform (MAT/SAT) Library.",
|
|
5
|
-
"version": "4.1.
|
|
5
|
+
"version": "4.1.2",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Floris Steenkamp"
|
|
8
8
|
},
|
|
@@ -33,33 +33,32 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"big-float-ts": "^4.0.4",
|
|
35
35
|
"double-double": "^3.0.4",
|
|
36
|
-
"flo-bezier3": "^8.0.
|
|
37
|
-
"flo-boolean": "^
|
|
38
|
-
"flo-draw": "^2.0.5",
|
|
36
|
+
"flo-bezier3": "^8.0.14",
|
|
37
|
+
"flo-boolean": "^6.0.2",
|
|
39
38
|
"flo-gauss-quadrature": "^2.1.4",
|
|
40
39
|
"flo-ll-rb-tree": "^1.0.1",
|
|
41
40
|
"flo-memoize": "^2.0.1",
|
|
42
41
|
"flo-poly": "^8.1.4",
|
|
43
|
-
"flo-vector2d": "^4.0.6"
|
|
44
|
-
"squares-rng": "^2.0.4"
|
|
42
|
+
"flo-vector2d": "^4.0.6"
|
|
45
43
|
},
|
|
46
44
|
"devDependencies": {
|
|
47
|
-
"
|
|
48
|
-
"@
|
|
45
|
+
"squares-rng": "^2.0.4",
|
|
46
|
+
"@jest/globals": "^30.5.1",
|
|
47
|
+
"@swc/core": "^1.16.1",
|
|
49
48
|
"@swc/jest": "^0.2.39",
|
|
50
49
|
"@types/jest": "^30.0.0",
|
|
51
|
-
"@types/node": "^26.
|
|
50
|
+
"@types/node": "^26.4.1",
|
|
52
51
|
"c8": "^12.0.0",
|
|
53
52
|
"cheerio": "^1.2.0",
|
|
54
53
|
"circular-dependency-plugin": "^5.2.2",
|
|
55
|
-
"jest": "^30.
|
|
54
|
+
"jest": "^30.5.1",
|
|
56
55
|
"jest-ts-webcompat-resolver": "^1.0.1",
|
|
57
56
|
"rimraf": "^6.1.3",
|
|
58
57
|
"ts-loader": "^9.6.2",
|
|
59
58
|
"ts-node": "^10.9.2",
|
|
60
59
|
"typescript": "^6.0.3",
|
|
61
|
-
"webpack": "^5.
|
|
62
|
-
"webpack-cli": "^7.2.
|
|
60
|
+
"webpack": "^5.110.3",
|
|
61
|
+
"webpack-cli": "^7.2.3"
|
|
63
62
|
},
|
|
64
63
|
"scripts": {
|
|
65
64
|
"build": "npm run build-browser && npm run build-node",
|
|
@@ -69,7 +68,8 @@
|
|
|
69
68
|
"test-package": "npm pack"
|
|
70
69
|
},
|
|
71
70
|
"allowScripts": {
|
|
72
|
-
"@swc/core@1.
|
|
73
|
-
"unrs-resolver@1.
|
|
71
|
+
"@swc/core@1.16.1": true,
|
|
72
|
+
"unrs-resolver@1.12.2": true,
|
|
73
|
+
"@parcel/watcher@2.6.0": true
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -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({
|
|
@@ -55,7 +55,9 @@ function findMats(
|
|
|
55
55
|
} = options_;
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
const loopss = simplifyPaths(bezierLoops,
|
|
58
|
+
const loopss = simplifyPaths(bezierLoops, {
|
|
59
|
+
forceOrientationNegative: true,
|
|
60
|
+
});
|
|
59
61
|
|
|
60
62
|
// console.log(loopsToSvgPathStr(bezierLoops));
|
|
61
63
|
|
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) {
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { BezierPiece, fromTo } from "flo-bezier3"
|
|
2
|
-
import { drawFs } from "flo-draw"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const clss = [
|
|
6
|
-
'red thin10 nofill',
|
|
7
|
-
'green thin10 nofill'
|
|
8
|
-
]
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function drawBezierPieces(
|
|
12
|
-
g: SVGGElement,
|
|
13
|
-
bezierPieces: BezierPiece[],
|
|
14
|
-
classes_ = 'red thin10 nofill, green thin10 nofill, deeppink thin10 nofill',
|
|
15
|
-
delay = 0,
|
|
16
|
-
scaleFactor = 1) {
|
|
17
|
-
|
|
18
|
-
const $svgs: SVGElement[] = [];
|
|
19
|
-
|
|
20
|
-
const classes = classes_.split(',');
|
|
21
|
-
for (let i=0; i<bezierPieces.length; i++) {
|
|
22
|
-
const piece = bezierPieces[i];
|
|
23
|
-
const { ps, ts } = piece;
|
|
24
|
-
if (ts[0] === ts[1]) {
|
|
25
|
-
$svgs.push(...drawFs.crossHair(g, ps[0], classes[i%classes.length], scaleFactor, delay));
|
|
26
|
-
}
|
|
27
|
-
const bezier = fromTo(ps, ts[0], ts[1]);
|
|
28
|
-
$svgs.push(...drawFs.bezier(g, bezier, classes[i%classes.length], delay));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return $svgs;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export { drawBezierPieces }
|