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 delta-encoded base64 string. The first point is stored as Float32 for full precision.

static decodeFirstPoint(b64Points: string): null | VecModel

Parameters

NameDescription

b64Points

string

The delta-encoded base64 string

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 delta-encoded base64 string. Requires decoding all points to accumulate deltas.

static decodeLastPoint(b64Points: string): null | VecModel

Parameters

NameDescription

b64Points

string

The delta-encoded base64 string

Returns

null | VecModel

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


decodePoints( )

static

Decode a delta-encoded base64 string back to an array of absolute VecModels. The first point is stored as Float32 (high precision), subsequent points are Float16 deltas that are accumulated to reconstruct absolute positions.

static decodePoints(base64: string): VecModel[]

Parameters

NameDescription

base64

string

The base64-encoded string containing delta-encoded point data

Returns

VecModel[]

An array of VecModel objects with absolute coordinates


encodePoints( )

static

Encode an array of VecModels using delta encoding for improved precision. The first point is stored as Float32 (high precision for absolute position), subsequent points are stored as Float16 deltas from the previous point. This provides full precision for the starting position and excellent precision for deltas between consecutive points (which are typically small values).

Format: - First point: 3 Float32 values = 12 bytes = 16 base64 chars - Delta points: 3 Float16 values each = 6 bytes = 8 base64 chars each

static encodePoints(points: VecModel[]): string

Parameters

NameDescription

points

VecModel[]

An array of VecModel objects to encode

Returns

string

A base64-encoded string containing delta-encoded points


Prev
ZoomTool
Next
EnumStyleProp