flo-mat 3.0.13 → 3.0.15
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/check-clone-eql-calc.spec.ts +58 -0
- package/__tests__/cp-node/compare-cp-nodes-by-value.ts +35 -0
- package/__tests__/cp-node/compare-loops-by-value.ts +40 -0
- package/__tests__/cp-node/compare-poss-by-value.ts +25 -0
- package/__tests__/cp-node/fs/clone.spec.ts +19 -3
- package/__tests__/cp-node/fs/find-first.spec.ts +13 -3
- package/__tests__/cp-node/fs/get-all-between.spec.ts +20 -3
- package/__tests__/cp-node/fs/get-all-on-circle.spec.ts +2 -2
- package/__tests__/cp-node/fs/get-all-on-loop.spec.ts +16 -3
- package/__tests__/cp-node/fs/get-all-vertices.spec.ts +14 -3
- package/__tests__/cp-node/fs/get-children.spec.ts +18 -3
- package/__tests__/cp-node/fs/get-non-terminating-on-circle.spec.ts +14 -3
- package/__tests__/cp-node/fs/get-prong-count.spec.ts +16 -3
- package/__tests__/cp-node/fs/get-real-prong-count.spec.ts +11 -3
- package/__tests__/cp-node/fs/get-terminating-on-circle.spec.ts +20 -3
- package/__tests__/cp-node/fs/is-fully-terminating.spec.ts +16 -3
- package/__tests__/cp-node/fs/is-on-same-circle.spec.ts +20 -3
- package/__tests__/cp-node/fs/is-one-prong.spec.ts +16 -3
- package/__tests__/cp-node/fs/is-sharp.spec.ts +10 -3
- package/__tests__/cp-node/fs/is-single-3-prong.spec.ts +13 -3
- package/__tests__/cp-node/fs/is-special.spec.ts +12 -3
- package/__tests__/cp-node/fs/is-terminating.spec.ts +15 -3
- package/__tests__/cp-node/fs/is-trivial.spec.ts +13 -3
- package/__tests__/cp-node/fs/is-two-prong.spec.ts +11 -3
- package/__tests__/cp-node/fs/is-vertex-special.spec.ts +13 -3
- package/__tests__/cp-node/fs/is-vertex.spec.ts +14 -3
- package/__tests__/cp-node/fs/iterate-all-on-loop.spec.ts +13 -3
- package/__tests__/cp-node/fs/traverse-all-forward.spec.ts +10 -3
- package/__tests__/cp-node/fs/traverse-cp.spec.ts +9 -3
- package/__tests__/cp-node/fs/traverse-edges.spec.ts +13 -3
- package/__tests__/cp-node/fs/traverse-vertices.spec.ts +12 -3
- package/__tests__/cp-node/random-walk.ts +33 -0
- package/__tests__/cp-node/stringification/from-stringifyable.spec.ts +3 -0
- package/__tests__/cp-node/stringification/loop-from-stringifyable.spec.ts +4 -0
- package/__tests__/cp-node/stringification/loop-to-stringifyable.spec.ts +19 -0
- package/__tests__/cp-node/stringification/to-stringifyable.spec.ts +34 -0
- package/__tests__/get-mats1.ts +125 -0
- package/__tests__/jsog/check-jsog-eql-calc.spec.ts +47 -67
- package/__tests__/jsog/decode-jsog.ts +88 -85
- package/__tests__/jsog/mat-dummy-1.ts +19 -0
- package/__tests__/jsog/mat-dummys.ts +6197 -6195
- package/__tests__/jsog/to-jsog-breath-first.ts +110 -107
- package/__tests__/jsog/to-jsog-depth-first.ts +58 -55
- package/browser/index.js +7002 -6298
- package/browser/index.min.js +1 -1
- package/jest.config.cjs +1 -0
- package/node/closest-boundary-point/foot-and-endpoint-info.d.ts +1 -1
- package/node/closest-boundary-point/get-close-boundary-points-certified.d.ts +3 -3
- package/node/closest-boundary-point/get-close-boundary-points-certified.js +1 -1
- package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -1
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.d.ts +2 -2
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js +7 -7
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js.map +1 -1
- package/node/cp-node/cp-node.d.ts +2 -2
- package/node/cp-node/fs/clone.d.ts +1 -1
- package/node/cp-node/fs/clone.js +17 -13
- package/node/cp-node/fs/clone.js.map +1 -1
- package/node/cp-node/fs/enhance-cp-node.d.ts +2 -2
- package/node/cp-node/fs/find-first.d.ts +9 -2
- package/node/cp-node/fs/find-first.js +12 -9
- package/node/cp-node/fs/find-first.js.map +1 -1
- package/node/cp-node/fs/get-all-on-loop.js +5 -6
- package/node/cp-node/fs/get-all-on-loop.js.map +1 -1
- package/node/cp-node/fs/get-edge-direction.d.ts +1 -1
- package/node/cp-node/fs/get-edge-direction.js.map +1 -1
- package/node/cp-node/fs/is-on-same-circle.d.ts +1 -0
- package/node/cp-node/fs/is-on-same-circle.js +1 -0
- package/node/cp-node/fs/is-on-same-circle.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-dull-corner.d.ts +1 -1
- package/node/debug/functions/draw-elem/draw-dull-corner.js +1 -1
- package/node/debug/functions/draw-elem/draw-dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-sharp-corner.d.ts +1 -1
- package/node/debug/functions/draw-elem/draw-sharp-corner.js +2 -1
- package/node/debug/functions/draw-elem/draw-sharp-corner.js.map +1 -1
- package/node/find-mat/find-mats.js +7 -2
- package/node/find-mat/find-mats.js.map +1 -1
- package/node/find-mat/get-meta.d.ts +4 -4
- package/node/find-mat/get-meta.js +1 -1
- package/node/find-mat/get-meta.js.map +1 -1
- package/node/geometry/circle.d.ts +4 -3
- package/node/geometry/circle.js +0 -7
- package/node/geometry/circle.js.map +1 -1
- package/node/index.d.ts +2 -2
- package/node/index.js +1 -0
- package/node/index.js.map +1 -1
- package/node/mat/curve-piece.d.ts +3 -3
- package/node/mat/get-boundary-piece-beziers.d.ts +2 -2
- package/node/mat/mat-meta.d.ts +4 -4
- package/node/mat/simplify-mat.d.ts +10 -8
- package/node/mat/simplify-mat.js +12 -10
- package/node/mat/simplify-mat.js.map +1 -1
- package/node/point-on-shape/create-pos.d.ts +2 -2
- package/node/point-on-shape/create-pos.js.map +1 -1
- package/node/point-on-shape/point-on-shape.d.ts +6 -6
- package/node/svg/get-loop-bounds.d.ts +2 -2
- package/node/svg/get-loop-bounds.js +1 -1
- package/node/svg/get-loop-bounds.js.map +1 -1
- package/package.json +10 -10
- package/src/closest-boundary-point/foot-and-endpoint-info.ts +1 -1
- package/src/closest-boundary-point/get-close-boundary-points-certified.ts +5 -5
- package/src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts +9 -9
- package/src/cp-node/cp-node.ts +8 -3
- package/src/cp-node/fs/add-distance-from.ts +37 -37
- package/src/cp-node/fs/clone.ts +23 -17
- package/src/cp-node/fs/find-first.ts +14 -11
- package/src/cp-node/fs/get-all-on-loop.ts +5 -6
- package/src/cp-node/fs/get-boundary-bezier-parts-to-next.ts +1 -1
- package/src/cp-node/fs/get-edge-direction.ts +3 -5
- package/src/cp-node/fs/is-on-same-circle.ts +1 -0
- package/src/cp-node/stringification/cp-node-stringifyable.ts +68 -0
- package/src/cp-node/stringification/from-stringifyable.ts +57 -0
- package/src/cp-node/stringification/loop-from-stringifyable.ts +15 -0
- package/src/cp-node/stringification/loop-stringifyable.ts +8 -0
- package/src/cp-node/stringification/loop-to-stringifyable.ts +14 -0
- package/src/cp-node/stringification/to-stringifyable.ts +71 -0
- package/src/curve/curve.ts +31 -33
- package/src/debug/functions/draw-elem/draw-dull-corner.ts +2 -2
- package/src/debug/functions/draw-elem/draw-sharp-corner.ts +4 -3
- package/src/find-mat/find-mats.ts +8 -2
- package/src/find-mat/get-meta.ts +7 -6
- package/src/geometry/circle.ts +5 -12
- package/src/index.ts +3 -4
- package/src/mat/curve-piece.ts +3 -3
- package/src/mat/get-boundary-piece-beziers.ts +3 -3
- package/src/mat/mat-meta.ts +4 -4
- package/src/mat/simplify-mat-map-only.ts +110 -110
- package/src/mat/simplify-mat.ts +15 -13
- package/src/point-on-shape/create-pos.ts +3 -3
- package/src/point-on-shape/point-on-shape.ts +6 -6
- package/src/svg/get-loop-bounds.ts +4 -5
- package/__tests__/cp-node/fs/add-distance-from.spec.ts +0 -7
- package/__tests__/cp-node/fs/cp-nodes-to-boundary-beziers.spec.ts +0 -7
- package/__tests__/cp-node/fs/create-cp-node.spec.ts +0 -7
- package/__tests__/cp-node/fs/enhance-cp-node.spec.ts +0 -7
- package/__tests__/jsog/get-mats1.ts +0 -41
- package/node/curve/curve.d.ts +0 -33
- package/node/curve/curve.js +0 -2
- package/node/curve/curve.js.map +0 -1
|
@@ -1,107 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
1
|
+
//=======================================
|
|
2
|
+
// NOTE! JSOG not used in tests anymore!
|
|
3
|
+
//=======================================
|
|
4
|
+
|
|
5
|
+
// /*
|
|
6
|
+
// Copy/paste this into the Chrome console to serialize an object to JSOG
|
|
7
|
+
// and copy the result to clipboard. Replace `temp1` with your root object.
|
|
8
|
+
// */
|
|
9
|
+
// // (() => {
|
|
10
|
+
// // const encoded = toJsogBreathFirst(temp1);
|
|
11
|
+
// // copy(JSON.stringify(encoded, null, 2));
|
|
12
|
+
// // })();
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// function toJsogBreathFirst(v: any) {
|
|
16
|
+
// const seen = new Map();
|
|
17
|
+
// let nextId = 1;
|
|
18
|
+
|
|
19
|
+
// type QueueItem =
|
|
20
|
+
// | { kind: 'array'; source: any[]; target: any[] }
|
|
21
|
+
// | { kind: 'map'; source: Map<any, any>; target: { '@id': string; '@type': 'Map'; entries: any[] } }
|
|
22
|
+
// | { kind: 'set'; source: Set<any>; target: { '@id': string; '@type': 'Set'; values: any[] } }
|
|
23
|
+
// | { kind: 'object'; source: Record<string, any>; target: Record<string, any> };
|
|
24
|
+
|
|
25
|
+
// const queue: QueueItem[] = [];
|
|
26
|
+
|
|
27
|
+
// function encodeValue(value: any): any {
|
|
28
|
+
// if (value === null || typeof value !== 'object') return value;
|
|
29
|
+
|
|
30
|
+
// if (seen.has(value)) {
|
|
31
|
+
// return { '@ref': seen.get(value) };
|
|
32
|
+
// }
|
|
33
|
+
|
|
34
|
+
// // Arrays are encoded by value only because JSON drops custom array props
|
|
35
|
+
// // like "@id" during stringify.
|
|
36
|
+
// if (Array.isArray(value)) {
|
|
37
|
+
// const result: any[] = new Array(value.length);
|
|
38
|
+
// queue.push({ kind: 'array', source: value, target: result });
|
|
39
|
+
// return result;
|
|
40
|
+
// }
|
|
41
|
+
|
|
42
|
+
// const id = String(nextId++);
|
|
43
|
+
// seen.set(value, id);
|
|
44
|
+
|
|
45
|
+
// if (value instanceof Map) {
|
|
46
|
+
// const result = {
|
|
47
|
+
// '@id': id,
|
|
48
|
+
// '@type': 'Map' as const,
|
|
49
|
+
// entries: [] as any[]
|
|
50
|
+
// };
|
|
51
|
+
// queue.push({ kind: 'map', source: value, target: result });
|
|
52
|
+
// return result;
|
|
53
|
+
// }
|
|
54
|
+
|
|
55
|
+
// if (value instanceof Set) {
|
|
56
|
+
// const result = {
|
|
57
|
+
// '@id': id,
|
|
58
|
+
// '@type': 'Set' as const,
|
|
59
|
+
// values: [] as any[]
|
|
60
|
+
// };
|
|
61
|
+
// queue.push({ kind: 'set', source: value, target: result });
|
|
62
|
+
// return result;
|
|
63
|
+
// }
|
|
64
|
+
|
|
65
|
+
// const result: Record<string, any> = { '@id': id };
|
|
66
|
+
// queue.push({ kind: 'object', source: value, target: result });
|
|
67
|
+
// return result;
|
|
68
|
+
// }
|
|
69
|
+
|
|
70
|
+
// const encoded = encodeValue(v);
|
|
71
|
+
|
|
72
|
+
// while (queue.length > 0) {
|
|
73
|
+
// const item = queue.shift()!;
|
|
74
|
+
|
|
75
|
+
// if (item.kind === 'array') {
|
|
76
|
+
// for (let i = 0; i < item.source.length; i++) {
|
|
77
|
+
// item.target[i] = encodeValue(item.source[i]);
|
|
78
|
+
// }
|
|
79
|
+
// continue;
|
|
80
|
+
// }
|
|
81
|
+
|
|
82
|
+
// if (item.kind === 'map') {
|
|
83
|
+
// for (const [k, val] of item.source.entries()) {
|
|
84
|
+
// item.target.entries.push([encodeValue(k), encodeValue(val)]);
|
|
85
|
+
// }
|
|
86
|
+
// continue;
|
|
87
|
+
// }
|
|
88
|
+
|
|
89
|
+
// if (item.kind === 'set') {
|
|
90
|
+
// for (const val of item.source.values()) {
|
|
91
|
+
// item.target.values.push(encodeValue(val));
|
|
92
|
+
// }
|
|
93
|
+
// continue;
|
|
94
|
+
// }
|
|
95
|
+
|
|
96
|
+
// for (const [key, val] of Object.entries(item.source)) {
|
|
97
|
+
// item.target[key] = encodeValue(val);
|
|
98
|
+
// }
|
|
99
|
+
// }
|
|
100
|
+
|
|
101
|
+
// // `copy` below is only available in the Chrome console.
|
|
102
|
+
// // If you want to run this in Node.js, replace it with `console.log`.
|
|
103
|
+
// // copy(JSON.stringify(encoded, null, 2));
|
|
104
|
+
// // console.log(JSON.stringify(encoded, null, 2));
|
|
105
|
+
// // console.log('JSOG copied to clipboard.');
|
|
106
|
+
// return encoded;
|
|
107
|
+
// }
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
// export { toJsogBreathFirst }
|
|
@@ -1,55 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
//=======================================
|
|
2
|
+
// NOTE! JSOG not used in tests anymore!
|
|
3
|
+
//=======================================
|
|
4
|
+
|
|
5
|
+
// function toJsogDepthFirst(v: any) {
|
|
6
|
+
// const seen = new Map();
|
|
7
|
+
// let nextId = 1;
|
|
8
|
+
|
|
9
|
+
// function encode(obj: any): any {
|
|
10
|
+
// if (obj === null || typeof obj !== 'object') return obj;
|
|
11
|
+
|
|
12
|
+
// if (seen.has(obj)) {
|
|
13
|
+
// return { '@ref': seen.get(obj) };
|
|
14
|
+
// }
|
|
15
|
+
|
|
16
|
+
// // Arrays are encoded by value only because JSON drops custom array props
|
|
17
|
+
// // like "@id" during stringify.
|
|
18
|
+
// if (Array.isArray(obj)) {
|
|
19
|
+
// return obj.map(encode);
|
|
20
|
+
// }
|
|
21
|
+
|
|
22
|
+
// const id = String(nextId++);
|
|
23
|
+
// seen.set(obj, id);
|
|
24
|
+
|
|
25
|
+
// if (obj instanceof Map) {
|
|
26
|
+
// return {
|
|
27
|
+
// '@id': id,
|
|
28
|
+
// '@type': 'Map',
|
|
29
|
+
// entries: [...obj.entries()].map(([k, v]) => [encode(k), encode(v)])
|
|
30
|
+
// };
|
|
31
|
+
// }
|
|
32
|
+
|
|
33
|
+
// if (obj instanceof Set) {
|
|
34
|
+
// return {
|
|
35
|
+
// '@id': id,
|
|
36
|
+
// '@type': 'Set',
|
|
37
|
+
// values: [...obj.values()].map(value => encode(value))
|
|
38
|
+
// };
|
|
39
|
+
// }
|
|
40
|
+
|
|
41
|
+
// const result: Record<string, any> = { '@id': id };
|
|
42
|
+
// for (const [key, value] of Object.entries(obj)) {
|
|
43
|
+
// result[key] = encode(value);
|
|
44
|
+
// }
|
|
45
|
+
// return result;
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
// const encoded = encode(v);
|
|
49
|
+
|
|
50
|
+
// // `copy` below is only available in the Chrome console.
|
|
51
|
+
// // If you want to run this in Node.js, replace it with `console.log`.
|
|
52
|
+
// // copy(JSON.stringify(encoded, null, 2));
|
|
53
|
+
// console.log(JSON.stringify(encoded, null, 2));
|
|
54
|
+
// // console.log('JSOG copied to clipboard.');
|
|
55
|
+
// }
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
// export { toJsogDepthFirst }
|