@andamento/core 0.1.0 → 0.2.0

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.
@@ -0,0 +1,81 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
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
+ var _chunkHBEJOXUCcjs = require('./chunk-HBEJOXUC.cjs');
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
+ exports.HAT = _chunkHBEJOXUCcjs.HAT; exports.SPECTRE = _chunkHBEJOXUCcjs.SPECTRE; exports.add = _chunkHBEJOXUCcjs.add; exports.cleanPolygon = _chunkHBEJOXUCcjs.cleanPolygon; exports.clipConvex = _chunkHBEJOXUCcjs.clipConvex; exports.clipHalfPlane = _chunkHBEJOXUCcjs.clipHalfPlane; exports.clipPolygonToConvex = _chunkHBEJOXUCcjs.clipPolygonToConvex; exports.containsPolygon = _chunkHBEJOXUCcjs.containsPolygon; exports.convexHull = _chunkHBEJOXUCcjs.convexHull; exports.cross = _chunkHBEJOXUCcjs.cross; exports.cssPolygon = _chunkHBEJOXUCcjs.cssPolygon; exports.dot = _chunkHBEJOXUCcjs.dot; exports.ensurePositive = _chunkHBEJOXUCcjs.ensurePositive; exports.generateMondrian = _chunkHBEJOXUCcjs.generateMondrian; exports.generatePeriodic = _chunkHBEJOXUCcjs.generatePeriodic; exports.generateTiles = _chunkHBEJOXUCcjs.generateTiles; exports.hatSupertile = _chunkHBEJOXUCcjs.hatSupertile; exports.insetConvex = _chunkHBEJOXUCcjs.insetConvex; exports.insetPolygonPieces = _chunkHBEJOXUCcjs.insetPolygonPieces; exports.isConvex = _chunkHBEJOXUCcjs.isConvex; exports.isohedralPrototile = _chunkHBEJOXUCcjs.isohedralPrototile; exports.length = _chunkHBEJOXUCcjs.length; exports.mulberry32 = _chunkHBEJOXUCcjs.mulberry32; exports.outsetPolygon = _chunkHBEJOXUCcjs.outsetPolygon; exports.partition = _chunkHBEJOXUCcjs.partition; exports.placedBounds = _chunkHBEJOXUCcjs.placedBounds; exports.pointInPolygon = _chunkHBEJOXUCcjs.pointInPolygon; exports.rectsOverlap = _chunkHBEJOXUCcjs.rectsOverlap; exports.resamplePolygon = _chunkHBEJOXUCcjs.resamplePolygon; exports.scale = _chunkHBEJOXUCcjs.scale; exports.shapeArea = _chunkHBEJOXUCcjs.shapeArea; exports.shapeCentroid = _chunkHBEJOXUCcjs.shapeCentroid; exports.sharesEdge = _chunkHBEJOXUCcjs.sharesEdge; exports.signedArea = _chunkHBEJOXUCcjs.signedArea; exports.spectreSupertile = _chunkHBEJOXUCcjs.spectreSupertile; exports.splitSelfIntersections = _chunkHBEJOXUCcjs.splitSelfIntersections; exports.sub = _chunkHBEJOXUCcjs.sub; exports.transform = _chunkHBEJOXUCcjs.transform;
81
+ //# sourceMappingURL=internal.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/matthewputnam/code/andamento/packages/core/dist/internal.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,y+DAAC","file":"/Users/matthewputnam/code/andamento/packages/core/dist/internal.cjs"}
@@ -0,0 +1,111 @@
1
+ import { P as Polygon, V as Vec } from './css-BG8JRNrD.cjs';
2
+ export { G as GenerateContext, a as RawTile, aJ as add, aK as cleanPolygon, aL as clipConvex, aM as clipHalfPlane, aN as clipPolygonToConvex, aO as containsPolygon, aP as convexHull, aQ as cross, aR as cssPolygon, aS as dot, aT as ensurePositive, aU as generateMondrian, aV as generatePeriodic, aW as generateTiles, aX as insetConvex, aY as insetPolygonPieces, aZ as isConvex, a_ as isohedralPrototile, a$ as length, b0 as outsetPolygon, b1 as partition, b2 as pointInPolygon, b3 as rectsOverlap, b4 as resamplePolygon, b5 as scale, b6 as shapeArea, b7 as shapeCentroid, b8 as sharesEdge, b9 as signedArea, ba as splitSelfIntersections, bb as sub, bc as transform } from './css-BG8JRNrD.cjs';
3
+
4
+ /*!
5
+ * The "hat" aperiodic monotile (Smith, Myers, Kaplan & Goodman-Strauss, 2023), built
6
+ * with the H/T/P/F metatile construction.
7
+ *
8
+ * The metatile outlines, the patch rules and the supertile construction below are ported
9
+ * from hatviz (https://github.com/isohedral/hatviz), whose license follows:
10
+ *
11
+ * BSD 3-Clause License
12
+ *
13
+ * Copyright (c) 2023, Craig S. Kaplan
14
+ *
15
+ * Redistribution and use in source and binary forms, with or without
16
+ * modification, are permitted provided that the following conditions are met:
17
+ *
18
+ * 1. Redistributions of source code must retain the above copyright notice, this
19
+ * list of conditions and the following disclaimer.
20
+ *
21
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22
+ * this list of conditions and the following disclaimer in the documentation
23
+ * and/or other materials provided with the distribution.
24
+ *
25
+ * 3. Neither the name of the copyright holder nor the names of its
26
+ * contributors may be used to endorse or promote products derived from
27
+ * this software without specific prior written permission.
28
+ *
29
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
30
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
33
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
+ */
40
+
41
+ /** 2D affine transform [a, b, c, d, e, f]: x' = a·x + b·y + c, y' = d·x + e·y + f. */
42
+ type Affine = [number, number, number, number, number, number];
43
+ /** The hat: a 13-sided polykite (eight kites of a hexagonal grid). */
44
+ declare const HAT: Polygon;
45
+ /**
46
+ * Hat labels, by the metatile a hat belongs to: "H1" is the one reflected hat in each H
47
+ * metatile; the others are unreflected.
48
+ */
49
+ type HatLabel = "H1" | "H" | "T" | "P" | "F";
50
+ interface HatLeaf {
51
+ kind: "hat";
52
+ label: HatLabel;
53
+ }
54
+ interface MetaTile {
55
+ kind: "meta";
56
+ /** Approximate outline of the cluster, in its own coordinates. */
57
+ shape: Polygon;
58
+ children: {
59
+ T: Affine;
60
+ geom: Geom;
61
+ }[];
62
+ }
63
+ type Geom = HatLeaf | MetaTile;
64
+ /**
65
+ * The H metatile at `level` (0 = the initial four-hat H), and the transform from its
66
+ * coordinates to those of the level-0 H it contains. Each level's H contains the previous
67
+ * level's H as its first child, so anchoring on the level-0 H makes every level an
68
+ * extension of the one before.
69
+ */
70
+ declare function hatSupertile(level: number, chain?: number | readonly number[]): {
71
+ H: MetaTile;
72
+ toAnchor: Affine;
73
+ };
74
+ type Bounds = {
75
+ x0: number;
76
+ y0: number;
77
+ x1: number;
78
+ y1: number;
79
+ };
80
+ /** Bounds of `g`'s hats after transform T (conservative: the transformed box's box). */
81
+ declare function placedBounds(g: Geom, T: Affine): Bounds;
82
+
83
+ /** Tile(1,1): fourteen unit edges (two of them collinear), angles in multiples of 30°. */
84
+ declare const SPECTRE: Polygon;
85
+ type SpectreLabel = "Gamma1" | "Gamma2" | "Delta" | "Theta" | "Lambda" | "Xi" | "Pi" | "Sigma" | "Phi" | "Psi";
86
+ type Cluster = "Gamma" | "Delta" | "Theta" | "Lambda" | "Xi" | "Pi" | "Sigma" | "Phi" | "Psi";
87
+ type Node = {
88
+ kind: "tile";
89
+ label: SpectreLabel;
90
+ } | {
91
+ kind: "meta";
92
+ children: {
93
+ T: Affine;
94
+ node: Node;
95
+ }[];
96
+ quad: Vec[];
97
+ };
98
+ /**
99
+ * The supertile of type `cluster` at `level`, and the transform from its coordinates to
100
+ * those of the level-0 cluster at the end of the chain that follows `slot` at every level
101
+ * (the slot must hold the same cluster type), so every level extends the one before.
102
+ */
103
+ declare function spectreSupertile(level: number, cluster?: Cluster, slot?: number): {
104
+ root: Node;
105
+ toAnchor: Affine;
106
+ };
107
+
108
+ /** Small, fast, seedable PRNG returning floats in [0, 1). */
109
+ declare function mulberry32(seed: number): () => number;
110
+
111
+ export { HAT, type HatLabel, SPECTRE, type SpectreLabel, hatSupertile, mulberry32, placedBounds, spectreSupertile };
@@ -0,0 +1,111 @@
1
+ import { P as Polygon, V as Vec } from './css-BG8JRNrD.js';
2
+ export { G as GenerateContext, a as RawTile, aJ as add, aK as cleanPolygon, aL as clipConvex, aM as clipHalfPlane, aN as clipPolygonToConvex, aO as containsPolygon, aP as convexHull, aQ as cross, aR as cssPolygon, aS as dot, aT as ensurePositive, aU as generateMondrian, aV as generatePeriodic, aW as generateTiles, aX as insetConvex, aY as insetPolygonPieces, aZ as isConvex, a_ as isohedralPrototile, a$ as length, b0 as outsetPolygon, b1 as partition, b2 as pointInPolygon, b3 as rectsOverlap, b4 as resamplePolygon, b5 as scale, b6 as shapeArea, b7 as shapeCentroid, b8 as sharesEdge, b9 as signedArea, ba as splitSelfIntersections, bb as sub, bc as transform } from './css-BG8JRNrD.js';
3
+
4
+ /*!
5
+ * The "hat" aperiodic monotile (Smith, Myers, Kaplan & Goodman-Strauss, 2023), built
6
+ * with the H/T/P/F metatile construction.
7
+ *
8
+ * The metatile outlines, the patch rules and the supertile construction below are ported
9
+ * from hatviz (https://github.com/isohedral/hatviz), whose license follows:
10
+ *
11
+ * BSD 3-Clause License
12
+ *
13
+ * Copyright (c) 2023, Craig S. Kaplan
14
+ *
15
+ * Redistribution and use in source and binary forms, with or without
16
+ * modification, are permitted provided that the following conditions are met:
17
+ *
18
+ * 1. Redistributions of source code must retain the above copyright notice, this
19
+ * list of conditions and the following disclaimer.
20
+ *
21
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22
+ * this list of conditions and the following disclaimer in the documentation
23
+ * and/or other materials provided with the distribution.
24
+ *
25
+ * 3. Neither the name of the copyright holder nor the names of its
26
+ * contributors may be used to endorse or promote products derived from
27
+ * this software without specific prior written permission.
28
+ *
29
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
30
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
33
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
+ */
40
+
41
+ /** 2D affine transform [a, b, c, d, e, f]: x' = a·x + b·y + c, y' = d·x + e·y + f. */
42
+ type Affine = [number, number, number, number, number, number];
43
+ /** The hat: a 13-sided polykite (eight kites of a hexagonal grid). */
44
+ declare const HAT: Polygon;
45
+ /**
46
+ * Hat labels, by the metatile a hat belongs to: "H1" is the one reflected hat in each H
47
+ * metatile; the others are unreflected.
48
+ */
49
+ type HatLabel = "H1" | "H" | "T" | "P" | "F";
50
+ interface HatLeaf {
51
+ kind: "hat";
52
+ label: HatLabel;
53
+ }
54
+ interface MetaTile {
55
+ kind: "meta";
56
+ /** Approximate outline of the cluster, in its own coordinates. */
57
+ shape: Polygon;
58
+ children: {
59
+ T: Affine;
60
+ geom: Geom;
61
+ }[];
62
+ }
63
+ type Geom = HatLeaf | MetaTile;
64
+ /**
65
+ * The H metatile at `level` (0 = the initial four-hat H), and the transform from its
66
+ * coordinates to those of the level-0 H it contains. Each level's H contains the previous
67
+ * level's H as its first child, so anchoring on the level-0 H makes every level an
68
+ * extension of the one before.
69
+ */
70
+ declare function hatSupertile(level: number, chain?: number | readonly number[]): {
71
+ H: MetaTile;
72
+ toAnchor: Affine;
73
+ };
74
+ type Bounds = {
75
+ x0: number;
76
+ y0: number;
77
+ x1: number;
78
+ y1: number;
79
+ };
80
+ /** Bounds of `g`'s hats after transform T (conservative: the transformed box's box). */
81
+ declare function placedBounds(g: Geom, T: Affine): Bounds;
82
+
83
+ /** Tile(1,1): fourteen unit edges (two of them collinear), angles in multiples of 30°. */
84
+ declare const SPECTRE: Polygon;
85
+ type SpectreLabel = "Gamma1" | "Gamma2" | "Delta" | "Theta" | "Lambda" | "Xi" | "Pi" | "Sigma" | "Phi" | "Psi";
86
+ type Cluster = "Gamma" | "Delta" | "Theta" | "Lambda" | "Xi" | "Pi" | "Sigma" | "Phi" | "Psi";
87
+ type Node = {
88
+ kind: "tile";
89
+ label: SpectreLabel;
90
+ } | {
91
+ kind: "meta";
92
+ children: {
93
+ T: Affine;
94
+ node: Node;
95
+ }[];
96
+ quad: Vec[];
97
+ };
98
+ /**
99
+ * The supertile of type `cluster` at `level`, and the transform from its coordinates to
100
+ * those of the level-0 cluster at the end of the chain that follows `slot` at every level
101
+ * (the slot must hold the same cluster type), so every level extends the one before.
102
+ */
103
+ declare function spectreSupertile(level: number, cluster?: Cluster, slot?: number): {
104
+ root: Node;
105
+ toAnchor: Affine;
106
+ };
107
+
108
+ /** Small, fast, seedable PRNG returning floats in [0, 1). */
109
+ declare function mulberry32(seed: number): () => number;
110
+
111
+ export { HAT, type HatLabel, SPECTRE, type SpectreLabel, hatSupertile, mulberry32, placedBounds, spectreSupertile };
@@ -0,0 +1,81 @@
1
+ import {
2
+ HAT,
3
+ SPECTRE,
4
+ add,
5
+ cleanPolygon,
6
+ clipConvex,
7
+ clipHalfPlane,
8
+ clipPolygonToConvex,
9
+ containsPolygon,
10
+ convexHull,
11
+ cross,
12
+ cssPolygon,
13
+ dot,
14
+ ensurePositive,
15
+ generateMondrian,
16
+ generatePeriodic,
17
+ generateTiles,
18
+ hatSupertile,
19
+ insetConvex,
20
+ insetPolygonPieces,
21
+ isConvex,
22
+ isohedralPrototile,
23
+ length,
24
+ mulberry32,
25
+ outsetPolygon,
26
+ partition,
27
+ placedBounds,
28
+ pointInPolygon,
29
+ rectsOverlap,
30
+ resamplePolygon,
31
+ scale,
32
+ shapeArea,
33
+ shapeCentroid,
34
+ sharesEdge,
35
+ signedArea,
36
+ spectreSupertile,
37
+ splitSelfIntersections,
38
+ sub,
39
+ transform
40
+ } from "./chunk-JHWTRUDN.js";
41
+ export {
42
+ HAT,
43
+ SPECTRE,
44
+ add,
45
+ cleanPolygon,
46
+ clipConvex,
47
+ clipHalfPlane,
48
+ clipPolygonToConvex,
49
+ containsPolygon,
50
+ convexHull,
51
+ cross,
52
+ cssPolygon,
53
+ dot,
54
+ ensurePositive,
55
+ generateMondrian,
56
+ generatePeriodic,
57
+ generateTiles,
58
+ hatSupertile,
59
+ insetConvex,
60
+ insetPolygonPieces,
61
+ isConvex,
62
+ isohedralPrototile,
63
+ length,
64
+ mulberry32,
65
+ outsetPolygon,
66
+ partition,
67
+ placedBounds,
68
+ pointInPolygon,
69
+ rectsOverlap,
70
+ resamplePolygon,
71
+ scale,
72
+ shapeArea,
73
+ shapeCentroid,
74
+ sharesEdge,
75
+ signedArea,
76
+ spectreSupertile,
77
+ splitSelfIntersections,
78
+ sub,
79
+ transform
80
+ };
81
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andamento/core",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Framework-free tiling layouts: generate polygon cells that fill a region.",
5
5
  "keywords": [
6
6
  "tiling",
@@ -45,6 +45,16 @@
45
45
  "types": "./dist/index.d.cts",
46
46
  "default": "./dist/index.cjs"
47
47
  }
48
+ },
49
+ "./internal": {
50
+ "import": {
51
+ "types": "./dist/internal.d.ts",
52
+ "default": "./dist/internal.js"
53
+ },
54
+ "require": {
55
+ "types": "./dist/internal.d.cts",
56
+ "default": "./dist/internal.cjs"
57
+ }
48
58
  }
49
59
  },
50
60
  "files": [