Home > 16-Surface-Reconstruction > Surface-Reconstruction > Functions > simulate_points_dem_15_flat.m

simulate_points_dem_15_flat

PURPOSE ^

% generate a set of points for dem-interpolation

SYNOPSIS ^

function [points,BB,dx,sigma_k,sigma_s,out_in,dem]=simulate_points_dem_15(d,n)

DESCRIPTION ^

% generate a set of points for dem-interpolation

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% generate a set of points for dem-interpolation
0002 
0003 function [points,BB,dx,sigma_k,sigma_s,out_in,dem]=simulate_points_dem_15(d,n)
0004 
0005 d=2*d
0006 N=(n-1)*d+1;
0007 %%
0008 % bounding box
0009 BB=[0,0,N+1,N+1];
0010 % grid size
0011 dx = 1;
0012 
0013 sigma_h = 0.03725;
0014 sigma_k = 1;
0015 sigma_s = 1;
0016 
0017 points = zeros(n*n,4);
0018 k=0;
0019 for i=1:n
0020     for j=1:n
0021         k=k+1;
0022         points(k,:)=[1+(i-1)*d,1+(j-1)*d,0,sigma_h];
0023     end
0024 end
0025 points(:,1:2)=points(:,1:2);
0026 Np=size(points,1);
0027 out_in=ones(Np,1);
0028 
0029 %%
0030 
0031 xmin = BB(1);
0032 ymin = BB(2);
0033 xmax = BB(3);
0034 ymax = BB(4);
0035 Nr = ceil((xmax-xmin)/dx)+1;
0036 Mc = ceil((ymax-ymin)/dx)+1;
0037 %points(:,3)=(points(:,3)-mean(points(:,3)))*sqrt(Nr)/4;
0038 % interpolation kernel
0039 sigma = min(Nr,Mc)/5;
0040 
0041 dem = zeros(Nr,Mc);
0042 for i=1:Nr
0043     for j=1:Mc
0044         dem(i,j)=sum(points(:,3).*...
0045             exp(-1/2*((i-1-(points(:,1)-xmin)/dx).^2+(j-1-(points(:,2)-ymin)/dx).^2)/sigma^2));
0046     end
0047 end
0048 
0049 figure
0050 hold on
0051 X=([0:Nr-1]'*ones(1,Mc))*dx+BB(1);
0052 Y=(ones(Nr,1)*[0:Mc-1])*dx+BB(2);
0053 surf(X,Y,dem)
0054 colormap(gray)
0055 alpha(0.3)
0056 %mesh(dem)
0057 
0058 %plot3(points(:,1)/dx+1,points(:,2)/dx+1,points(:,3),'.r','MarkerSize',20)
0059 plot3(points(:,1),points(:,2),points(:,3),'.r','MarkerSize',15)
0060 axis equal
0061 xlim([xmin-1,xmax+1]);
0062 ylim([ymin-1,ymax+1]);
0063 title(strcat('original grid, n=',num2str(n)));
0064 
0065 return

Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005