pattapatta 0.2.1 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1c203c2: Add contour skeletons and fields: medialAxis (with pruning), chordalAxis, straightSkeleton, centerLine, distanceField, contrastField, distanceTree, and isoline helpers.
8
+
9
+ ## 0.2.2
10
+
11
+ ### Patch Changes
12
+
13
+ - Add docs site favicon, OG/Twitter preview image, and social meta tags.
14
+
3
15
  ## 0.2.1
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -58,49 +58,6 @@ pnpm docs:examples # regenerate SVG figures
58
58
  | `pattapatta/voronoi` | Voronoi cells |
59
59
  | … | See `website/` API pages |
60
60
 
61
- ## Releasing
62
-
63
- This repo uses [Changesets](https://github.com/changesets/changesets). Only the root `pattapatta` package is published; `website` is ignored. CI publishes via [npm trusted publishing (OIDC)](https://docs.npmjs.com/trusted-publishers) — no long-lived `NPM_TOKEN` (2FA-bypass tokens are being deprecated for direct publish; see [npm changelog](https://github.blog/changelog/2026-07-08-npm-install-time-security-and-gat-bypass2fa-deprecation/)).
64
-
65
- ### One-time npm setup
66
-
67
- 1. If the package is not on npm yet, publish once locally (trusted publishers can only be configured on an existing package):
68
- ```bash
69
- pnpm build && npm publish --access public --otp=<code>
70
- ```
71
- 2. On [npmjs.com](https://www.npmjs.com/) → **pattapatta** → **Settings** → **Trusted Publisher** → **GitHub Actions**:
72
- - **Organization or user:** `MadOrkestra`
73
- - **Repository:** `pattapatta`
74
- - **Workflow filename:** `release.yml` (filename only)
75
- - **Allowed actions:** include **`npm publish`** (not stage-only — Changesets publishes directly)
76
- 3. Optionally under **Publishing access**, require 2FA and disallow tokens once OIDC works.
77
- 4. Remove any repo `NPM_TOKEN` secret if it was only used for publish.
78
-
79
- ### Routine releases
80
-
81
- 1. In a PR that changes the library, run `pnpm changeset`, commit the file under `.changeset/`, and merge to `main`.
82
- 2. The **Release** workflow opens or updates a **Version Packages** PR (bumps version, updates `CHANGELOG.md`).
83
- 3. Merging that PR publishes to npm (OIDC + provenance) and creates a GitHub Release.
84
- Publish must use **`npm publish`** (not `pnpm publish`) — OIDC only works with the npm CLI ([docs](https://docs.npmjs.com/trusted-publishers)).
85
-
86
- Current package version is in `package.json` (e.g. `0.2.0`). If publish failed after a version bump, fix the trusted-publisher config (workflow name must be exactly `release.yml`) and re-run **Release** — Changesets will publish any version not yet on npm.
87
-
88
- If CI fails with **`ENEEDAUTH`** or **`E404 Not Found - PUT …/pattapatta`**, treat it as auth failure (npm hides 401 as 404). Check:
89
-
90
- 1. Trusted Publisher on npmjs.com matches exactly: `MadOrkestra` / `pattapatta` / `release.yml`, and **`npm publish` is allowed** (new configs default to stage-only).
91
- 2. Release uses `scripts/publish-oidc.sh` → `npm publish` (Changesets would otherwise pick `pnpm publish`, which cannot OIDC).
92
- 3. Job has `id-token: write` and runs on a **GitHub-hosted** runner.
93
- 4. `package.json` `repository.url` matches `https://github.com/MadOrkestra/pattapatta.git`.
94
-
95
- Local checks used by CI:
96
-
97
- ```bash
98
- pnpm install --frozen-lockfile
99
- pnpm test
100
- pnpm typecheck
101
- pnpm build
102
- ```
103
-
104
61
  ## License
105
62
 
106
63
  MIT — clean-room implementation (not a GPL line-port of PGS). See `docs/decisions/`.
@@ -1,6 +1,80 @@
1
+ import { V as Vec2 } from '../vec2-CWyXN1Wj.js';
1
2
  import { P as Path } from '../path-0RjhYjJs.js';
2
3
  import { G as Group } from '../group-BNjVVYSQ.js';
3
- import '../vec2-CWyXN1Wj.js';
4
+ import { S as Segment } from '../segment-BKuIFMKD.js';
5
+
6
+ /**
7
+ * Chordal Axis Transform: join midpoints of interior chords / centroids of
8
+ * terminal & junction triangles from a densified Delaunay triangulation.
9
+ */
10
+ declare function chordalAxis(shape: Path): Group;
11
+
12
+ /**
13
+ * Approximate medial axis via Voronoi edges of densified boundary samples.
14
+ * Returns pruned dissolved polylines.
15
+ *
16
+ * Thresholds in [0,1]: 0 = no pruning, 1 = maximum pruning.
17
+ */
18
+ declare function medialAxis(shape: Path, axialThreshold?: number, distanceThreshold?: number, areaThreshold?: number): Group;
19
+ /**
20
+ * Longest center line through the medial axis, smoothed.
21
+ */
22
+ declare function centerLine(shape: Path, straightnessWeighting?: number, smoothing?: number): Path;
23
+
24
+ type StraightSkeletonParts = {
25
+ faces: Group;
26
+ branches: Group;
27
+ bones: Group;
28
+ };
29
+ /**
30
+ * Straight skeleton approximation via successive inward miter offsets.
31
+ *
32
+ * Returns a flat GROUP: closed face paths, then branch polylines, then bone
33
+ * polylines. Prefer {@link straightSkeletonParts} for structured access.
34
+ *
35
+ * Exact kinetic straight skeletons are deferred; this offset-trace method is
36
+ * robust, terminates, and yields plotter-useful bones/branches/faces.
37
+ */
38
+ declare function straightSkeleton(shape: Path): Group;
39
+ declare function straightSkeletonParts(shape: Path): StraightSkeletonParts;
40
+
41
+ /**
42
+ * Interior isolines of field `d_boundary − d_pole`.
43
+ * Default pole is the maximum inscribed circle center.
44
+ */
45
+ declare function distanceField(shape: Path, spacing: number, pole?: Vec2): Group;
46
+ /**
47
+ * Contrast field isolines: `|d_boundary − d_reference|`.
48
+ */
49
+ declare function contrastField(shape: Path, intervals: number, reference: Vec2): Group;
50
+ /**
51
+ * Isolines from a high point inside a shape (topographic style).
52
+ * Height ≈ distance from highPoint (negated outside).
53
+ */
54
+ declare function isolines(shape: Path, highPoint: Vec2, intervalSpacing: number): Group;
55
+
56
+ /**
57
+ * BFS shortest-path tree on a mesh (GROUP of polygonal faces).
58
+ * `flatten`: unique tree edges as polylines; else one path per target vertex.
59
+ */
60
+ declare function distanceTree(mesh: Group, source: Vec2, flatten: boolean): Group;
61
+
62
+ type ScalarField = (x: number, y: number) => number;
63
+ /**
64
+ * Extract isolines of `fn` over an axis-aligned box via marching squares.
65
+ * Contours are generated at multiples of `contourInterval` between
66
+ * `isolineMin`/`isolineMax` (auto-scanned when omitted).
67
+ */
68
+ declare function isolinesFromFunction(bounds: [number, number, number, number], sampleSpacing: number, contourInterval: number, fn: ScalarField, isolineMin?: number, isolineMax?: number): Group;
69
+ /** Isolines where `fn(x,y) === 0`. */
70
+ declare function isolineZeroFromFunction(bounds: [number, number, number, number], sampleSpacing: number, fn: ScalarField): Group;
71
+ /** Point-set isolines: each point carries z in `.z` via a parallel array. */
72
+ declare function isolinesFromPoints(points: Vec2[], values: number[], intervals: number, _smoothing?: number): Group;
73
+
74
+ /**
75
+ * Chain connected segments into maximal-length open polylines.
76
+ */
77
+ declare function dissolveSegments(segments: Segment[]): Group;
4
78
 
5
79
  /**
6
80
  * Offset the path outward by `distance` (positive buffer).
@@ -15,6 +89,19 @@ declare function offsetCurvesInward(p: Path, distance: number): Group;
15
89
  declare const contour: {
16
90
  offsetCurvesOutward: typeof offsetCurvesOutward;
17
91
  offsetCurvesInward: typeof offsetCurvesInward;
92
+ medialAxis: typeof medialAxis;
93
+ chordalAxis: typeof chordalAxis;
94
+ straightSkeleton: typeof straightSkeleton;
95
+ straightSkeletonParts: typeof straightSkeletonParts;
96
+ centerLine: typeof centerLine;
97
+ distanceField: typeof distanceField;
98
+ contrastField: typeof contrastField;
99
+ distanceTree: typeof distanceTree;
100
+ isolines: typeof isolines;
101
+ isolinesFromFunction: typeof isolinesFromFunction;
102
+ isolineZeroFromFunction: typeof isolineZeroFromFunction;
103
+ isolinesFromPoints: typeof isolinesFromPoints;
104
+ dissolveSegments: typeof dissolveSegments;
18
105
  };
19
106
 
20
- export { contour, offsetCurvesInward, offsetCurvesOutward };
107
+ export { type ScalarField, type StraightSkeletonParts, Vec2, centerLine, chordalAxis, contour, contrastField, dissolveSegments, distanceField, distanceTree, isolineZeroFromFunction, isolines, isolinesFromFunction, isolinesFromPoints, medialAxis, offsetCurvesInward, offsetCurvesOutward, straightSkeleton, straightSkeletonParts };