plozone

3D spatial zone engine — geofencing, octree hole-scanning, realtime sync, voxel pathfinding, and AV sensor fusion — all in Rust.

105 tests MIT edition 2024
GitHub docs.rs crates.io

Quick Start

// Cargo.toml
[dependencies]
plozone = { version = "0.1", features = ["full"] }

// main.rs
use plozone::{
    coord::EnuConverter,
    store::ZoneStore,
    zone::{Zone, ZoneEntry},
    scan::{run_scan, ScanMode},
};

let conv = EnuConverter::new(10.7626, 106.6601, 0.0);

let store = ZoneStore::from_entries(&[
    ZoneEntry::new(1, Zone::cylinder(10.7626, 106.6601, 50.0)
        .with_z_range(0.0, 20.0)
        .build()),
], &conv);

// Point-in-zone query
let hits = store.query_geodetic(10.7626, 106.6601, 5.0, &conv);
assert_eq!(hits.as_slice(), &[1]);

// Hole scan
let octree = OctreeNode::new([0.0; 3], 64.0);
let result = run_scan(&octree, &store, 1, &ScanMode::Coarse { depth: 4 });
println!("coverage: {:.1}%", result.coverage_pct);

Features

ZoneStore + R-tree

5+ built-in shapes plus custom trait-based zones. R-tree indexed for sub-microsecond point queries at 100k zones.

Octree Hole Scanner

Adaptive-density octree to depth 17 (~4mm voxels). Single-pass and multiscale hole detection with coverage % reporting.

Realtime Sync

WebSocket, QUIC, and io_uring transports. Sharded to 300k entities at <1ms p99 with lock-free AtomicPos updates.

Voxel Pathfinding

3D A* over the octree. Zones act as occupancy — doors, walls, pillars are all zone-driven blockers.

AV Stack

EKF IMU fusion, sensor FOV zones, safety envelope, HD map lane graph, V2X beacons.

Game Coords

GameWorld, LayeredMap, PortalSystem — arbitrary coordinate systems via CoordSystem trait. TiledWorld for planetary scale.

Wire Protocol

Postcard messages with LZ4/ZSTD compression. Dead-reckoning via PosTracker. Versioned snapshots.

Terrain & Mesh

Marching cubes surface extraction from octree density. OBJ/PLY export. TSDF/ESDF planned.

Performance

OperationTime
Zone query (1k zones)~730 ns
Octree batch insert 1k pts~435 µs
Hole scan depth 4~12 µs
WGS84 → ENU~128 ns
ENU → WGS84~655 ns

Scale

TierEntitiesZonesLatency p99
Single process (tokio)~5k~100k< 5 ms
Sharded 16 (tokio)~80k~100k< 2 ms
Sharded 64 (io_uring)~300k~500k< 1 ms
Multi-process cluster~5M+unlimited< 5 ms