flo-mat 4.1.2 → 4.1.3
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__/get-mats1.ts +23 -22
- package/browser/index.js +4 -3
- package/browser/index.min.js +1 -1
- package/node/cp-node/stringification/from-stringifyable.js +2 -1
- package/node/cp-node/stringification/from-stringifyable.js.map +1 -1
- package/node/cp-node/stringification/to-stringifyable.js +2 -2
- package/node/cp-node/stringification/to-stringifyable.js.map +1 -1
- package/package.json +4 -4
- package/src/cp-node/stringification/from-stringifyable.ts +2 -1
- package/src/cp-node/stringification/to-stringifyable.ts +2 -2
package/__tests__/get-mats1.ts
CHANGED
|
@@ -23,6 +23,7 @@ function getMats1() {
|
|
|
23
23
|
curveIdx: 0,
|
|
24
24
|
loopIdx: 0,
|
|
25
25
|
p: [24, 8],
|
|
26
|
+
pDd: [[0,24],[0,8]],
|
|
26
27
|
t: 1,
|
|
27
28
|
isSource: true,
|
|
28
29
|
order: -1,
|
|
@@ -33,28 +34,28 @@ function getMats1() {
|
|
|
33
34
|
prevOnCircle: 1,
|
|
34
35
|
nextOnCircle: 1
|
|
35
36
|
},
|
|
36
|
-
{ id: 1, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [24, 8], radius: 0 }, curveIdx: 0, loopIdx: 0, p: [24, 8], t: 1, isSource: true , order: 1, order2: 0 }, prev: 0, next: 10, prevOnCircle: 0, nextOnCircle: 0 },
|
|
37
|
-
{ id: 10, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [46, -5.21425847941623], radius: 13.21425847941623 }, curveIdx: 1, loopIdx: 0, p: [46, 8], t: 1, isSource: true , order: -1, order2: 0 }, prev: 1, next: 144, prevOnCircle: 11, nextOnCircle: 11 },
|
|
38
|
-
{ id: 144, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.5, -12.641417453935567], radius: 41.064803841095305 }, curveIdx: 1, loopIdx: 0, p: [46, 8], t: 1, isSource: false , order: -0.5026547194480646, order2: 0 }, prev: 10, next: 147, prevOnCircle: 143, nextOnCircle: 142 },
|
|
39
|
-
{ id: 147, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.5, 18.5], radius: 35.5 }, curveIdx: 2, loopIdx: 0, p: [46, 18.499999999999996], t: 0.2282608695652173, isSource: false , order: 0, order2: 0 }, prev: 144, next: 2, prevOnCircle: 146, nextOnCircle: 145 },
|
|
40
|
-
{ id: 2, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [46, 54], radius: 0 }, curveIdx: 2, loopIdx: 0, p: [46, 54], t: 1, isSource: true , order: -1, order2: 0 }, prev: 147, next: 3, prevOnCircle: 3, nextOnCircle: 3 },
|
|
41
|
-
{ id: 3, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [46, 54], radius: 0 }, curveIdx: 2, loopIdx: 0, p: [46, 54], t: 1, isSource: true , order: 1, order2: 0 }, prev: 2, next: 145, prevOnCircle: 2, nextOnCircle: 2 },
|
|
42
|
-
{ id: 145, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.5, 18.5], radius: 35.5 }, curveIdx: 3, loopIdx: 0, p: [81.5, 54], t: 0.5, isSource: false , order: 0, order2: 0 }, prev: 3, next: 4, prevOnCircle: 147, nextOnCircle: 146 },
|
|
43
|
-
{ id: 4, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [117, 54], radius: 0 }, curveIdx: 3, loopIdx: 0, p: [117, 54], t: 1, isSource: true , order: -1, order2: 0 }, prev: 145, next: 5, prevOnCircle: 5, nextOnCircle: 5 },
|
|
44
|
-
{ id: 5, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [117, 54], radius: 0 }, curveIdx: 3, loopIdx: 0, p: [117, 54], t: 1, isSource: true , order: 1, order2: 0 }, prev: 4, next: 146, prevOnCircle: 4, nextOnCircle: 4 },
|
|
45
|
-
{ id: 146, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.5, 18.5], radius: 35.5 }, curveIdx: 4, loopIdx: 0, p: [117, 18.499999999999996], t: 0.7717391304347827, isSource: false , order: 0, order2: 0 }, prev: 5, next: 142, prevOnCircle: 145, nextOnCircle: 147 },
|
|
46
|
-
{ id: 142, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.5, -12.641417453935567], radius: 41.064803841095305 }, curveIdx: 4, loopIdx: 0, p: [117, 8], t: 1, isSource: false , order: -0.8644872659655476, order2: 0 }, prev: 146, next: 148, prevOnCircle: 144, nextOnCircle: 143 },
|
|
47
|
-
{ id: 148, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.68410160768288, -12.970446490933696], radius: 41.07276841516263 }, curveIdx: 4, loopIdx: 0, p: [117, 8], t: 1, isSource: false , order: -0.8598373023056252, order2: 0 }, prev: 142, next: 119, prevOnCircle: 150, nextOnCircle: 149 },
|
|
48
|
-
{ id: 119, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [115.9110440340909, -5.952334953607174], radius: 13.994766012811272 }, curveIdx: 4, loopIdx: 0, p: [117, 8], t: 1, isSource: false , order: -0.07781165936695383, order2: 0 }, prev: 148, next: 6, prevOnCircle: 118, nextOnCircle: 118 },
|
|
49
|
-
{ id: 6, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [139, 8], radius: 0 }, curveIdx: 5, loopIdx: 0, p: [139, 8], t: 1, isSource: true , order: -1, order2: 0 }, prev: 119, next: 7, prevOnCircle: 7, nextOnCircle: 7 },
|
|
50
|
-
{ id: 7, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [139, 8], radius: 0 }, curveIdx: 5, loopIdx: 0, p: [139, 8], t: 1, isSource: true , order: 1, order2: 0 }, prev: 6, next: 118, prevOnCircle: 6, nextOnCircle: 6 },
|
|
51
|
-
{ id: 118, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [115.9110440340909, -5.952334953607174], radius: 13.994766012811272 }, curveIdx: 6, loopIdx: 0, p: [128.3125, -12.4375], t: 0.1875, isSource: true , order: 0, order2: 0 }, prev: 7, next: 149, prevOnCircle: 119, nextOnCircle: 119 },
|
|
52
|
-
{ id: 149, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.68410160768288, -12.970446490933696], radius: 41.07276841516263 }, curveIdx: 6, loopIdx: 0, p: [118.08071791640388, -32.003539423017145], t: 0.36700494883501966, isSource: false , order: 0, order2: 0 }, prev: 118, next: 8, prevOnCircle: 148, nextOnCircle: 150 },
|
|
53
|
-
{ id: 8, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [82, -101], radius: 0 }, curveIdx: 6, loopIdx: 0, p: [82, -101], t: 1, isSource: true , order: -1, order2: 0 }, prev: 149, next: 9, prevOnCircle: 9, nextOnCircle: 9 },
|
|
54
|
-
{ id: 9, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [82, -101], radius: 0 }, curveIdx: 6, loopIdx: 0, p: [82, -101], t: 1, isSource: true , order: 1, order2: 0 }, prev: 8, next: 150, prevOnCircle: 8, nextOnCircle: 8 },
|
|
55
|
-
{ id: 150, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.68410160768288, -12.970446490933696], radius: 41.07276841516263 }, curveIdx: 0, loopIdx: 0, p: [45.425023320690585, -32.264267964746104], t: 0.6306030461949899, isSource: false , order: 0, order2: 0 }, prev: 9, next: 143, prevOnCircle: 149, nextOnCircle: 148 },
|
|
56
|
-
{ id: 143, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.5, -12.641417453935567], radius: 41.064803841095305 }, curveIdx: 0, loopIdx: 0, p: [45.24795284642707, -31.931497590699145], t: 0.6336559854064299, isSource: false , order: 0, order2: 0 }, prev: 150, next: 11, prevOnCircle: 142, nextOnCircle: 144 },
|
|
57
|
-
{ id: 11, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [46, -5.21425847941623], radius: 13.21425847941623 }, curveIdx: 0, loopIdx: 0, p: [34.33444028251029, -11.421620530924521], t: 0.8218199951291328, isSource: false , order: 0, order2: 0 }, prev: 143, next: 0, prevOnCircle: 10, nextOnCircle: 10 }
|
|
37
|
+
{ id: 1, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [24, 8], radius: 0 }, curveIdx: 0, loopIdx: 0, p: [24, 8], t: 1, isSource: true , order: 1, order2: 0, pDd: [[0,24],[0,8]] }, prev: 0, next: 10, prevOnCircle: 0, nextOnCircle: 0 },
|
|
38
|
+
{ id: 10, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [46, -5.21425847941623], radius: 13.21425847941623 }, curveIdx: 1, loopIdx: 0, p: [46, 8], t: 1, isSource: true , order: -1, order2: 0, pDd: [[0,46],[0,8]] }, prev: 1, next: 144, prevOnCircle: 11, nextOnCircle: 11 },
|
|
39
|
+
{ id: 144, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.5, -12.641417453935567], radius: 41.064803841095305 }, curveIdx: 1, loopIdx: 0, p: [46, 8], t: 1, isSource: false , order: -0.5026547194480646, order2: 0, pDd: [[0,46],[0,8]] }, prev: 10, next: 147, prevOnCircle: 143, nextOnCircle: 142 },
|
|
40
|
+
{ id: 147, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.5, 18.5], radius: 35.5 }, curveIdx: 2, loopIdx: 0, p: [46, 18.499999999999996], t: 0.2282608695652173, isSource: false , order: 0, order2: 0, pDd: [[0,46],[0,18.499999999999996]] }, prev: 144, next: 2, prevOnCircle: 146, nextOnCircle: 145 },
|
|
41
|
+
{ id: 2, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [46, 54], radius: 0 }, curveIdx: 2, loopIdx: 0, p: [46, 54], t: 1, isSource: true , order: -1, order2: 0, pDd: [[0,46],[0,54]] }, prev: 147, next: 3, prevOnCircle: 3, nextOnCircle: 3 },
|
|
42
|
+
{ id: 3, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [46, 54], radius: 0 }, curveIdx: 2, loopIdx: 0, p: [46, 54], t: 1, isSource: true , order: 1, order2: 0, pDd: [[0,46],[0,54]] }, prev: 2, next: 145, prevOnCircle: 2, nextOnCircle: 2 },
|
|
43
|
+
{ id: 145, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.5, 18.5], radius: 35.5 }, curveIdx: 3, loopIdx: 0, p: [81.5, 54], t: 0.5, isSource: false , order: 0, order2: 0, pDd: [[0,81.5],[0,54]] }, prev: 3, next: 4, prevOnCircle: 147, nextOnCircle: 146 },
|
|
44
|
+
{ id: 4, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [117, 54], radius: 0 }, curveIdx: 3, loopIdx: 0, p: [117, 54], t: 1, isSource: true , order: -1, order2: 0, pDd: [[0,117],[0,54]] }, prev: 145, next: 5, prevOnCircle: 5, nextOnCircle: 5 },
|
|
45
|
+
{ id: 5, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [117, 54], radius: 0 }, curveIdx: 3, loopIdx: 0, p: [117, 54], t: 1, isSource: true , order: 1, order2: 0, pDd: [[0,117],[0,54]] }, prev: 4, next: 146, prevOnCircle: 4, nextOnCircle: 4 },
|
|
46
|
+
{ id: 146, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.5, 18.5], radius: 35.5 }, curveIdx: 4, loopIdx: 0, p: [117, 18.499999999999996], t: 0.7717391304347827, isSource: false , order: 0, order2: 0, pDd: [[0,117],[0,18.499999999999996]] }, prev: 5, next: 142, prevOnCircle: 145, nextOnCircle: 147 },
|
|
47
|
+
{ id: 142, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.5, -12.641417453935567], radius: 41.064803841095305 }, curveIdx: 4, loopIdx: 0, p: [117, 8], t: 1, isSource: false , order: -0.8644872659655476, order2: 0, pDd: [[0,117],[0,8]] }, prev: 146, next: 148, prevOnCircle: 144, nextOnCircle: 143 },
|
|
48
|
+
{ id: 148, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.68410160768288, -12.970446490933696], radius: 41.07276841516263 }, curveIdx: 4, loopIdx: 0, p: [117, 8], t: 1, isSource: false , order: -0.8598373023056252, order2: 0, pDd: [[0,117],[0,8]] }, prev: 142, next: 119, prevOnCircle: 150, nextOnCircle: 149 },
|
|
49
|
+
{ id: 119, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [115.9110440340909, -5.952334953607174], radius: 13.994766012811272 }, curveIdx: 4, loopIdx: 0, p: [117, 8], t: 1, isSource: false , order: -0.07781165936695383, order2: 0, pDd: [[0,117],[0,8]] }, prev: 148, next: 6, prevOnCircle: 118, nextOnCircle: 118 },
|
|
50
|
+
{ id: 6, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [139, 8], radius: 0 }, curveIdx: 5, loopIdx: 0, p: [139, 8], t: 1, isSource: true , order: -1, order2: 0, pDd: [[0,139],[0,8]] }, prev: 119, next: 7, prevOnCircle: 7, nextOnCircle: 7 },
|
|
51
|
+
{ id: 7, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [139, 8], radius: 0 }, curveIdx: 5, loopIdx: 0, p: [139, 8], t: 1, isSource: true , order: 1, order2: 0, pDd: [[0,139],[0,8]] }, prev: 6, next: 118, prevOnCircle: 6, nextOnCircle: 6 },
|
|
52
|
+
{ id: 118, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [115.9110440340909, -5.952334953607174], radius: 13.994766012811272 }, curveIdx: 6, loopIdx: 0, p: [128.3125, -12.4375], t: 0.1875, isSource: true , order: 0, order2: 0, pDd: [[0,128.3125],[0,-12.4375]] }, prev: 7, next: 149, prevOnCircle: 119, nextOnCircle: 119 },
|
|
53
|
+
{ id: 149, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.68410160768288, -12.970446490933696], radius: 41.07276841516263 }, curveIdx: 6, loopIdx: 0, p: [118.08071791640388, -32.003539423017145], t: 0.36700494883501966, isSource: false , order: 0, order2: 0, pDd: [[0,118.08071791640388],[0,-32.003539423017145]] }, prev: 118, next: 8, prevOnCircle: 148, nextOnCircle: 150 },
|
|
54
|
+
{ id: 8, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [82, -101], radius: 0 }, curveIdx: 6, loopIdx: 0, p: [82, -101], t: 1, isSource: true , order: -1, order2: 0, pDd: [[0,82],[0,-101]] }, prev: 149, next: 9, prevOnCircle: 9, nextOnCircle: 9 },
|
|
55
|
+
{ id: 9, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [82, -101], radius: 0 }, curveIdx: 6, loopIdx: 0, p: [82, -101], t: 1, isSource: true , order: 1, order2: 0, pDd: [[0,82],[0,-101]] }, prev: 8, next: 150, prevOnCircle: 8, nextOnCircle: 8 },
|
|
56
|
+
{ id: 150, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.68410160768288, -12.970446490933696], radius: 41.07276841516263 }, curveIdx: 0, loopIdx: 0, p: [45.425023320690585, -32.264267964746104], t: 0.6306030461949899, isSource: false , order: 0, order2: 0, pDd: [[0,45.425023320690585],[0,-32.264267964746104]] }, prev: 9, next: 143, prevOnCircle: 149, nextOnCircle: 148 },
|
|
57
|
+
{ id: 143, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [81.5, -12.641417453935567], radius: 41.064803841095305 }, curveIdx: 0, loopIdx: 0, p: [45.24795284642707, -31.931497590699145], t: 0.6336559854064299, isSource: false , order: 0, order2: 0, pDd: [[0,45.24795284642707],[0,-31.931497590699145]] }, prev: 150, next: 11, prevOnCircle: 142, nextOnCircle: 144 },
|
|
58
|
+
{ id: 11, isHoleClosing: false, isIntersection: false, pointOnShape: { circle: { center: [46, -5.21425847941623], radius: 13.21425847941623 }, curveIdx: 0, loopIdx: 0, p: [34.33444028251029, -11.421620530924521], t: 0.8218199951291328, isSource: false , order: 0, order2: 0, pDd: [[0,34.33444028251029],[0,-11.421620530924521]] }, prev: 143, next: 0, prevOnCircle: 10, nextOnCircle: 10 }
|
|
58
59
|
],
|
|
59
60
|
loops: [
|
|
60
61
|
{ idx: 0, beziers: [[[82, -101], [24, 8]], [[24, 8], [46, 8]], [[46, 8], [46, 54]], [[46, 54], [117, 54]], [[117, 54], [117, 8]], [[117, 8], [139, 8]], [[139, 8], [82, -101]]] }
|
package/browser/index.js
CHANGED
|
@@ -30872,8 +30872,8 @@ function toStringifyable(cpNode) {
|
|
|
30872
30872
|
loopSet.add(loop);
|
|
30873
30873
|
}
|
|
30874
30874
|
const posSimplified = {
|
|
30875
|
-
curveIdx, loopIdx: loop.idx, p, t, isSource,
|
|
30876
|
-
circle, order, order2
|
|
30875
|
+
curveIdx, loopIdx: loop.idx, p, pDd, t, isSource,
|
|
30876
|
+
circle, order, order2
|
|
30877
30877
|
};
|
|
30878
30878
|
cpNodes_.push({
|
|
30879
30879
|
id, isHoleClosing, isIntersection,
|
|
@@ -30918,6 +30918,7 @@ function loopFromStringifyable(loopStringifyable) {
|
|
|
30918
30918
|
function fromStringifyable(cpNodesStringifyable) {
|
|
30919
30919
|
const { cpNodes: _cpNodes, loops: _loops } = cpNodesStringifyable;
|
|
30920
30920
|
const loops = _loops.map(loopFromStringifyable);
|
|
30921
|
+
const loopsByIdx = new Map(loops.map(loop => [loop.idx, loop]));
|
|
30921
30922
|
//--------------------------------------------------------------------------
|
|
30922
30923
|
// First pass: build all CpNode objects with proper `cp`.
|
|
30923
30924
|
// Edges still hold number ids at this point.
|
|
@@ -30926,7 +30927,7 @@ function fromStringifyable(cpNodesStringifyable) {
|
|
|
30926
30927
|
const { id, pointOnShape, isHoleClosing, isIntersection } = cpNode_;
|
|
30927
30928
|
const { circle, order, order2 } = pointOnShape;
|
|
30928
30929
|
const { curveIdx, loopIdx, p, pDd, t, isSource } = pointOnShape;
|
|
30929
|
-
const curve =
|
|
30930
|
+
const curve = loopsByIdx.get(loopIdx).curves[curveIdx];
|
|
30930
30931
|
const pointOnShape_ = {
|
|
30931
30932
|
circle,
|
|
30932
30933
|
curve, p, pDd, t, isSource,
|