Fast, 2d, line of sight?
What sort of algorithm do you suggest for quickly calculating a rough line of sight? It would be circular, top-down objects that would need to be detected, with varying sized objects inbetween.
I'm for as quick as possible, because I hope on implementing it in Ruby.
I'm for as quick as possible, because I hope on implementing it in Ruby.
Ray sphere/circle intersections are pretty trivial. Just need a little quadratic formula.
As for collections of varying sized objects, you might try going with some variation on quad trees, sphere trees, or some other sort of binary spatial tree. Ray to splitting plane collisions are also very easy if you do a quad or binary spatial tree.
Spatial trees are a pretty varied group of data structures with ton of variations with different focuses on fast updates or fast queries or specific expectations on data layout.
As for collections of varying sized objects, you might try going with some variation on quad trees, sphere trees, or some other sort of binary spatial tree. Ray to splitting plane collisions are also very easy if you do a quad or binary spatial tree.
Spatial trees are a pretty varied group of data structures with ton of variations with different focuses on fast updates or fast queries or specific expectations on data layout.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Read a text file line by line? | jdunehew | 6 | 9,204 |
Dec 29, 2011 11:54 AM Last Post: Blacktiger |
|
| Line Of Sight in Tile Game | whogben | 9 | 6,857 |
Mar 18, 2005 06:58 AM Last Post: radiance |
|

