UNPKG

@playcanvas/splat-transform

Version:

Library and CLI tool for 3D Gaussian splat format conversion and transformation

69 lines (68 loc) 2.36 kB
import { TypedArray } from './data-table'; /** * Pre-computed per-Gaussian inverse transform data for evaluating * Gaussian contribution at arbitrary 3D points. */ interface GaussianInverseTransform { /** Inverse rotation quaternion (w, x, y, z) with xyz negated */ qw: number; qx: number; qy: number; qz: number; /** Inverse scale: exp(-log_scale) per axis */ isx: number; isy: number; isz: number; /** Linear opacity (sigmoid of raw logit) */ alpha: number; } /** * Compute the inverse transform for a single Gaussian. * * @param rotW - Quaternion w component. * @param rotX - Quaternion x component. * @param rotY - Quaternion y component. * @param rotZ - Quaternion z component. * @param logScaleX - Log scale x. * @param logScaleY - Log scale y. * @param logScaleZ - Log scale z. * @param opacityLogit - Raw opacity logit value. * @returns Inverse transform parameters. */ declare const computeGaussianInverse: (rotW: number, rotX: number, rotY: number, rotZ: number, logScaleX: number, logScaleY: number, logScaleZ: number, opacityLogit: number) => GaussianInverseTransform; /** * Evaluate a Gaussian's opacity contribution at a 3D point. * * Uses the Rodrigues cross-product formula for inverse rotation, * then computes the Mahalanobis distance in the Gaussian's local frame. * * @param g - Pre-computed inverse transform of the Gaussian. * @param px - Gaussian center x. * @param py - Gaussian center y. * @param pz - Gaussian center z. * @param vx - Evaluation point x. * @param vy - Evaluation point y. * @param vz - Evaluation point z. * @returns Opacity contribution at the evaluation point. */ declare const evaluateGaussianAt: (g: GaussianInverseTransform, px: number, py: number, pz: number, vx: number, vy: number, vz: number) => number; /** * Column arrays needed for Gaussian contribution evaluation. */ interface GaussianColumns { posX: TypedArray; posY: TypedArray; posZ: TypedArray; rotW: TypedArray; rotX: TypedArray; rotY: TypedArray; rotZ: TypedArray; scaleX: TypedArray; scaleY: TypedArray; scaleZ: TypedArray; opacity: TypedArray; extentX: TypedArray; extentY: TypedArray; extentZ: TypedArray; } export { evaluateGaussianAt, computeGaussianInverse, type GaussianColumns, type GaussianInverseTransform };