Re: [Flashcoders] Grid - getting neighbouring positions

2007-06-18 Thread elibol

You might repeat the algorithm for getting the first ring on each cell that
makes up that ring.

A lazy way to do it would be to exclude the cell that the ring is
originating from, and any cells that have already been found.

A better solution would be to get the angle between the center and the
particular cell and take all cells in that area using some calculation that
correlates to the rate at which the area of the cells being captured grows.
You might need a bigger sample to get a solid formula for growth.

In any case, the initial data structure is what determines the algorithm, so
it might be best to come up with a data structure that links cell neighbors
the way you need them to be on construction in order to process finding
those neighbors right from the start.

One final approach that hit me just in case you are working with movieclips:
Create a circular clip, resize it centered where you are creating the ring,
and do a hit test on all the cells. Successful hit tests mean that they fall
in the perimeter of the circle. There is a ratio that relates the circle
size to the size of each ring, resize at that rate and you will get one ring
at a time.

Good luck!

On 6/16/07, Jiri Heitlager | dadata.org [EMAIL PROTECTED] wrote:


[0,0] [1,0] [2,0] [3,0] [4,0]
[0,1] [1,1] [2,1] [3,1] [4,1]
[0,2] [1,2] [2,2] [3,2] [4,2]
[0,3] [1,3] [2,3] [3,3] [4,3]
[0,4] [1,4] [2,4] [3,4] [4,4]

I have the following grid and would like to find the neighbouring
positions of a certain point, going in a radius from in to out, covering
all the positions.

Let say I take point [2,2] then its neighbours are in the first ring
[1,1] [2,1] [3,1] [3,2] [3,3] [2,3] [1,3] [1,2]
I manage to get the first ring, but getting the other rings I haven't
got a clue on how to do that.

Can somebody help me?

Thank you,

jiri
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Grid - getting neighbouring positions

2007-06-16 Thread Jiri Heitlager | dadata.org

[0,0] [1,0] [2,0] [3,0] [4,0]
[0,1] [1,1] [2,1] [3,1] [4,1]
[0,2] [1,2] [2,2] [3,2] [4,2]
[0,3] [1,3] [2,3] [3,3] [4,3]
[0,4] [1,4] [2,4] [3,4] [4,4]

I have the following grid and would like to find the neighbouring 
positions of a certain point, going in a radius from in to out, covering 
all the positions.


Let say I take point [2,2] then its neighbours are in the first ring 
[1,1] [2,1] [3,1] [3,2] [3,3] [2,3] [1,3] [1,2]
I manage to get the first ring, but getting the other rings I haven't 
got a clue on how to do that.


Can somebody help me?

Thank you,

jiri
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com