A simulated 32-beam spinning LiDAR sweeps a full 360° azimuth. Each channel i has a fixed elevation angle φi spread across the sensor's vertical field of view; at azimuth θ the beam direction is
d = (cosφ·sinθ, sinφ, cosφ·cosθ)
Each ray is intersected analytically against the ground plane and every obstacle's bounding box (a ray/AABB slab test); the nearest positive hit becomes one 3D point, with small Gaussian range noise added for realism.
1. Ground segmentation — RANSAC. Real LiDAR returns arrive with no ground/obstacle label attached. The pipeline repeatedly samples 3 random points, fits the plane through them (ax+by+cz+d=0, unit normal), and counts inliers within the threshold distance |ax+by+cz+d| < ε. Candidate planes whose normal tilts more than ~35° from vertical are rejected (a wall or a car door is not "ground"). The plane with the most inliers after many random trials wins — this is the classic RANSAC (RANdom SAmple Consensus) estimator, and it's exactly the technique used to strip the road surface out of a real autonomous-vehicle point cloud before object detection runs.
2. Object clustering — voxel-grid connected components. The remaining non-ground points are hashed into a 3D grid of cells sized to the clustering distance; two points are linked if they fall in the same or an adjacent cell and are within that distance of each other, using union-find to merge chains of linked points into connected components. This is a fast approximation of Euclidean cluster extraction — each surviving component (above a minimum point count) becomes one detected object, boxed by its axis-aligned bounding extent.
- Channels — vertical beam count; more channels resolve object shape at range but cost more points per sweep.
- Angular resolution — horizontal points per revolution; coarser settings under-sample thin or distant objects.
- Scan rate — sweep frequency; faster sweeps update the scene sooner but each individual sweep still covers the full 360°.
- RANSAC threshold — how far a point may sit from the fitted plane and still count as "ground"; too loose swallows low obstacles, too tight fragments the road into noise.