% Surface Revolution of a function will give us the target 3d shape that we wish to generate via tailoring % We can choose to split the patterns towards the end in order to reduce % the effect of wrinkling at ends with the boolean SPLIT. % Step 1: We plot the function to be rotated around x=0 or Y-axis. % Step 2: We plot the fraction of perimeter to be removed at a radius r. % Step 3: We draw the polar plot for our desired black and white precursor pattern. %% Step 1: We plot the function to be revolved around x=0 or Y-axis. clear all; clc; close all deltaX=0.01; % Set this to smaller value for a more continous pattern. xRangeStart=deltaX; xRangeEnd=1.4; x_Mat=xRangeStart:deltaX:xRangeEnd; A=1;%B=1; % Define the function which is to be revolved around y-axis. func=@(x) A*(x).^2;% Function to be revolved to obtain the surface % Use func2 as well in case of piecewise fuctions % syms func2(x); % func2(x) = (piecewise(0length(rMat)/2 % n=2*n_; % else % n=n_; % end n=n_; ThetaMat=0:2*pi/n:2*pi-2*pi/n; for j=1:1:n Theta = ThetaMat(j)-FracC(i)*2*pi/(2*n):0.0001:ThetaMat(j)+FracC(i)*2*pi/(2*n); %Generate the Radius vector R = rMat(i); %Create a grid from angle and Radius [ThetaG,RG] = meshgrid(Theta,R); %Create X,Y matrices calculated on grid. X = RG.*cos(ThetaG); Y = RG.*sin(ThetaG); %Calculate the function Z = RG; %Surf plot polarplot(ThetaG,RG,'.k','MarkerSize',3); hold on if(i>length(rMat)/2) Theta = ThetaMat(j)+(2*pi/(2*n))-FracLeft(i)*2*pi/(2*n):0.0001:... ThetaMat(j)+(2*pi/(2*n))+FracLeft(i)*2*pi/(2*n); %Generate the Radius vector R = rMat(i); %Create a grid from angle and Radius [ThetaG,RG] = meshgrid(Theta,R); %Create X,Y matrices calculated on grid. X = RG.*cos(ThetaG); Y = RG.*sin(ThetaG); %Calculate the function Z = RG; %Surf plot polarplot(ThetaG,RG,'.k','MarkerSize',3); hold on end end end grid off set(gca,'RTickLabel',[]); else FracC=alpha.*Frac; rMat=r_Mat; for i=2:1:length(rMat) i n=n_; ThetaMat=0:2*pi/n:2*pi-2*pi/n; for j=1:1:n Theta = ThetaMat(j)-FracC(i)*2*pi/(2*n):0.0001:ThetaMat(j)+FracC(i)*2*pi/(2*n); %Generate the Radius vector R = rMat(i); %Create a grid from angle and Radius [ThetaG,RG] = meshgrid(Theta,R); %Create X,Y matrices calculated on grid. X = RG.*cos(ThetaG); Y = RG.*sin(ThetaG); %Calculate the function Z = RG; %Surf plot polarplot(ThetaG,RG,'.k','MarkerSize',3); hold on end end grid off set(gca,'RTickLabel',[]); end