@playcanvas/splat-transform
Version:
Library and CLI tool for 3D Gaussian splat format conversion and transformation
101 lines (100 loc) • 3.48 kB
TypeScript
import { Mat4, Quat, Vec3 } from 'playcanvas';
declare const sigmoid: (v: number) => number;
/**
* A source-to-engine coordinate transform comprising translation, rotation
* and uniform scale. Lives alongside a DataTable to describe how raw
* column data maps to PlayCanvas engine coordinates.
*
* @example
* ```ts
* const t = new Transform().fromEulers(0, 0, 180);
* console.log(t.isIdentity()); // false
*
* const inv = t.clone().invert();
* console.log(t.mul(inv).isIdentity()); // true
* ```
*/
declare class Transform {
translation: Vec3;
rotation: Quat;
scale: number;
constructor(translation?: Vec3, rotation?: Quat, scale?: number);
/**
* Sets this transform to a rotation-only transform from Euler angles in degrees.
*
* @param x - Rotation around X axis in degrees.
* @param y - Rotation around Y axis in degrees.
* @param z - Rotation around Z axis in degrees.
* @returns This transform (for chaining).
*/
fromEulers(x: number, y: number, z: number): Transform;
/**
* Creates a deep copy of this transform.
*
* @returns A new Transform with the same values.
*/
clone(): Transform;
/**
* Tests whether this transform equals another within the given tolerance.
* Quaternion comparison accounts for double-cover (q and -q represent
* the same rotation).
*
* @param other - The transform to compare against.
* @param epsilon - Floating-point tolerance. Defaults to 1e-6.
* @returns True if the transforms are equal within the tolerance.
*/
equals(other: Transform, epsilon?: number): boolean;
/**
* Tests whether this transform is effectively identity within the given tolerance.
*
* @param epsilon - Floating-point tolerance. Defaults to 1e-6.
* @returns True if identity within the tolerance.
*/
isIdentity(epsilon?: number): boolean;
/**
* Inverts this transform in-place.
*
* @returns This transform (for chaining).
*/
invert(): Transform;
/**
* Sets this transform to the composition of a * b. Handles aliasing
* (either a or b may be this).
*
* @param a - The first (left) transform.
* @param b - The second (right) transform.
* @returns This transform (for chaining).
*/
mul2(a: Transform, b: Transform): Transform;
/**
* Sets this transform to this * other.
*
* @param other - The transform to multiply with.
* @returns This transform (for chaining).
*/
mul(other: Transform): Transform;
/**
* Transforms a point by this TRS transform: result = translation + rotation * (scale * point).
*
* @param point - The input point.
* @param result - The Vec3 to write the result into (may alias point).
* @returns The transformed point.
*/
transformPoint(point: Vec3, result: Vec3): Vec3;
/**
* Fills the provided Mat4 with the TRS matrix for this transform.
*
* @param result - The Mat4 to fill.
* @returns The filled Mat4.
*/
getMatrix(result: Mat4): Mat4;
static freeze(t: Transform): Readonly<Transform>;
static IDENTITY: Readonly<Transform>;
/**
* PLY coordinate convention: 180-degree rotation around Z.
* Used by formats that store Gaussian data in PLY-style coordinates:
* PLY, splat, KSplat, SPZ, and SOG.
*/
static PLY: Readonly<Transform>;
}
export { sigmoid, Transform };