Posted: 8th Apr 2004 22:58
i made this ages ago but i want to see if it's any good, i havent sorted out the bg colours yet

tell me what u think
Posted: 11th Apr 2004 16:28
Ummm, it draws a circle. Wow. You do realise there is an INBUILT command to do just that, and its faster too.

You wanna know what i think? Personally, i think its stupid. But thats just me. I don't wanna start a flame war, but i'm just wondering why you posted this. Why did you post this?

Maybe you really are from "The Ministry of Insania"
Posted: 12th Apr 2004 1:54
It can be used in other applications. Not just drawing a circle, so I don't think it's stupid or a waste of time. Someone's going to find a use for this.
Posted: 12th Apr 2004 4:12
Here is a function that I used in an image editor, so like Mr Flibble said completly useless and stupid

+ Code Snippet
alt_circle(100,100,50)

wait key

function alt_Circle(xc as integer,yc as integer,r as integer)
`circle drawing functon, based off code from http://www.cs.unc.edu/~mcmillan/comp136/Lecture7/circle.html
  local x,y,r2,p as integer
  y = r : p = (5-r*4)/4
  if x = 0
    dot xc,yc+y : dot mem,xc,yc-y : dot xc+y,yc : dot xc-y,yc
  else
    if x = y
      dot xc+x,yc+y : dot xc-x,yc+y : dot xc+x,yc-y : dot xc-x,yc-y
    else
      if x < y
        dot xc+x,yc+y : dot xc-x,yc+y : dot xc+x,yc-y : dot xc-x,yc-y
        dot xc+y,yc+x : dot xc-y,yc+x : dot xc+y,yc-x : dot xc-y,yc-x
      endif
    endif
  endif
  while x < y
    inc x
    if p < 0 then inc p,2*x+1 else dec y : inc p,2*(x-y)+1
    if x = 0
      dot xc,yc+y : dot xc,yc-y : dot xc+y,yc : dot xc-y,yc
    else
      if x = y
        dot xc+x,yc+y : dot xc-x,yc+y : dot xc+x,yc-y : dot xc-x,yc-y
      else
        if x < y
          dot xc+x,yc+y : dot xc-x,yc+y : dot xc+x,yc-y : dot xc-x,yc-y
          dot xc+y,yc+x : dot xc-y,yc+x : dot xc+y,yc-x : dot xc-y,yc-x
        endif
      endif
    endif
  endwhile
endfunction


And a line drawing function.

+ Code Snippet
randomize timer()
alt_line(rnd(640),rnd(480),rnd(640),rnd(480))
wait key

function alt_line(x1 as integer,y1 as integer,x2 as integer,y2 as integer)
`line drawing funtion, based off code from http://www.gamedev.net/reference/articles/article1275.asp
  local deltax,deltay,x,y,i,xinc1,xinc2,yinc1,yinc2,den,num,numadd,numpixels as integer
  deltax = abs(x2-x1) : deltay = abs(y2-y1)
  x = x1 : y = y1
  if x2>=x1 then xinc1 = 1 : xinc2 = 1 else xinc1 = -1 : xinc2 = -1
  if y2>=y1 then yinc1 = 1 : yinc2 = 1 else yinc1 = -1 : yinc2 = -1
  if deltax >= deltay
    xinc1 = 0 : yinc2 = 0 : den = deltax : num = deltax / 2
    numadd = deltay : numpixels = deltax
  else
    xinc2 = 0 : yinc1 = 0 : den = deltay : num = deltay / 2
    numadd = deltax : numpixels = deltay
  endif
  for i = 0 to numpixels
    dot x,y : inc num,numadd
    if num >= den
      num = num - den : x = x + xinc1 : y = y + yinc1
    endif
    x = x + xinc2 : y = y + yinc2
  next i
endfunction
Posted: 12th Apr 2004 18:33
yeah it isnt that useless, and building refined my coding skills so it was useful to me

in addition, its possible to make it make a spiral by changing the code slightly, but im not going to make that one unless ive got time on my hands
Posted: 16th Apr 2004 21:01
as this is a 'stupid thread' I'll post something useless to

+ Code Snippet
ellips(200,100,250,250)
sync
wait key

function ellips(width,height,xpos,ypos)
oldx = 1*width+xpos
oldy = 0*height+ypos
For x=0 to 360
if newx<>0 and newy<>0
oldx = newx
oldy = newy
endif
newx = (cos(x)*width)+xpos
newy = (sin(x)*height)+ypos
line oldx,oldy,newx,newy
next x
endfunction
Posted: 17th Apr 2004 3:48
N30F15H
your line:
for n=1 to 500

is a bit redundant. n = 1 to 360 would generate a full circle, anything more than 360 wastes some processing power, however miniscule, but if you're going to use this to generate ripples in water or something, then you don't want to waste any. By going to 500 you overlap 140 of your own dots.
Posted: 17th Apr 2004 5:48
ur rong because if u change some of the settings it needs more dots e.g spirals

BTW i did update the thing to a spiral generator but i cant be bothered to upload it
Posted: 17th Apr 2004 19:04
Another useless thing ^^

+ Code Snippet
m_bitmap(1,256,256)
starttime = timer()
for t#=1.0 to 100.0
	m_cercle_degrade(1,rnd(256),rnd(256),10+rnd(30),rgb(255,200,0),rgb(0,0,0))
	set window title "Working ... "+str$(t#)+"%"
next t
make image from memblock 1,1
time# = timer()-starttime
do
   cls
   paste image 1,0,0
   set cursor 0,300
   print "Image made in ",time#/1000," seconds"
   sync
loop
function m_bitmap(m, tx as integer, ty as integer)
   make memblock m,12+tx*ty*4
   write memblock dword m, 0, tx
   write memblock dword m, 4, ty
   write memblock dword m, 8, 32
endfunction
function m_dot(m, x as integer, y as integer, c as dword)
   sizex = memblock byte(m,0)+256*memblock byte(1,1)
   sizey = memblock byte(m,4)+256*memblock byte(1,5)
   if x>-1 and x<sizex
      if y>-1 and y<sizey
         n as double integer
         n = (4*((y*sizex)+x))+12
         write memblock dword m,n,c
      endif
   endif
endfunction
function m_cercle_degrade(m, xc as float, yc as float, r as float, cc as dword, ce as dword)
   x as float
   y as float
   dr as float
   dg as float
   db as float
   dr = (rgbr(ce)-rgbr(cc)) / r
   dg = (rgbg(ce)-rgbg(cc)) / r
   db = ((rgbb(ce)-rgbb(cc)) / r)
   for y=yc-r to yc+r
      for x=xc-sqrt(r^2-abs(y-yc)^2) to xc+sqrt(r^2-abs(y-yc)^2)
         m_dot(m, x,y,rgb(rgbr(cc)+dr*sqrt((x-xc)^2 + (y-yc)^2),rgbg(cc)+dg*sqrt((x-xc)^2 + (y-yc)^2),rgbb(cc)+db*sqrt((x-xc)^2 + (y-yc)^2)))
      next x
   next y
endfunction
Posted: 19th Apr 2004 19:54
slight optimization.

change as ifman1 said, and also get rid of the V variable, its not needed.

+ Code Snippet
for n=1 to 500
ox=cos(v)*w
oy=sin(v)*h
v=v+1
dot cx+ox,cy+oy
next n



new code
+ Code Snippet
for n=1 to 360
ox=cos(n)*w
oy=sin(n)*h
dot cx+ox,cy+oy
next n


It's not completely useless, to him anyway. Mabye he didn't need to post it. But he's learning ways to use sin/cos, which is good.
Posted: 21st Apr 2004 23:26
You're right Phaelax
Posted: 22nd Apr 2004 2:12
um... heh... I s'pose if you're doing a spiral you would need more than 360 dots, SINCE IT'S NOT A FRICK'N CIRCLE ANYMORE!!!! Jeez. But since your original post was a circle generator, and your original code just put new dots on top of old ones, it was redundant. What I would be impressed with is if you could fix the code so that all the extra dots fill in the gaps of larger circles...that would be cool. It's actually simple... but since no really seemed to care about the original circle, and dbpro has a built in function... oh, hey... why?
Posted: 22nd Apr 2004 2:47
true true