Luxar Viewer API Documentation - v2026.10.19
    Preparing search index...

    Function projectSphereAreaPx

    • Project a view-space sphere to its screen ellipse area in buffer pixels.

      Perspective: radii scale by P[0]/depth and P[5]/depth (the projection matrix's focal terms); the centre also includes P[8]/P[9] for off-axis projections. One wholly behind the eye (depth < -radius) is off-screen. One crossing the eye plane (|depth| <= radius) is full-buffer only when the eye is INSIDE it (|centre| <= radius); otherwise (a node running past the camera) it reads the clipped rect of its view-space box's part in front of the near plane, like the LOD metric's straddling rule (lod-selector-math.ts). Orthographic: the focal terms apply without the depth division. Off-screen (the ellipse does not touch the NDC square) returns 0; otherwise the ellipse area, clipped to the buffer. The clip is a coarse min, not an exact intersection — the guard only needs the order of magnitude.

      Parameters

      • centerView: { x: number; y: number; z: number }
      • radius: number
      • camera: Camera
      • width: number
      • height: number

      Returns { areaPx: number; onScreen: boolean }