The input array of UV coordinates (each UV pair consisting of [u, v]).
The minimum values for [u, v] coordinates to scale to the quantized range.
The maximum values for [u, v] coordinates to scale to the quantized range.
quantized
: The quantized UV coordinates as a Uint16Array.decompressMatrix
: A matrix (either FloatArray or Float64Array) used to decompress the quantized UVs back to their original values.
Compresses a flat array of UV coordinates into a quantized representation.
This function maps the input UV coordinates to a 16-bit integer range [0, 65535] based on the provided min and max bounds for each coordinate. The resulting quantized UVs are returned along with a matrix that can be used to decompress them back to their original range. This is commonly used in texture mapping for more efficient storage.
The compression uses a simple linear transformation based on the provided min and max values for each component of the UV coordinates.