Re: Fast LOS algorithm
- From: Ray Dillinger <bear@xxxxxxxxx>
- Date: Mon, 05 Nov 2007 08:10:45 -0800
Kenneth 'Bessarion' Boyd wrote:
Spiral-path fov is a specific way of guaranteeing that squares with Manhattan
distance i.e. Lesbesgue-1 distance i.e. L1 distance n [sum of absolute value of
coordinates] are all dequed (with light passed through to squares at L1 distance
n+1, squares with no prior light enqued, etc.) before any squares with L1
distance n+1 are dequed.
It actually gets a lot less finicky to code in 2-d (eg, not caring
if the order is actually a spiral) if you use two queues (one for
each "active" manhattan distance), and just don't go to the next
until all the ones at the current distance are done, doesn't it?
I mean, it "wastes" space, but it's easier to get correct.
I kept getting tangled when I wanted to move it to 3-d because I
couldn't visualize a traversal order that would satisfy the invariant
the way a spiral does for 2-d. But you're right, here: you actually
don't need to do that. Just maintain separate queues for the "current"
and "next" manhattan distance, and that constraint goes away.
For the N-d case:
* There are 2n squares with L1 distance 1, indexed by the basis vectors and
their additive inverses.
* Light bounds are represented by n-1 dimensional polygons (projections of the
square faces) whose points have angle coordinates.
Okay, I can see that, sort of.... light passes into a cube above and
northeast of the origin, through its bottom, south, and west faces,
so you get a sort of squashed hexagon as your unimpeded light passage,
degenerating to squares if the cubes are along an axis.
But your impeded light passage (ie, where the cube didn't get all the
light it could have gotten) has a more complex shape because it can be
cut by the shadow of another cube. You have to do some more complex
geometry than just keeping track of minimum and maximum lit angles to
find the shape that's the union of the light that got passed in,
before you can pass it out. Not "hard" geometry; just more complex.
Bear
.
- Follow-Ups:
- Re: Fast LOS algorithm
- From: Kenneth 'Bessarion' Boyd
- Re: Fast LOS algorithm
- Prev by Date: Re: Fast LOS algorithm
- Next by Date: Re: GPL Alternatives
- Previous by thread: Re: Fast LOS algorithm
- Next by thread: Re: Fast LOS algorithm
- Index(es):
Relevant Pages
|