Skip to main content

Module threed

Module threed 

Source
Expand description

Layered 2.5-D crowd locomotion for multi-storey environments.

In real buildings (stations, airports, malls, stadiums) pedestrians spend the vast majority of their time walking on a floor and only occasionally transition vertically via stairs, escalators, ramps, or lifts. Running full 3-D collision physics for every pedestrian all of the time is wasteful and numerically fragile.

The industry-standard approach (used by JuPedSim, MassMotion, Legion) is layered 2.5-D: each pedestrian lives on a floor (integer index) and its planar (x, y) motion is advanced by one of the 2-D models in the crate (Social Force by default). Vertical motion is scripted by the rustsim-mobility crate through FloorTransitions — the pedestrian reaches a connector, is placed on the next floor, and its planar state is preserved.

This module defines the data model:

  • Pedestrian3D — 2-D pose plus floor index and vertical offset.
  • WallPolygon3D — a polyline of 3-D segments, one per floor, used by renderers and per-floor-physics setup.
  • FloorTransition — a connector (stair, escalator, ramp, lift) that maps a 2-D region on floor A to a 2-D region on floor B with an associated travel time.
  • LayeredSpace — a container of floors, walls, and connectors.
  • step_layered — advance every pedestrian by one tick, delegating per-floor motion to a provided 2-D model step function.

Structs§

ActiveTransition
An active transition a pedestrian is currently riding.
FloorTransition
A connector between two floors.
LayeredScratch
Advance every pedestrian in peds by dt using planar_step as the per-floor physics and space for walls and connectors.
LayeredSpace
A multi-floor environment.
Pedestrian3D
A pedestrian in a layered 2.5-D environment.
WallPolygon3D
A polyline wall that spans a single floor.

Enums§

ConnectorKind
Kind of vertical connector.

Traits§

LayeredObserver
Per-pedestrian post-step observation hook for the layered 2.5-D drive.

Functions§

step_layered
Advance every pedestrian in peds by dt. Convenience wrapper that allocates one LayeredScratch per call and immediately drops it; prefer step_layered_scratch when the same simulation drives successive ticks.
step_layered_scratch
Zero-allocation variant of step_layered.
step_layered_scratch_observed
Observed variant of step_layered_scratch: identical semantics, plus a post-tick callback for every pedestrian.

Type Aliases§

FloorId
Integer floor index. 0 = ground floor, 1 = first floor, etc.
PlanarStepFn
Function that advances a slice of 2-D pedestrians on a single floor by dt.