plozone

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

105 tests 6,100+ LOC Edition 2024 MIT
GitHub Documentation crates.io

Why Plozone?

FeaturePlozoneOctoMapTile38rstar
3D zone shapesfullvoxel only2D polygonsAABB only
Hole scanningoctree-basedyesnono
Dynamic zones (runtime)yesnopartialno
Realtime sync (WS + QUIC)yesnoWSno
Game / arbitrary coordsyesnonono
AV stack (EKF, V2X, HD map)yesnonono
no_std embeddedyesnonopartial
Voxel pathfindingA*nonono
Rust-nativeyesC++ bindingsGo serveryes

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

Serializable Zone enum with 5+ built-in shapes + trait-based custom shapes. R-tree indexed for <1 μs point queries at 100k zones.

Octree Hole Scanner

Adaptive-density octree (depth 17 max, ~4mm voxels) with single-pass and multiscale hole detection. Coverage % reporting.

Realtime Sync

WebSocket + QUIC + io_uring transports. Sharded server to 300k entities at <1ms p99. Lock-free AtomicPos for position updates.

Voxel Pathfinding

3D A* over the octree. Works with zone-aware occupancy — doors, walls, cylindrical columns are all zones that block traversal.

AV Stack

EKF IMU fusion, sensor FOV zones (camera/lidar/radar), safety envelope, HD map lane graph, behaviour zones, V2X beacons.

Game Coords

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

Wire Protocol

Postcard-encoded messages with LZ4/ZSTD compression. Dead-reckoning via PosTracker. Versioned wire snapshots for forward compatibility.

Terrain & Mesh

Marching cubes surface extraction from octree density. OBJ/PLY export, density export. TSDF/ESDF planned for v0.2.

Performance

OperationTime
Zone query (1k zones, R-tree)~730 ns
Octree batch insert 1k pts~435 μs
Hole scan depth 4~12 μs
Coord WGS84 → ENU~128 ns
Coord ENU → WGS84~655 ns

Scale

TierEntitiesZonesLatency p99Infra
Single process, tokio~5k~100k< 5 ms1 server
Sharded (16), tokio~80k~100k< 2 ms1 server
Sharded (64), io_uring~300k~500k< 1 ms1 server
Multi-process cluster~5M+unlimited< 5 msLB + N servers