@tty-pt/areole logo

@tty-pt/areole

npm version License: BSD-2-Clause TypeScript Ready Node.js Native WebAssembly Spatial LOD

Universal Node.js and Browser bindings for libareole, the distance-adaptive multi-scale spatial quadtree, 6-plane Gribb-Hartmann frustum culling, and LOD hierarchy engine. Canonical C headers: <ttypt/areole.h> and <ttypt/areole_glsl.h>.

๐Ÿ“– Full C & Architectural Documentation: See the main libareole GitHub README for single-arena memory layouts (ar_config_t), 3D manifold AABB callbacks, and GLSL ES 3.0 vertex parity.


1. Overview & Domain Concepts

libareole (@tty-pt/areole) is a domain-agnostic spatial hierarchy and level-of-detail (LOD) culling engine for real-time 3D, 2.5D, and 2D procedural worlds:

  1. Single-Arena Zero-Allocation Traversal & O(1) LRU Pool:
  1. Exact SAT 6-Plane Frustum, 3D Manifold Horizon & 2D Software Hi-Z Occlusion Culling:
  1. Coarse-First Max-Heap LOD Selection, Continuous Vertex Morphing & Async Population ($O(1)$ Active Budget):
  1. Hierarchical Point, Attribute & Height-Only Probing (.probe(wx, wy) / ar_probe_val):

2. Installation

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

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


3. Quickstart

import { createAreoleSystem } from "@tty-pt/areole";

// 1. Allocate a spatial quadtree hierarchy (baseW = 160, baseH = 128)
const sys = createAreoleSystem(160, 128);

// 2. Query visible LOD chunks for the current 3D camera frustum
const nodes = sys.update({
  camX: 0,
  camY: 0,
  camZ: 120,
  pitch: 0.6,
  yaw: 0.0,
  fov: 1.0,
  zoom: 1.0,
  viewportW: 1920,
  viewportH: 1080,
  effCamDist: 400
}, 1 /* worldId */);

console.log("Visible LOD chunks:", nodes.length, nodes[0]);

// 3. Probe exact interpolated surface attributes at world coordinate (wx, wy)
const sample = sys.probe(32, 48, 1);
console.log("Probed sample:", sample);

// 4. Release arena allocation when finished
sys.destroy();

4. JavaScript / TypeScript API Reference

createAreoleSystem(baseW?, baseH?, gridDim?, poolCap?, maxActive?, maxLevels?): AreoleSystem

Creates an ar_system_t spatial hierarchy instance and returns an AreoleSystem controller:

AreoleSystem Methods

getAreoleWasm(): WebAssembly.Instance

Returns the initialized areole.wasm reactor instance on @tty-pt/stele's shared linear memory substrate.


5. C Development Headers & Native Integration

CFLAGS += -I./node_modules/@tty-pt/areole/include
LDLIBS += -lareole -lm

License

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

Documentation