Skip to content

armgit / kiln

Public Imported from GitHub
0

Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.

test: align executable recipe and snapshot with optional guidance

Matt Kissingerb90a3ba382ad
diff --git a/src/__tests__/__snapshots__/prompt-api.test.ts.snap b/src/__tests__/__snapshots__/prompt-api.test.ts.snap
index e6a939ed..d842f2ea 100644
--- a/src/__tests__/__snapshots__/prompt-api.test.ts.snap
+++ b/src/__tests__/__snapshots__/prompt-api.test.ts.snap
@@ -230,8 +230,8 @@ await implicitSurface(sample: ([x,y,z]) => signedValue, { bounds: { min, max },
await metaballSurface(spheres: { center: [x,y,z], radius }[], { bounds, edgeLength, blend?, maxCells?, maxEvaluations? })
// Experimental smooth union of spheres meshed through implicitSurface. Uses polynomial
// blending; output has no UVs.
- // NOTE: Prefer this over hand-rolling smoothUnion fields for creatures, blobs and rounded
- // junctions. Match edgeLength to feature size.
+ // NOTE: Useful when a smooth union of sphere volumes fits the intended shape. Match
+ // edgeLength to feature size.
// e.g. const body = await metaballSurface([{ center: [0,0.4,0], radius: 0.35 }, { center:
// [0.2,0.55,0], radius: 0.22 }], { bounds: { min: [-0.6,-0.1,-0.5], max: [0.6,1,0.5] },
// edgeLength: 0.08 });
@@ -635,8 +635,9 @@ loftProfiles(sections: { profile: [x,z][], frame?: { origin, rotation } }[], opt
// e.g. const hull = loftProfiles([{ profile: wide }, { profile: narrow, frame: { origin:
// [0,2,0] } }]);
taperedTube(path: [x,y,z][], radii: number[], opts?: { radialSegments?: 20, creaseAngle?: 180, cap?: true, closed?: false, up?, twist?, sectionScale?: [side,depth][] })
- // Circular sweep with one radius per path station. Default creaseAngle 180 shades round
- // profiles smoothly; sample splines with catmullRomPath first.
+ // Circular sweep along a polyline with one radius per station. Default creaseAngle 180 shades
+ // round profiles smoothly. catmullRomPath can supply samples when a spline fits the intended
+ // path.
// e.g. const path = catmullRomPath([[0,0.5,0],[0.3,0.7,0],[0.5,0.4,0]], 6); const radii =
// path.map((_, i) => 0.08 - 0.06 * i / (path.length - 1)); const tail = taperedTube(path,
// radii);
diff --git a/src/__tests__/organic-contract.test.ts b/src/__tests__/organic-contract.test.ts
index 7c68b669..d259ed3d 100644
--- a/src/__tests__/organic-contract.test.ts
+++ b/src/__tests__/organic-contract.test.ts
@@ -3,13 +3,7 @@ import * as THREE from 'three';
import { readFileSync } from 'node:fs';
import { geometryDiagnostics, type Point3 } from '../geometry';
import { geometryPrimitives } from '../geometry-catalog';
-import {
- catmullRomPath,
- metaballSurface,
- smoothOrganic,
- spiralPath,
- taperedTube,
-} from '../organic';
+import { catmullRomPath, metaballSurface, spiralPath, taperedTube } from '../organic';
test('spline rejects unsafe derived counts before invoking the curve sampler', () => {
const sample = spyOn(THREE.CatmullRomCurve3.prototype, 'getPoints').mockImplementation(() => {
@@ -199,12 +193,10 @@ test('maintained organic curve recipe executes', () => {
);
const section = text.split('## Organic curves and blended volumes')[1]!;
const example = section.match(/```js\r?\n([\s\S]*?)```/)![1]!;
- const geometry = new Function(
- 'catmullRomPath',
- 'taperedTube',
- 'smoothOrganic',
- `${example}\nreturn soft;`,
- )(catmullRomPath, taperedTube, smoothOrganic);
+ const geometry = new Function('catmullRomPath', 'taperedTube', `${example}\nreturn limb;`)(
+ catmullRomPath,
+ taperedTube,
+ );
expect(geometryDiagnostics(geometry).boundaryEdges).toBe(0);
});