Build a Bird’s-Eye-View Height Grid
Problem statement
Implement a bounded bird’s-eye-view module for 3D points.
For this exercise, assume a point cloud supplies integer triples [x,y,z], where x and y locate a point on the ground plane and z is its nonnegative height. Produce a rows by cols maximum-height grid. The ground-plane origin is (minX,minY) and each square cell has positive side length cellSize.
For this exercise, row r and column c cover minX+c*cellSize <= x < minX+(c+1)*cellSize and minY+r*cellSize <= y < minY+(r+1)*cellSize. Return the maximum z of all points inside each cell, or -1 if the cell is empty. Ignore points outside the grid. Repeated points contribute the same height and do not require special treatment. This practice version uses point-cloud rasterization; learned camera-to-BEV feature modules are outside scope.
Function
birdEyeView(points: int[][], rows: int, cols: int, minX: int, minY: int, cellSize: int) → int[][]Examples
Example 1
points = [[0,0,2],[1,1,5],[2,0,7],[0,2,3]]rows = 2cols = 2minX = 0minY = 0cellSize = 2return = [[5,7],[3,-1]]The first two points share cell [0][0], whose maximum height is 5. Columns follow x; rows follow y.
Example 2
points = [[-2,-2,0],[-1,-1,4],[0,0,9],[2,0,20]]rows = 2cols = 2minX = -2minY = -2cellSize = 2return = [[4,-1],[-1,9]]Negative world coordinates are allowed. The point at x=2 is on the exclusive outer edge and is ignored.
Example 3
points = []rows = 1cols = 2minX = 0minY = 0cellSize = 1return = [[-1,-1]]Cells with no points contain -1, including an empty input cloud.
Constraints
- For this exercise, assume
0 <= points.length <= 10000, with exactly three integers per point. 1 <= rows,cols <= 200, rows*cols <= 1024and1 <= cellSize <= 10000.- Point x/y coordinates and the origin lie in
[-1000000,1000000]; heights lie in[0,1000000].