Re: [Flashcoders] Grid / Math - getting neighbouring positions

2007-06-20 Thread Charles Parcell
Perhaps it is just me but your solution and does not get all the grid locations. All this does is get the grid locations in a direct horizontal, vertical and 45 degree angle from the starter grid. Go out 2 or 3 levels and you quickly find that there are grid spots missing. Charles P. On 6/17/07

RE: [Flashcoders] Grid / Math - getting neighbouring positions

2007-06-20 Thread Jesse Graupmann
Here is my stab at it... function getGridRing( $r:Number, $c:Number, dist:Number, minRow:Number, minCol:Number, maxRow:Number, maxCol:Number ):Array { // @ $r = start row // @ $c = start column // @ dist = destination ring trace(

RE: [Flashcoders] Grid / Math - getting neighbouring positions

2007-06-19 Thread Danny Kodicek
> I'll take it ;) > > thanks for everybody's help. Just catching up on this, you might want to try looking up floodFill algorithms - that's pretty much what you're doing. Danny ___ Flashcoders@chattyfig.figleaf.com To change your subscription options

Re: [Flashcoders] Grid / Math - getting neighbouring positions

2007-06-18 Thread Jiri Heitlager | dadata.org
I'll take it ;) thanks for everybody's help. Jiri Merrill, Jason wrote: That is a nice solution, but it leaves me with the problem that starting from one point (3,2) it only produces a set of points of ring directly around the selected point. I am looking for a solution to get _all_ the poi

RE: [Flashcoders] Grid / Math - getting neighbouring positions

2007-06-18 Thread Merrill, Jason
>>That is a nice solution, but it leaves me with the problem >>that starting from one point (3,2) it only produces a set of >>points of ring directly around the selected point. I am >>looking for a solution to get _all_ the points, from a >>certain point and the move in a ring towerds the outs

Re: [Flashcoders] Grid / Math - getting neighbouring positions

2007-06-17 Thread Jiri Heitlager | dadata.org
Thxn Joshua and others, I have to look into that. In the mean time I came up with the following code. This takes in a vector and then calculates a 'ring' from that position. With this, I can scale up the 'radius' and get recursively get all the rings from a point from in to outer ring. My goal

Re: [Flashcoders] Grid / Math - getting neighbouring positions

2007-06-17 Thread Joshua Sera
The easy way to do this is like so. So you have a square at x,y, and you want to get all the squares n squares away. Get squares x+n, y x-n, y x+n, y+n x-n, y+n x+n, y-n x-n, y-n x, y+n x, y-n I suspect you want to do this for your version of that whale-ey thing though, so what y

Re: [Flashcoders] Grid / Math - getting neighbouring positions

2007-06-17 Thread Jiri Heitlager | dadata.org
Please I really need help on this on, I am cracking my head over it. Bresenham algo is also not the way to go, because it is for circle's and to complex! I can only get one ring, arggg If I go one ring further then it results in many double values, calculate allready when doing the fir

Re: [Flashcoders] Grid / Math - getting neighbouring positions

2007-06-16 Thread Jiri Heitlager | dadata.org
Please I really need help on this on, I am cracking my head over it. Bresenham algo is also not the way to go, because it is for circle's and to complex! I can only get one ring, arggg If I go one ring further then it results in many double values, calculate allready when doing the fir

Re: [Flashcoders] Grid / Math - getting neighbouring positions

2007-06-16 Thread Jiri Heitlager | dadata.org
That is a nice solution, but it leaves me with the problem that starting from one point (3,2) it only produces a set of points of ring directly around the selected point. I am looking for a solution to get _all_ the points, from a certain point and the move in a ring towerds the outside of a g

Re: [Flashcoders] Grid / Math - getting neighbouring positions

2007-06-16 Thread Jiri Heitlager | dadata.org
The ring is defined by distance not by connectedness. It is used for the following. A big image will be split into tiles of 100x100 pixels, that are loaded from a server. The total image made of these tiles are loaded in a movieclip so that the image is rebuilded. The image is masked by a 100x1

RE: [Flashcoders] Grid / Math - getting neighbouring positions

2007-06-16 Thread Merrill, Jason
This requires you to re-do your grid, but it's one way to handle it without complex math. It seems a simple way would be to make each row of the grid an array (the entire thing can be an array as well, but make each row it's own array). You could do some object mix-in to ease syntax and allow for

Re: [Flashcoders] Grid / Math - getting neighbouring positions

2007-06-16 Thread Jobe Makar
Hi Jiri, There is an algorithm called Bresenham's Line Algorithm. It is used by computers to determine which pixels to display based on a line. It is also used by game programmers to determine the # of tiles crossed along the path of a moving object (or in raycasting, etc). There exists a "cir

Re: [Flashcoders] Grid / Math - getting neighbouring positions

2007-06-16 Thread Ron Wheeler
It depends how you define the rings. It is by distance or by connectedness? Is 0,0 in the second ring with 1.0 and 0,1? What is the purpose of knowing this? Ron Jiri Heitlager | dadata.org wrote: Hello list, I have the following grid and would like to find the neighbouring positions of a ce