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

Function project

graph-ui/src/galaxy/camera-frame.test.ts:158–185  ·  view source on GitHub ↗

Die Bildkoordinaten eines Punktes, gerechnet wie eine perspektivische Kamera.

(
    point: Vector3Like,
    fit: { eye: Vector3Like; center: Vector3Like; up: Vector3Like; normal: Vector3Like },
    fovDegrees: number,
    aspect: number,
)

Source from the content-addressed store, hash-verified

156
157/** Die Bildkoordinaten eines Punktes, gerechnet wie eine perspektivische Kamera. */
158function project(
159 point: Vector3Like,
160 fit: { eye: Vector3Like; center: Vector3Like; up: Vector3Like; normal: Vector3Like },
161 fovDegrees: number,
162 aspect: number,
163): { x: number; y: number; z: number } {
164 const sub = (a: Vector3Like, b: Vector3Like): Vector3Like =>
165 ({ x: a.x - b.x, y: a.y - b.y, z: a.z - b.z });
166 const dot = (a: Vector3Like, b: Vector3Like): number => a.x * b.x + a.y * b.y + a.z * b.z;
167 const cross = (a: Vector3Like, b: Vector3Like): Vector3Like => ({
168 x: a.y * b.z - a.z * b.y,
169 y: a.z * b.x - a.x * b.z,
170 z: a.x * b.y - a.y * b.x,
171 });
172 // Dieselbe Basis, die three aus lookAt baut: z zurueck zur Kamera, x =
173 // up x z, y = z x x.
174 const zAxis = fit.normal;
175 const xAxis = cross(fit.up, zAxis);
176 const yAxis = cross(zAxis, xAxis);
177 const d = sub(point, fit.eye);
178 const depth = -dot(d, zAxis);
179 const half = Math.tan((fovDegrees * Math.PI) / 360);
180 return {
181 x: dot(d, xAxis) / (depth * half * aspect),
182 y: dot(d, yAxis) / (depth * half),
183 z: depth,
184 };
185}
186
187/** Eine Wolke mit vorgegebener Ausdehnung, gedreht, deterministisch erzeugt. */
188function cloud(count: number, extents: [number, number, number], seed = 7): Vector3Like[] {

Callers 2

everyPointInsideFunction · 0.70

Calls 3

crossFunction · 0.70
subFunction · 0.70
dotFunction · 0.70

Tested by

no test coverage detected