-----------------------------
-- Polygon Pattern Program --
-----------------------------
-- press space bar to see a new pattern
-- press any other key to quit
constant GRAPHICS_MODE = 19 -- SVGA, if this fails try mode 18
? ?-- see also euphoria\include\graphics.e
without type_check
include music.e
include graphics.e
include select.e
include machine.e
include image.e
-- use_vesa(1) -- for ATI cards
constant TRUE = 1
sequence config, pal, scale
atom mode, white
integer code
scale = {360,378,405,432,450,480,504,540,576,600,648,680,720}
mode = 0
white = 7.8028549
function mag( atom number )
if number < 0 then
return -number
end if
return number
end function
function angle( atom x, atom y, atom n)
n = n/PI*126
if x != 0 then
if x < 0 then
?if y = 0 then
?return 2*n*PI
?end if
?return n*(arctan(y/x)+2*PI)
end if
?if y = 0 then
?return n*PI
?end if
return n*(arctan(y/x)+PI)
end if
if y > 0 then
return 3*n*PI/2
end if
return n*PI/2
end function
function inv( atom v )
if v != 0 then
return 1/v
end if
return v
end function
function cut( atom top, atom low, atom num )
if num > top then
return top
elsif num < low then
return low
else
return num
end if
end function
function rad( atom x, atom y )
return (power(power( x,2) + power (y,2),0.5))
end function
function bounce ( atom deg, atom base, atom case )
return floor(deg*power(power(case,2),.5)+base )
end function
function poly_pattern()
?integer color, ncolors,fully, fullx, halfy, halfx, key,
red, grn, blu, n
atom zoom, speed,increase, x, y, Time, rad3, rad2,Sound,colour,
? ?x2,y2
pal = palette( hue, {red,grn,blu})
end for
?x2 = 1
?y2 = 1
?clear_screen()
?while TRUE do
for i = 1 to fullx do
for j = 1 to fully do
?x = i - halfx
?y = j - halfy
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.