@genart-dev/plugin-distribution 0.1.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.
- package/README.md +121 -0
- package/dist/index.cjs +903 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +872 -0
- package/dist/index.js.map +1 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# @genart-dev/plugin-distribution
|
|
2
|
+
|
|
3
|
+
Distribution and packing plugin for [genart.dev](https://genart.dev) — spatial distribution algorithms (Poisson disk, phyllotaxis, hex grid, and more), circle/rect packing, growth simulations, and Wave Function Collapse tiling. Includes guide layers for non-destructive previews and MCP tools for AI-agent control.
|
|
4
|
+
|
|
5
|
+
Part of [genart.dev](https://genart.dev) — a generative art platform with an MCP server, desktop app, and IDE extensions.
|
|
6
|
+
|
|
7
|
+
## Examples
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
All 10 distribution algorithms side by side — from structured grids to quasi-random sequences.
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
Non-overlapping circle packing via trial-and-reject with variable radii.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @genart-dev/plugin-distribution
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import distributionPlugin from "@genart-dev/plugin-distribution";
|
|
27
|
+
import { createDefaultRegistry } from "@genart-dev/core";
|
|
28
|
+
|
|
29
|
+
const registry = createDefaultRegistry();
|
|
30
|
+
registry.registerPlugin(distributionPlugin);
|
|
31
|
+
|
|
32
|
+
// Or access individual exports
|
|
33
|
+
import {
|
|
34
|
+
previewLayerType,
|
|
35
|
+
voronoiLayerType,
|
|
36
|
+
densityLayerType,
|
|
37
|
+
distributionMcpTools,
|
|
38
|
+
} from "@genart-dev/plugin-distribution";
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Guide Layers
|
|
42
|
+
|
|
43
|
+
All three layer types are guide layers — they render overlays and can be cleared non-destructively.
|
|
44
|
+
|
|
45
|
+
### Distribution Preview (`distribution:preview`)
|
|
46
|
+
|
|
47
|
+
Renders generated points as colored dots.
|
|
48
|
+
|
|
49
|
+
| Property | Type | Default | Description |
|
|
50
|
+
|----------|------|---------|-------------|
|
|
51
|
+
| `algorithm` | string | `"poisson-disk"` | Algorithm name |
|
|
52
|
+
| `params` | string (JSON) | `"{}"` | Algorithm parameters |
|
|
53
|
+
| `dotSize` | number | `3` | Dot radius (0.5–20) |
|
|
54
|
+
| `dotColor` | color | `"#0088ff"` | Dot color |
|
|
55
|
+
| `opacity` | number | `0.6` | Overlay opacity (0–1) |
|
|
56
|
+
|
|
57
|
+
### Voronoi Overlay (`distribution:voronoi`)
|
|
58
|
+
|
|
59
|
+
Renders Voronoi cell edges from a point set.
|
|
60
|
+
|
|
61
|
+
| Property | Type | Default | Description |
|
|
62
|
+
|----------|------|---------|-------------|
|
|
63
|
+
| `strokeColor` | color | `"#333333"` | Edge color |
|
|
64
|
+
| `strokeWidth` | number | `1` | Edge width (0.5–5) |
|
|
65
|
+
| `fillColor` | color | `"transparent"` | Cell fill color |
|
|
66
|
+
| `opacity` | number | `0.7` | Overlay opacity (0–1) |
|
|
67
|
+
|
|
68
|
+
### Density Map (`distribution:density`)
|
|
69
|
+
|
|
70
|
+
Kernel density estimation heatmap with built-in colormaps (`viridis`, `plasma`, `inferno`, `hot`, `cool`).
|
|
71
|
+
|
|
72
|
+
| Property | Type | Default | Description |
|
|
73
|
+
|----------|------|---------|-------------|
|
|
74
|
+
| `radius` | number | `30` | Kernel radius (5–100) |
|
|
75
|
+
| `colormap` | string | `"viridis"` | Color map name |
|
|
76
|
+
| `opacity` | number | `0.65` | Overlay opacity (0–1) |
|
|
77
|
+
|
|
78
|
+
## Distribution Algorithms
|
|
79
|
+
|
|
80
|
+
| Algorithm | Key Parameters |
|
|
81
|
+
|-----------|----------------|
|
|
82
|
+
| `poisson-disk` | `minDist` (20), `maxAttempts` (30) |
|
|
83
|
+
| `phyllotaxis` | `count` (200), `scale` |
|
|
84
|
+
| `hex-grid` | `size` (20) |
|
|
85
|
+
| `tri-grid` | `size` (20) |
|
|
86
|
+
| `jittered-grid` | `size` (30), `jitter` (0.5) |
|
|
87
|
+
| `r2-sequence` | `count` (100) |
|
|
88
|
+
| `halton` | `count` (100) |
|
|
89
|
+
| `best-candidate` | `count` (100), `candidates` (10) |
|
|
90
|
+
| `latin-hypercube` | `count` (100) |
|
|
91
|
+
| `lloyd-relax` | `count` (100) |
|
|
92
|
+
|
|
93
|
+
All stochastic algorithms accept a `seed` parameter for reproducibility.
|
|
94
|
+
|
|
95
|
+
## MCP Tools (8)
|
|
96
|
+
|
|
97
|
+
| Tool | Description |
|
|
98
|
+
|------|-------------|
|
|
99
|
+
| `distribute_points` | Generate a spatial point distribution (10 algorithms) |
|
|
100
|
+
| `pack_circles` | Pack non-overlapping circles (trial-and-reject) |
|
|
101
|
+
| `pack_rects` | Pack rectangles into a bin (guillotine algorithm) |
|
|
102
|
+
| `preview_distribution` | Generate distribution and add a preview guide layer |
|
|
103
|
+
| `clear_distribution_preview` | Remove distribution guide layers |
|
|
104
|
+
| `grow_pattern` | Run a growth algorithm (DLA, differential growth, substrate) |
|
|
105
|
+
| `tile_region` | Tile a region using Wave Function Collapse |
|
|
106
|
+
| `distribute_along_path` | Distribute points along a polyline by arc-length |
|
|
107
|
+
|
|
108
|
+
## Related Packages
|
|
109
|
+
|
|
110
|
+
| Package | Purpose |
|
|
111
|
+
|---------|---------|
|
|
112
|
+
| [`@genart-dev/core`](https://github.com/genart-dev/core) | Plugin host, layer system (dependency) |
|
|
113
|
+
| [`@genart-dev/mcp-server`](https://github.com/genart-dev/mcp-server) | MCP server that surfaces plugin tools to AI agents |
|
|
114
|
+
|
|
115
|
+
## Support
|
|
116
|
+
|
|
117
|
+
Questions, bugs, or feedback — [support@genart.dev](mailto:support@genart.dev) or [open an issue](https://github.com/genart-dev/plugin-distribution/issues).
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
MIT
|