|
-
Dec 16th, 2010, 03:42 PM
#7
Re: How calculate visibilty of objects
Okay, I was stuck on the idea of a radar display and partially obscured objects. The tricky part of the problem to my mind was (is) not how do you determine if an object obscures another, that's pretty easy, but how do you check a bunch of objects without comparing every object to every other object.
Using...
Function RadarContact(ViewPosition, TargetPosition, OtherObjectPositions()) as Boolean
...strikes me as fine if there are not so many TargetPositions but potentially rather intensive if there are many. Assuming the same test is performed for every object then its O(n² complex.
This only need be an O(n) problem.
I'm going to bang on about beams again but bear with me. Consider an array of null references to potential targets where each element represents the radar beam at a particular angle. Loop through each target object and work out which element(s) of the Radar array point to the target, if the elements already reference a target work out which target is closest and assign the closest one. When it comes to rendering targets, just render the ones in the Radar array. All done in a single pass.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|