Jump to content

File talk:Squircle circle square.png

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

The messy and inefficient code for all of the squircle images:

clear

x = ([1:512]-256.5);

z = ones(512,1)*(x.^2);	

x = ones(512,1)*x;
y = x';

r = sqrt(z'+z);


circle = (r > 199 & r < 201);



x = ([1:512]-256.5);

z = ones(512,1)*(x.^4);	

x = ones(512,1)*x;
y = x';

r = sqrt(sqrt(z'+z));

squirc = (r > 199 & r < 201);


const = circle | squirc;

figure(1)
colormap(gray(256))
imagesc(~circle)
axis equal tight

figure(2)
colormap(gray)
imagesc(~squirc)
axis equal tight

figure(3)
colormap(gray)
imagesc(~const)
axis equal tight

rectangle ('position',[56 56 400 400])

figure(4)
colormap(gray)
imagesc(~squirc)
axis equal tight
rectangle ('position',[56.5 56.5 400 400], 'curvature',[0.5 0.5],'edgecolor','r')

Modest Genius talk 16:23, 24 September 2006 (UTC)[reply]