• Remix
  • Share
  • New Entry

on 25 Nov 2023
  • 13
  • 34
  • 0
  • 0
  • 695
drawframe(1);
Remix of Dhimas's Graph Equation of "Flower Batik" on Cartesian Plane
Write your drawframe function below
% The word batik is Javanese in origin. The word bathikan also means "drawing" or "writing" in Javanese.
% Graph Equation of Batik Patterns Created by Dhimas Mahardika S.Si., M.Mat
% Sanggung Utara, Jatingaleh, Candisari, Semarang
% UNDIP
function drawframe(f)
if mod(f,2)==0; return; end % Skip every second frame
persistent p
if f==1
p = linspace(-0,1,50);
maxxy = 12;
syms x y
m=2*cos(x).*cos(y)+abs(cos(2*x)-cos(2*y));
eqn = ((m^2) - 3.25).*((m^(-2)) - 2)== 0 + p(48);
h =fimplicit(eqn, maxxy*[-1 1 -1 1], MeshDensity=1000,Visible='off');
hold on
nc = 13;
color = turbo(nc+2);
color(1:2,:) = []; % Remove the darker blues
isn = [0,find(isnan(h.XData)),numel(h.XData)+1];
maxDist = sqrt(2*maxxy^2);
p = gobjects(numel(isn)-1,1);
for i = 1:numel(isn)-1
idx = isn(i)+1:isn(i+1)-1;
xd = h.XData(idx);
yd = h.YData(idx);
distance = hypot(mean(xd),mean(yd));
c = round(distance/maxDist*(nc-1))+1;
p(i) = patch(xd, yd, color(c,:));
end
set(gca,'Position',[0 0 1 1])
axis equal off
xlim(maxxy*[-1 1]*.75)
ylim(xlim())
hold off
end
rotate(p,[0 0 -1], 360/96)
end
Animation
Remix Tree