function h3d_scan_whats_your_view_test(scan) % function h3d_scan_whats_your_view_test(scan) % % Tests the function h3d_scan_whats_your_view() nrays = numel(scan.thetas_deg); nscans = numel(scan.tilt_deg); thetas = deg2rad(scan.thetas_deg); tilts = deg2rad(scan.tilt_deg); if thetas(1) > thetas(end) fprintf('I assume that thetas increase \n'); end if tilts(1) > tilts(end) fprintf('I assume that tilts increase \n'); end [visible, rho, singular] = h3d_scan_whats_your_view(scan, h3d_scan_tt2dir(thetas(1)-0.1, tilts(10))); assert(not(visible)); [visible, rho, singular] = h3d_scan_whats_your_view(scan, h3d_scan_tt2dir(thetas(end)+0.1, tilts(10))); assert(not(visible)); [visible, rho, singular] = h3d_scan_whats_your_view(scan, h3d_scan_tt2dir(thetas(10), tilts(1)-0.1)); assert(not(visible)); [visible, rho, singular] = h3d_scan_whats_your_view(scan, h3d_scan_tt2dir(thetas(10), tilts(end)+0.1)); assert(not(visible)); [visible, rho, singular] = h3d_scan_whats_your_view(scan, [-1;0;0]); assert(not(visible)); for k=1:nscans for i=1:nrays if not(scan.valid(k,i)) fprintf('X'); continue end theta = deg2rad(scan.thetas_deg(i)); tilt = deg2rad(scan.tilt_deg(k)); direction = h3d_scan_tt2dir(tilt, theta); [visible, rho, singular] = h3d_scan_whats_your_view(scan, direction); assert(visible == 1); if not(singular) assert(rho == scan.readings(k,i)); fprintf('.'); else fprintf('S'); end end fprintf('\n'); end