1

Cart #simpleheart-0 | 2020-02-13 | Code ▽ | License: CC4-BY-NC-SA
1

P#73066 2020-02-13 17:09

P#73067 2020-02-13 17:11
:: dw817

It should be possible to do this without math:

 ```-- simple heart by dw817 -- (02-13-20) cls() circ(54,64,10,8) circ(74,64,10,8) rectfill(49,63,79,74,0) line(49,73,64,88,8) line(64,88,79,73,8) ```
P#73068 2020-02-13 18:39

Ha ... I saw the math on wolfram :(
Yours is much more concise.

P#73069 2020-02-13 19:02
:: dw817

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 ? :)

P#73072 2020-02-13 19:17

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

P#73080 2020-02-13 20:07

It's a good heart shape - parametric equations are fun. :D

Pretty easy to modify the code for other equations, too, looks like.

P#73082 2020-02-14 00:40
:: dw817
1

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 (ax1ax2) ax1-=.02 if (ay1ay2) 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.

P#73083 2020-02-14 01:24 ( Edited 2020-02-14 04:48)

Oh man that is sweeeeet!

P#73087 2020-02-14 03:02
:: dw817

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.

P#73089 2020-02-14 04:49 ( Edited 2020-02-14 07:23)