@tty-pt/islet logo

@tty-pt/islet

npm version License: BSD-2-Clause TypeScript Ready Node.js Native WebAssembly Zero Dependencies

Universal Node.js and Browser bindings for libislet, the high-performance C99 spatial indexing engine and Morton Z-order curve coordinate mapper. Represents the canonical Space Axis in the Corm Recall Kernel. Canonical C headers: <ttypt/islet.h> and <ttypt/islet_quad.h>.

๐Ÿ“– Full C & Spatial Index Documentation: See the main libislet GitHub README for 2D/3D Morton Z-order curve bit-interleaving, interval bounding boxes, and C API details.


1. Quickstart & Installation

npm config set @tty-pt:registry https://tty.pt/npm/
npm install @tty-pt/islet

Native OS & Mobile Packages (tty.pt): Prebuilt native C packages (libislet) for Linux (apt, apk, pacman, dnf), macOS (brew), Windows (winget, MSYS2), and OpenBSD (pkg_add), plus static mobile sysroots for Android (https://tty.pt/android/) and iOS (https://tty.pt/ios/ โ€” libislet.xcframework) are available via the tty.pt package repositories.

import { encodeMorton2D, decodeMorton2D, SpatialIndex } from "@tty-pt/islet";

// 1. Map 2D coordinates to 64-bit Morton code preserving spatial locality
const code = encodeMorton2D(100, 200);
console.log("Morton code:", code);

// 2. Decode back to original coordinates
const { x, y } = decodeMorton2D(code);
console.log(`Decoded: (${x}, ${y})`); // (100, 200)

// 3. Spatial entity indexing & bounding box range queries
const index = new SpatialIndex("./floorplan.islet");
index.put(15, 25, 101 /* Desk 101 */);
index.put(40, 50, 102 /* Desk 102 */);

const deskId = index.get(15, 25); // 101

2. Practical Use Cases


3. JavaScript / TypeScript API Reference

encodeMorton2D(x: number, y: number): bigint | number / decodeMorton2D(code: bigint | number): { x: number, y: number }

Interleaves and reconstructs 2D coordinates (x, y) using a 64-bit Morton Z-order curve index. Executes strictly in compiled WebAssembly / C.

encodeMorton3D(x: number, y: number, z: number): bigint | number / decodeMorton3D(code: bigint | number): { x: number, y: number, z: number }

Interleaves and reconstructs 3D coordinates (x, y, z) using a 64-bit Morton Z-order curve index.

SpatialIndex

Spatial bounding-box and coordinate lookup index:

IsletSpatialAxis

Plug-and-play Space Axis adapter for the Corm Recall Kernel (@tty-pt/corm):

getIsletWasm(): WebAssembly.Instance

Returns the WebAssembly instance loaded on the Stele shared-memory substrate.


4. Dual-Engine Runtime


5. C Development Headers & Native Integration

CFLAGS += -I./node_modules/@tty-pt/islet/include
LDLIBS += -lislet

License

BSD-2-Clause โ€” Copyright (c) 2026, Paulo Quirino <quirinpa@gmail.com>. See LICENSE.