diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-01-16 14:27:10 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-01-16 14:27:10 -0500 |
commit | 37d09478a8fca4e1229dcb1246c9f23f1f6118df (patch) | |
tree | 79e2d5f9179987b46b5b743c552c29f94ffb999e /beam_tracing/plot_beams_and_faces_figure.m | |
parent | 28ef703f718ce7f540864ca8f9a301f8d7d3f3e0 (diff) | |
download | wgmr-37d09478a8fca4e1229dcb1246c9f23f1f6118df.tar.gz wgmr-37d09478a8fca4e1229dcb1246c9f23f1f6118df.zip |
move code to directory with speaking name
Diffstat (limited to 'beam_tracing/plot_beams_and_faces_figure.m')
-rw-r--r-- | beam_tracing/plot_beams_and_faces_figure.m | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/beam_tracing/plot_beams_and_faces_figure.m b/beam_tracing/plot_beams_and_faces_figure.m new file mode 100644 index 0000000..a63ac85 --- /dev/null +++ b/beam_tracing/plot_beams_and_faces_figure.m @@ -0,0 +1,56 @@ +function plot_beams_and_faces_figure(border_limits, img, faces, fig_handle) + %% plot faces and beams images + % border_limits has coordinates of left bottom and right top coners + xlb=border_limits(1); + ylb=border_limits(2); + xrt=border_limits(3); + yrt=border_limits(4); + + [Ny,Nx]=size(img); + xc=linspace(xlb,xrt, Nx); + yc=linspace(ylb,yrt, Ny); + + figure(fig_handle); + %% dummy plot just to put axis in the proper directions + plot(xlb,ylb,'.', xrt,yrt, '.'); + hold on; + + + %% color map as gradient of particular color + Ncolors=64; % number of colors + % starting values + hsv_s=rgb2hsv([1,0,0]); + hue_f = hsv_s(1); + sat_f = hsv_s(2); + val_f = hsv_s(3); + % stop values + hue_s = hue_f; + sat_s = 0; + val_s = 1; + hue=linspace(hue_s,hue_f, Ncolors); + sat=linspace(sat_s,sat_f, Ncolors); + val=linspace(val_s,val_f, Ncolors); + cmap = hsv2rgb([hue', sat', val']); + + colormap( cmap ); + + %% plot ray images + imagesc(xc,yc, img); colorbar; + hold on; + + %% plot all faces + Nf=size(faces)(2); % number of faces + for i=1:Nf + hold on; + t=linspace(0,1,100); + xf=faces{i}.vertex1(1) + (faces{i}.vertex2(1)-faces{i}.vertex1(1))*t; + yf=faces{i}.vertex1(2) + (faces{i}.vertex2(2)-faces{i}.vertex1(2))*t; + plot(xf,yf, 'k-'); + end + + axis('equal'); + hold off; + + + +end |