Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannabis curve
#1
Someone posted this in a facebook group:

Code:
' Cannabis curve
' --------------

set window "Cannabis curve", 640, 480
set redraw off

set color 0, 200, 0
px = 0; py = 0
for a = 0 to PI*2 step 0.01
    x = 320 + 100*(sin(a) + 1)*cos(a)*(9*cos(8*a)/10 + 1)*(cos(24*a)/10 + 1)*(cos(200*a)/10 + 9/10)
    y = 64 + 100*sin(a)*(sin(a) + 1)*(9*cos(8*a)/10 + 1)*(cos(24*a)/10 + 1)*(cos(200*a)/10 + 9/10)
    if a > 0  draw line px, py, x, y
    px = x; py = y
next
redraw

while not keydown(KEY_ESCAPE)  fwait 60

I first tried to put the points in an array and render with 'draw poly', but it crashed. I'll look into that, probably has to do with the point count.

(Yes, still working on the help ...)
Reply
#2
Ah yes, there's a hard coded limit of 64 points for polygons. I'll fix that and make it unlimited.
Reply
#3
Far out. I can dig it.
May your journey be free of incident.
Live long and prosper.
Reply
#4
   

I fixed the point limit thingy bug, so now it can make it look a bit better. I've fixed plenty of bugs without releasing a new version, but I want to have the help and new docs ready before updating.
Reply
#5
In the code posted in that facebook group (BASIC Programming Language, https://www.facebook.com/groups/2057165187928233) they used 'FILL'. Is that a command we might need? I also really like the 'DRAW TO' command, that takes a single point and continues from the last point drawn. I don't care that much for drawing "primitives" myself, but maybe others do?
Reply
#6
Nice

That's sure a lot of drawing for that short amount of code.
Reply
#7
(08-07-2022, 12:07 PM)Marcus Wrote: In the code posted in that facebook group (BASIC Programming Language, https://www.facebook.com/groups/2057165187928233) they used 'FILL'. Is that a command we might need? I also really like the 'DRAW TO' command, that takes a single point and continues from the last point drawn. I don't care that much for drawing "primitives" myself, but maybe others do?

For me, both the FILL and DRAW TO commands would be good to see implemented Marcus.
Reply
#8
Set the "way back" machine to the 13th of June 1985. That was the year that the Amstrad cpc6128 was released. (Ok. Keep the cheering under control. That is not my main point... lol) One year earlier (1984) saw the beginning of the cpc464. The '6128' had a very fast 'fill' command (for those days) and the owners of the '464' wanted the same. Many routines and patches later saw a fill routine but it was not as fast... at the cost of memory... This was the result of "adding" a feature.

I do not believe that N7 needs to have anything 'added'. Not added. Modified...

N7 already has 'fill' for ellipses and rectangles by the use of the final parameter, "1". N7 has 'draw polygon'. Modify the command to include the 'fill' parameter. The 'draw line' command (draw line x1,y1,x2,y2 actual coords) could be modified to draw line - x2,y2 relative coords). Just a few thoughts. Of course I have no idea how to do all this... lol

J
May your journey be free of incident.
Live long and prosper.
Reply
#9
I've added 'draw line to' here (also works with just 'draw line' but with only 2 parameters). Should the starting coordinates only be affected by the previous 'draw line [to]', 'draw pixel' and 'set pixel'? Polygons are always closed, so it wouldn't really make sens to let 'draw line [to]' continue from the last = first point? I will add 'fill' too. I believe I wrote an example, "Flood fill", in n6 that was quite fast and can be rewriten in C.

"N7 has 'draw polygon'. Modify the command to include the 'fill' parameter"

'draw poly' already has a fill parameter Smile
Reply
#10
Cool... No prizes given to the person who guesses that I do not use the 'fill' option with polygons... lol
May your journey be free of incident.
Live long and prosper.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)