Got the math from here: https://www.wolframalpha.com/input/?i=%7By+%3D+Re%28sqrt%28abs%28x%29%281-abs%28x%29%29%29%29%2C+y+%3D+Re%28-sqrt%281-sqrt%28abs%28x%29%29%29%29%7D

Ha ... I saw the math on wolfram :(

Yours is much more concise.

Yes but consider this, @tonetheman. It should be possible to make one that uses only acceleration values to generate curves and be very small code indeed.

Want to try and tackle it ? :)

Ha prob not... I was just happy I got the one I posted working. :) :) :)

Here it is. Using a table:

heart={0,-1,-1,0,2,0,1,2,1,0,1,1,1,2} |

And optional crystal effect that can be turned off. Ah maybe the code is not so small now:

UPDATED (color palette was skewed)

-- crystal heart by dw817 -- (02-13-20) crystal=4 -- =0 off >=1 step x=64 y=48 c=1 n=0 cls() pal={1,13,14,15,14,13,1,2,8,9,10,9,8,2,3,11,10,11,3,1,13,12,7,12,13} heart={0,-1,-1,0,2,0,1,2,1,0,1,1,1,2} ax1=heart[1] ay1=heart[2] for i=3,#heart,3 do ax2=heart[i] ay2=heart[i+1] d=heart[i+2] for j=1,26*d do if crystal>0 then n+=1 if n%crystal==1 then line(64,48,x,y,pal[c]) line(63,48,127-x,y,pal[c]) c+=1 if (c==26) c=1 end end pset(x,y,7) pset(127-x,y) x+=ax1 y+=ay1 if (ax1<ax2) ax1+=.02 if (ax1>ax2) ax1-=.02 if (ay1<ay2) ay1+=.02 if (ay1>ay2) ay1-=.02 ax1=mid(-1,ax1,1) ay1=mid(-1,ay1,1) repeat flip() until btn(4) end end |

Hold down (O) to see it drawn.

Thanks !

But what you're doing is equally interesting, and your heart has a magnificent curve at the bottom. The only time I've ever used SQRT is calculating hit points and stuff based off experience points. Never for drawing. Something for me to learn.

Gold star for your sterling and beautiful work here, @tonetheman.

[Please log in to post a comment]