-
Hi!
I've tried many methods to draw NON-antialiased lines (it's for collision detection), but none of them work! I mean, they do, but only if "X > Y" or something...
and I can't figure out how to make it work under any conditions, like VB's function (look at my other post on the midpoint algorythm - that's a very fast algorythm so I would prefer it, but anything will have to do!).
Can someone please help me on this? Any piece of code will help!
Thanks!
-
Why do you need a line for collision detection?
-
Yeah, that must be really weird, maybe the user is the one that has to detect the collision by looking at the line and see if it hits something...
-
sounds like he wants the user to be able to see where the limit is, but I am not sure what he wants...
-
Well... if you really wanna know: I want it for a 2-d line of sight system. I need to cast rays from each of the lights and when it finds an obstacle it stops...
Does anyone know how to make a line?
I've seen Fox's example, it's cool but it only works under some conditions.
I looked at the midpoint algorythm, it has the same problem.
I tried to make on myself, and it STILL had the same problem!
Please help! I'm really desperate! :(
-
I know!
How about you get a pencil, some paper, and a ruler, and you start from one end of the ruler, and draw aaaaaall the way to the ot-...What? Visual Basic? Oh! Nevermind! Heheh....eeeheheh.. <;)
-
http://www.sanctuary.org/~ashe/coding/breshanham.html
It's C but easily converted to VB. This is the best known line drawing algorithm. There are better ones for special circumstances, but I doubt they'd all be easily implemented in VB.
-
Thanks! The pice of code I had from Brensenham's algorythm was incomplete, this one works ;)
Do you think storing the brightness values of each tile surrounding each light in seperate variables would be good? Or should I store only the start and end points of each light?
-
Code:
Dim slope as long
Dim startx as long
Dim starty as long
Dim xlen as long
xlen=500
Line1.x1=startx
Line1.y1=starty
Line1.x2=xlen
Line1.y2=(slope*xlen)+Line1.y1
-
Thanks Schnarf, but I was trying to do it without controls. Thanks anyway!
-
whats a starting point of a light? and what's a ending point then?
-
Well... here's the article:
http://www.gamedev.net/reference/art...article729.asp
It has details on a new way to make lights.
It's in C++ but since it doesn't have any code, converting it to VB shouldn't be a problem!
My idea would be to, instead of storing the start and end points of each ray, to store the brightness values of each point of the light, like an image, to make it faster. What do you think?
Also, the original idea was to use this for Line of Sight. It can easily be changed to Lights... I don't think I have to explain too much on this ;)
-
ERROR: The requested URL could not be retrieved
on that link, well i have almost no idea what youre talking about, sorry
-
1 Attachment(s)
Heh, it's outdated :rolleyes:
Here it is as a TXT.