b64Vecs
See source codeTable of contents
Utilities for encoding and decoding points using base64 and Float16 encoding. Provides functions for converting between VecModel arrays and compact base64 strings, as well as individual point encoding/decoding operations.
class b64Vecs {}Methods
decodeFirstPoint( )
Get the first point from a base64-encoded string of points.
static decodeFirstPoint(b64Points: string): null | VecModelParameters
| Name | Description |
|---|---|
| The base64-encoded string containing point data |
Returns
null | VecModelThe first point as a VecModel, or null if the string is too short
decodeLastPoint( )
Get the last point from a base64-encoded string of points.
static decodeLastPoint(b64Points: string): null | VecModelParameters
| Name | Description |
|---|---|
| The base64-encoded string containing point data |
Returns
null | VecModelThe last point as a VecModel, or null if the string is too short
decodePoints( )
Convert a base64 string back to an array of VecModels. Decodes Float16-encoded coordinates (x, y, z) from the base64 string.
static decodePoints(base64: string): VecModel[]Parameters
| Name | Description |
|---|---|
| The base64-encoded string containing point data |
Returns
VecModel[]An array of VecModel objects decoded from the string
encodePoint( )
Encode a single point (x, y, z) to 8 base64 characters. Each coordinate is encoded as a Float16 value, resulting in 6 bytes total.
static encodePoint(x: number, y: number, z: number): stringParameters
| Name | Description |
|---|---|
| The x coordinate |
| The y coordinate |
| The z coordinate |
Returns
stringAn 8-character base64 string representing the point
encodePoints( )
Convert an array of VecModels to a base64 string for compact storage. Uses Float16 encoding for each coordinate (x, y, z). If a point's z value is undefined, it defaults to 0.5.
static encodePoints(points: VecModel[]): stringParameters
| Name | Description |
|---|---|
| An array of VecModel objects to encode |
Returns
stringA base64-encoded string containing all points