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, arggggggg!!!!
If I go one ring further then it results in many double values,
calculate allready when doing the first ring.
Here is the code..
var row = 0;
var c:Number = 3;
var ring:Number = 1;
//take start pos [2,2]
var x:Number = 2;
var y:Number = 2;
//
while (row<c) {
for (var i:Number = 0; i<c; i++) {
var rowID:Number = (x-ring)+i;
var colID:Number = (y-ring)+row;
if (rowID<0 || colID<0 /* || (rowID == sR && colID == sC)*/) {
continue;
}
trace('['+colID+','+rowID+']');
}
row++;
}
Ron Wheeler wrote:
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 certain point, going in a radius from in to out,
covering all the positions.
[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]
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@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