gizlang/ply
3D Gaussian splats in the PLY files of 3DGS (binary, little endian, float properties), as a 3D model (gizai's Idol) makes them and a renderer (gizlang/meshdraw Stage.splats) or a model reads them. A splat is a row of WIDTH floats: x, y, z, the log scales, the rotation (w, x, y, z), the opacity before its sigmoid, the base color's spherical harmonic (f_dc) and, when it has them, the higher degrees' (f_rest).
import * as Ply from "gizlang/ply";Functions
read
function read(data: bytes): Gaussians throws stringThe splats of a 3DGS PLY file; any property it does not use is skipped.
Effects: fail, alloc.
write
function write(s: Gaussians, comments: Vec<string>): bytesS as a 3DGS PLY file (read reads it back): x, y, z, zero normals, f_dc, f_rest, opacity, scale and rot properties, each a float, with COMMENTS in its header.
Effects: fail, alloc.
comments
function comments(data: bytes): Vec<string> throws stringThe comments of a PLY file's header, each without its "comment ".
Effects: fail, alloc.
Constants
SPLAT
const SPLAT: i64 = 14The floats of a splat without higher degrees of color.