Home▸Robotics & Kinematics▸2D LiDAR Ray-Casting: Point Cloud & Occupancy Grid

📡 2D LiDAR Ray-Casting: Point Cloud & Occupancy Grid

A 2D rotating LiDAR fires real line-segment-intersection rays around a room, plotting every hit as a point cloud and building a log-odds occupancy grid live. Tune angular resolution, range noise and scan speed.

Robotics & Kinematics2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-lidar ↗ Open standalone

This 2D companion strips the 3D LiDAR simulation down to the geometry that actually does the work: a rotating beam solved against wall segments with the parametric ray–segment intersection formula, rendered as a plain top-down floor plan instead of a 3D scene. A live point cloud on the left accumulates every noisy hit as the sensor sweeps, while a log-odds occupancy grid on the right fills in free and occupied cells in real time — the same two data structures a real 2D LiDAR-equipped robot builds while mapping a room, just with the underlying math made directly visible.

⚙ Under the hood

A rotating 2D LiDAR ray-casts against wall segments using real ray-segment intersection math, accumulating a point cloud and a log-odds occupancy grid live as it scans. Drag the sensor and switch environment presets to rescan.

LiDARray castingpoint cloudoccupancy gridrobotics mapping

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)