fileID = fopen('depth.txt', 'rb');
d = fread(fileID, nVertices, 'uint16');
vertices = struct('x', zeros(nVertices, 1), ...
'y', zeros(nVertices, 1), ...
'z', zeros(nVertices, 1), ...
'r', zeros(nVertices, 1), ...
'g', zeros(nVertices, 1), ...
'b', zeros(nVertices, 1), ...
'a', 255 * ones(nVertices, 1));
r_i = floor((i-1) / n_c);
d_i = double(d(i)) / double(MAX_DEPTH);
alpha_h = (pi - theta_h) / 2;
gamma_i_h = alpha_h + c_i * (theta_h / n_c);
vertices(i).x = d_i / tan(gamma_i_h);
alpha_v = 2 * pi - (theta_v / 2);
gamma_i_v = alpha_v + r_i * (theta_v / n_r);
vertices(i).y = d_i * tan(gamma_i_v) * -1;
points = [[vertices.x]', [vertices.y]', [vertices.z]'];
colors = [[vertices.r]', [vertices.g]', [vertices.b]'];
scatter3(points(:,1), points(:,2), points(:,3), 1, colors, 'filled');