1. I don't expect solution... but,
Hi all!
I don't expect anyone can give the answer to my question, but i will try...
From long time ago, i have had an idea that an excellent game or other
very amusing stuff can be made using the Euphoria's powerful routine
polygon()....
We can make the... Hmmm... that is, the shape transformation from one
shape to another shape smoothly using polygon() with many vertics (more than
100 vertic points) and of course in two dimensional.
i am afraid you don't understand my intention...
Have you seen the shape transformation in the famous cinema picture
"Terminator II" ? My idea is something like that.
However, there is a problem in it. it requires multiple video pages
to avoid flickling. I already tested it in video mode 13. i found that
the speed is quite enough even in the 486 machine. but, in mode 13, i can use
only 16 colors, which is not enough for make good game screen...
further, the resolution is too low... i think it must be at least 640*480...
Hmmm... I don't want you to twist your brain too much to give solution to me...
Bye!
from Lee woo seob
2. Re: I don't expect solution... but,
Lee woo seob wrote:
> We can make the... Hmmm... that is, the shape transformation from one
> shape to another shape smoothly using polygon() with many vertics (more than
> 100 vertic points) and of course in two dimensional.
> i am afraid you don't understand my intention...
> Have you seen the shape transformation in the famous cinema picture
> "Terminator II" ? My idea is something like that.
>
> However, there is a problem in it. it requires multiple video pages
> to avoid flickling. I already tested it in video mode 13. i found that
> the speed is quite enough even in the 486 machine. but, in mode 13, i can use
> only 16 colors, which is not enough for make good game screen...
> further, the resolution is too low... i think it must be at least 640*480...
If anyone can make a procedure that draws a polygon row by row, I might
be able to help put this program in mode 19. rather than 13.
--Augorian;
3. Re: I don't expect solution... but,
On Fri, 27 Jun 1997 14:11:06 +0900 Lee woo seob <wslee at HHI.CO.KR> writes:
>Hi all!
>From long time ago, i have had an idea that an excellent game or
>other
>very amusing stuff can be made using the Euphoria's powerful routine
>polygon()....
>
>We can make the... Hmmm... that is, the shape transformation from one
>shape to another shape smoothly using polygon() with many vertics
>(more than 100 vertic points) and of course in two dimensional.
>Have you seen the shape transformation in the famous cinema picture
>"Terminator II" ? My idea is something like that.
>
>However, there is a problem in it. it requires multiple video pages
>to avoid flickling. I already tested it in video mode 13. i found that
>the speed is quite enough even in the 486 machine. but, in mode 13, i
>can use
>only 16 colors, which is not enough for make good game screen...
>further, the resolution is too low... i think it must be at least
>640*480...
>
>Bye!
>
>from Lee woo seob
>
How's 320x200 with 256 colors and unlimited pages sound?
Sound to good to be true? Well right now it is BUT.
I will get to work on a polygon routine for our faster
virtual screens. We already have vpixel() which is simply
virtual pixel. I am sure that vpolygon() is possible.
Don't hold your breath though. :) It may take some time.
I will have to create some sort of vdraw_line() first.
Then vpolygon() shouldn't be quite so hard to make.
Pete Eberlein's fill() will come in quite handy with
this task.
4. Re: I don't expect solution... but,
Lucius L Hilley III wrote:
>How's 320x200 with 256 colors and unlimited pages sound?
>Sound to good to be true? Well right now it is BUT.
>I will get to work on a polygon routine for our faster
>virtual screens. We already have vpixel() which is simply
>virtual pixel. I am sure that vpolygon() is possible.
It sounds best!
>Pete Eberlein's fill() will come in quite handy with
>this task.
Pete's fill() is based on the pixel color information from get_pixel().
i think the filling algorithm of polygon() is different with that of Pete's,
considering the filling speed of polygon(). The polygon() may be based on
other algorithm which is mathmatical or topological...
Rob Craig, the creator of polygon() routine, might have something to tell
us, which is useful in developing vpolygon()...
Regards,
from Lee woo seob...
5. Re: I don't expect solution... but,
- Posted by Robert Craig <robert_craig at COMPUSERVE.COM>
Jun 29, 1997
-
Last edited Jun 30, 1997
Lee woo seob writes:
> Rob Craig, the creator of polygon() routine, might have something to te=
ll
> us, which is useful in developing vpolygon()...
Euphoria just calls the WATCOM C polygon routine.
I don't know how it fills polygons so quickly.
Regards,
Rob Craig
Rapid Deployment Software
6. Re: I don't expect solution... but,
Here's a polygon procedure I've been working with recently. It draws
only four sided polygons though. It works with a single color or a
tiled bitmap like my fill procedure. It breaks the polygon down into
horizontal strips and scans the endpoints downward along the edges. The
vertices are in a fixed-point format, so multiply pixel values by
65536. The upper and right side of the polygon is clipped so that two
polygons, sharing two vertices, will not overlap when drawn. Pretty
weird, huh?
---- here's the code ----
function get_slope(sequence p1, sequence p2)
integer denom, dx
denom = floor(((p1[2] > p2[2]) * 2 - 1) *
(p1[2] - p2[2]) / 65536) + 1
dx = floor((p2[1] - p1[1]) / denom)
return {p1[1] + floor(dx * and_bits(-p1[2], 65535) / 65536), dx}
end function
procedure poly(object tile, sequence vertices)
-- draws a filled four-sided polygon
-- tile may be an atom for a solid color
-- or a 2-d sequence of pixels to be tiled
-- vertices is a length-4 sequence of length-2 sequences
-- of fixed point coordinates
-- floor(vertice / 65536) is the pixel position
-- remainder(vertice, 65536) is the fractional pixel value
integer boty, y2, y3, y4, x1, x2, temp
sequence line1, line2
-- rotate vertices, so first position is highest on screen
while (vertices[1][2] > vertices[4][2])
or (vertices[1][2] > vertices[3][2])
or (vertices[1][2] > vertices[2][2]) do
vertices = append(vertices[2..4], vertices[1])
end while
-- find the bottommost vertice
boty = floor(vertices[2][2] / 65536)
if floor(vertices[3][2] / 65536) > boty then
boty = floor(vertices[3][2] / 65536)
end if
if floor(vertices[4][2] / 65536) > boty then
boty = floor(vertices[4][2] / 65536)
end if
-- calculate starting x-positions and rates of change
line1 = get_slope(vertices[1], vertices[2])
line2 = get_slope(vertices[1], vertices[4])
-- precompute critical y-values
y2 = floor((vertices[2][2] + 65535) / 65536)
y3 = floor((vertices[3][2] + 65535) / 65536)
y4 = floor((vertices[4][2] + 65535) / 65536)
for y = floor((vertices[1][2] + 65535) / 65536) to boty do
-- test for a vertice
if y = y2 then
line1 = get_slope(vertices[2], vertices[3])
end if
if y = y4 then
line2 = get_slope(vertices[4], vertices[3])
end if
if y = y3 then
if boty = floor(vertices[2][2] / 65536) then
line2 = get_slope(vertices[3], vertices[2])
else
line1 = get_slope(vertices[3], vertices[4])
end if
end if
x1 = floor(line1[1] / 65536)
x2 = floor(line2[1] / 65536)
if atom(tile) then
-- solid color
if x1 < x2 then
pixel(repeat(tile, x2-x1), {x1,y})
else
pixel(repeat(tile, x1-x2), {x2,y})
end if
else
-- tiled bitmap
if x1 > x2 then
temp = x1 x1 = x2 x2 = temp
end if
if x1 < 0 then x1 = 0 end if
for x = x1 to x2 do
pixel(tile[1+remainder(y, length(tile))]
[1+remainder(x, length(tile[1]))], {x,y})
end for
end if
line1[1] = line1[1] + line1[2]
line2[1] = line2[1] + line2[2]
end for
end procedure
function rotate(sequence s, atom a)
atom sine, cosine
sine = sin(a)
cosine = cos(a)
for i = 1 to length(s) do
s[i] = s[i] * cosine + {s[i][2],-s[i][1]} * sine
end for
return s
end function
include graphics.e
for a = graphics_mode(19) to 255 do
poly(a, floor(65536*(repeat({a+50,100},4)+
rotate({{-50,-50},{50,-50},{50,50},{-50,50}},
a*3.14159/128))))
end for
---- code ends ----
This doesn't do the virtual paging or the number of vertices originally
requested by Lee woo seob, but hopefully someone can use this to come up
with a solution.
Pete Eberlein <xseal at harborside.com>
7. Re: I don't expect solution... but,
mark honner wrote:
>If anyone can make a procedure that draws a polygon row by row, I might
>be able to help put this program in mode 19. rather than 13.
Here is the codes that draws a polygon row by row!
This codes are made based on the lectures! by Jiri Babor and Michael Bolin
on the polygon geometry for my previous mail "mathmatical question".
i stole some portion of Bolin's codes for "mathmatical question".
the speed of this routine is somewhat slower than the polygon() in Euphoria.
Any suggestion to speed it up will be appreciated. and any help to combine
this routine with virtual screen in graphic mode 19 will also be appreciated.
Thanks in advance!
from Lee woo seob..
----------- codes start here --------------
include graphics.e
include sort.e
procedure vpolygon(integer color, sequence points)
sequence x
integer lp
atom ystart,yend,yp,x1,y1,x2,y2,max,min
lp=length(points)
ystart=points[1][2]
yend=ystart
for i=2 to lp do
yp=points[i][2]
if yp<ystart then ystart=yp end if
if yp>yend then yend=yp end if
end for
if ystart<0 then ystart=0 end if
if yend>199 then yend=199 end if
for y=ystart to yend do
x1=points[lp][1]
y1=points[lp][2]
x={}
for i=1 to lp do
x2=points[i][1]
y2=points[i][2]
if y1!=y2 then
if y1>y2 then
max=y1
min=y2
else
max=y2
min=y1
end if
if y>min and y<=max then
x=x&(x1+(x2-x1)/(y2-y1)*(y-y1))
end if
end if
x1=x2
y1=y2
end for
x=sort(x)
for j=2 to length(x) by 2 do
pixel(repeat(color,x[j]-x[j-1]+1),{x[j-1],y})
end for
end for
end procedure
-- test program
include get.e
if graphics_mode(19) then end if
if wait_key() then end if
if graphics_mode(-1) then end if
----------- codes end here ----------------
8. Re: I don't expect solution... but,
>> Rob Craig, the creator of polygon() routine, might have something to tell
>> us, which is useful in developing vpolygon()...
>
> Euphoria just calls the WATCOM C polygon routine.
> I don't know how it fills polygons so quickly.
A good guess is that it fills each line, from left to right... (That's prolly
how I'd do it; It's the way democoders do it.)
>>Lee woo seob
> Rob Craig
Anders
--------------------------------------------------------------
Anders Eurenius <c96aes at cs.umu.se> ICQ UIN:1453793
Computer Science/Engineering student at the university of Umea
--------------------------------------------------------------