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

Function frameDistance

graph-ui/src/galaxy/camera-frame.ts:72–88  ·  view source on GitHub ↗
(
    box: FrameBox,
    fovDegrees: number,
    aspect: number,
    margin: number = FRAME_MARGIN,
)

Source from the content-addressed store, hash-verified

70 * unsinniger Winkel ergeben die Untergrenze statt NaN.
71 */
72export function frameDistance(
73 box: FrameBox,
74 fovDegrees: number,
75 aspect: number,
76 margin: number = FRAME_MARGIN,
77): number {
78 const fov = (Math.max(1, Math.min(179, fovDegrees)) * Math.PI) / 180;
79 const half = Math.tan(fov / 2);
80 const safeAspect = Number.isFinite(aspect) && aspect > 0 ? aspect : 1;
81 const scale = Number.isFinite(margin) && margin > 0 ? margin : 1;
82 const height = Math.max(0, box.height) * scale;
83 const width = Math.max(0, box.width) * scale;
84 const vertical = height / 2 / half;
85 const horizontal = width / 2 / (half * safeAspect);
86 const distance = Math.max(vertical, horizontal);
87 return Number.isFinite(distance) ? Math.max(FRAME_MIN_DISTANCE, distance) : FRAME_MIN_DISTANCE;
88}
89
90/**
91 * Wie viel des Bildes das Gerahmte danach einnimmt, in beiden Richtungen.

Callers 3

computeFrameTargetFunction · 0.90
fitCameraFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected