{"name":"scene-geometry","entry":"component","title":"SceneGeometry","description":"Shared points, bounds, arc-length path interpolation and travel tilt.","category":"Foundations","capabilities":[],"needsRemotion":false,"registryDependencies":[],"install":"npx shadcn@latest add @jbm/scene-geometry","installName":"scene-geometry","page":"https://jbm-ui.bns.studio/c/scene-geometry","registryItem":"https://jbm-ui.bns.studio/r/scene-geometry.json","sourcePath":"registry/jbm/lib/geometry.ts","files":[{"source":"registry/jbm/lib/geometry.ts","target":"src/jbm/lib/geometry.ts","import":"@/jbm/lib/geometry","type":"registry:lib"}],"endpoints":{"markdown":"https://jbm-ui.bns.studio/catalog/scene-geometry.md","json":"https://jbm-ui.bns.studio/catalog/scene-geometry.json"},"snippet":"import { pointOn, pathTilt } from \"@/jbm/lib/geometry\"\n\nconst path = [{ x: 40, y: 170 }, { x: 220, y: 50 }, { x: 460, y: 130 }]\nconst at = pointOn(path, 0.5)\nconst angle = pathTilt(path, 0.5)\n<g transform={`translate(${at.x} ${at.y}) rotate(${angle})`} />","api":[{"export":"unit","kind":"function","summary":"Clamps a progress value to 0–1, treating non-finite input as 0.","params":[{"name":"value","type":"number","required":true,"default":null,"description":"Any number, usually a progress value."}],"returns":"The value clamped to 0–1, or 0 when it is NaN or infinite."},{"export":"pointOn","kind":"function","summary":"Point at a fraction of a polyline's total length (arc-length, not per segment). Repeated points and a one-point path are valid; an empty path throws.","params":[{"name":"path","type":"readonly Pt[]","required":true,"default":null,"description":"Polyline points in the caller's coordinate space; at least one."},{"name":"progress","type":"number","required":true,"default":null,"description":"0–1 fraction of the total length; clamped with unit."}],"returns":"A new { x, y } on the path; the last point at 1 or when the path has no length."},{"export":"pathTilt","kind":"function","summary":"Restrained travel tilt from the direction of travel around a progress point (sampled ±0.01), measured against horizontal regardless of left/right direction.","params":[{"name":"path","type":"readonly Pt[]","required":true,"default":null,"description":"Polyline points, as for pointOn."},{"name":"progress","type":"number","required":true,"default":null,"description":"0–1 fraction of the total length."}],"returns":"Degrees clamped to −18…18; positive when the path descends on screen (y grows)."},{"export":"Pt","kind":"type","summary":"A point { x, y } in scene (SVG user) units."},{"export":"Box","kind":"type","summary":"A Pt plus w and h: the top-left corner and size of a rectangle."}],"stage":{"mode":"n/a","reason":"Geometry helpers only; nothing renders. The gallery draws an example path to illustrate the points."},"examples":[{"title":"Place and tilt an object along a path","code":"import { pointOn, pathTilt } from \"@/jbm/lib/geometry\"\n\nconst path = [{ x: 40, y: 170 }, { x: 220, y: 50 }, { x: 460, y: 130 }]\nconst at = pointOn(path, 0.5)\nconst angle = pathTilt(path, 0.5)\n<g transform={`translate(${at.x} ${at.y}) rotate(${angle})`} />"}],"qa":["pointOn at 0, 0.5, and 1 returns the first point, the arc-length midpoint, and the last point; out-of-range progress clamps.","A path with repeated points or a single point never returns NaN.","pathTilt stays within ±18° on steep segments; objects moving right-to-left tilt the same way as left-to-right on the same slope."],"related":[{"name":"cajon","relation":"installed-by"},{"name":"mano","relation":"installed-by"},{"name":"pluma","relation":"installed-by"},{"name":"bandeja","relation":"installed-by"},{"name":"escritorio","relation":"installed-by"},{"name":"desk-top","relation":"installed-by"},{"name":"ejes","relation":"installed-by"},{"name":"desk-prop","relation":"installed-by"},{"name":"file-cabinet","relation":"installed-by"},{"name":"video-print","relation":"installed-by"},{"name":"hilo","relation":"installed-by"},{"name":"paper-line","relation":"installed-by"},{"name":"register","relation":"installed-by"},{"name":"slip","relation":"installed-by"},{"name":"stamp","relation":"installed-by"},{"name":"frontmatter","relation":"installed-by"},{"name":"folder-contents","relation":"installed-by"},{"name":"folder-carry","relation":"installed-by"}],"setup":{"namespace":"@jbm","componentsJson":{"registries":{"@jbm":"https://jbm-ui.bns.studio/r/{name}.json"}},"command":"npx shadcn@latest add @jbm/<name>","target":"src/jbm/","importAlias":"@/jbm/…","tsconfigPaths":{"@/*":["./src/*"]}},"rules":["Install through the @jbm namespace: each registry item JSON (/r/<name>.json) carries its files' contents and each guide is served at /docs/<slug>.md, so agents never need the source repository (it is public on GitHub for people browsing the code).","Files install to src/jbm/ and import as @/jbm/…, which needs the @/* → ./src/* path alias in tsconfig.json.","Items marked needsRemotion require the remotion package and must render inside a Remotion composition or Player; every other item works in any React page.","Use one vermilion accent per composition; accent2 is for annotations only and soft is for dark surfaces only.","Stages are 1920×1080 landscape and 1080×1920 vertical with declared safe areas; each item's stage field declares its size in stage pixels, and scenes compose from YAML-shaped specs with @jbm/scene-spec."],"links":{"catalog":"https://jbm-ui.bns.studio/catalog.json","llms":"https://jbm-ui.bns.studio/llms.txt"}}