MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / project

Function project

graph-ui/src/galaxy/path-frame.test.ts:5–10  ·  view source on GitHub ↗
(point: { x: number; y: number; z: number }, frame: ReturnType<typeof pathFrame>, viewport: { width: number; height: number }, fov: number)

Source from the content-addressed store, hash-verified

3
4/* A camera looking down -z with y up, as the scene sets it; projection by hand. */
5function project(point: { x: number; y: number; z: number }, frame: ReturnType<typeof pathFrame>, viewport: { width: number; height: number }, fov: number) {
6 const depth = frame.position.z - point.z;
7 const half = Math.tan((fov * Math.PI) / 360) * depth;
8 const aspect = viewport.width / viewport.height;
9 return { x: ((point.x - frame.position.x) / (half * aspect) + 1) / 2 * viewport.width, y: (1 - (point.y - frame.position.y) / half) / 2 * viewport.height };
10}
11
12describe('hand test K6: the camera frames a shown path', () => {
13 const view = { direction: { x: 0, y: 0, z: -1 }, up: { x: 0, y: 1, z: 0 } };

Callers 1

path-frame.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected