Table 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( )

static

Get the first point from a base64-encoded string of points.

static decodeFirstPoint(b64Points: string): null | VecModel

Parameters

NameDescription

b64Points

string

The base64-encoded string containing point data

Returns

null | VecModel

The first point as a VecModel, or null if the string is too short


decodeLastPoint( )

static

Get the last point from a base64-encoded string of points.

static decodeLastPoint(b64Points: string): null | VecModel

Parameters

NameDescription

b64Points

string

The base64-encoded string containing point data

Returns

null | VecModel

The last point as a VecModel, or null if the string is too short


decodePoints( )

static

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

NameDescription

base64

string

The base64-encoded string containing point data

Returns

VecModel[]

An array of VecModel objects decoded from the string


encodePoint( )

static

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): string

Parameters

NameDescription

x

number

The x coordinate

y

number

The y coordinate

z

number

The z coordinate

Returns

string

An 8-character base64 string representing the point


encodePoints( )

static

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[]): string

Parameters

NameDescription

points

VecModel[]

An array of VecModel objects to encode

Returns

string

A base64-encoded string containing all points


Prev
ZoomTool
Next
EnumStyleProp