At 02:53 PM 6/18/01 +0200, Possberg, Hendrik \(Fa. Microm\) wrote:
>I have a question concerning the "scattering of coordinates".
>The Investigation of the factor should be done by a "scatterscreen" which
>also represent the resulting position of the data.
>The first recordset position (0) gets the original Coordinate, which lies
>in the middle of the resulting cluster.
>The first round produces 1*8 new Coordinates, the second round produces
>2*8 new Coordinates and so on.....
>
> 2 2 2 2 2
> 2 1 1 1 2
> 2 1 0 1 2
> 2 1 1 1 2
> 2 2 2 2 2
Let's reduce the problem to a series of simpler ones. The formulas will
follow easily.
First, the situation: let's suppose you have a "subidentifier" N used to
enumerate the distinct points within a cluster. N begins with 0 and
increases by 1's: N = 0, 1, 2, ... . The problem is to assign appropriate
coordinates for the Nth point relative to the center of the
cluster. Here's the beginning of a table:
N X Y
0 0 0
1 1 -1
2 1 0
3 1 1
4 0 1
...
8 0 -1
9 2 -2
10 2 -1
... etc.
This arrangement begins each round at the bottom left corner and marches
counterclockwise (positively) around the square. I chose to start at a
corner to make the formulas simple.
This picture of things conceives of each point as corresponding to some
_position_ along a _side_ of a _square_ whose diameter is determined by the
_round_. These underlined quantities are readily computed in terms of
N. Moreover, there is a four-fold symmetry within each round: the patterns
repeat themselves along each side, rotated by 90 degrees each time. This
means if we can find formulas for the right hand side of each round, and
can identify the side we're currently on, then we're done.
This leads to a series of simple formulas. I haven't the time to explain
their derivations in detail, so here they are as the first few lines of an
Excel spreadsheet. They are readily converted to MapBasic. The first
column is the index N. The last two columns are the (x,y) coordinates of
the points corresponding to the values of N. The middle columns are
intermediate values. The first line contains initialization. The second
line--the body of a loop over N, really--can be propagated indefinitely
downward to give formulas for all N.
n d r s l p a b u v
x y
0 =INT(SQRT(A2)) =2*INT((B2+1)/2) =(C2-1)^2 0 0
=C2/2 =F2-C2/2 1 0 =G2*I2 - H2*J2 =G2*J2+H2*I2
=A2+1 =INT(SQRT(A3)) =2*INT((B3+1)/2) =(C3-1)^2
=INT((A3-D3)/(C3)) =(A3-D3 -
C3*E3) =C3/2 =F3-C3/2 =IF(E3=E2, I2, -J2) =IF(E3=E2,
J2,I2) =G3*I3 - H3*J3 =G3*J3+H3*I3
In this notation, "INT" is the greatest integer ("floor") function and
"SQRT" is the square root function. Perhaps the only mystery is how the
rotation by 90 degrees occurs. That is accomplished by the (u, v)
columns. They represent powers of the complex number i =
(0,1). Multiplying coordinates (a,b) by a power of i will rotate them by a
multiple of 90 degrees. You could just as easily use conditional or
case/switch statements to do the rotation: although the code would be
longer, it would give formulas for (x, y) directly in terms of N, without
needing to retain the intermediate values computed for N-1. Specifically,
once you have computed values "a" and "b", use the value of "l" (which will
be 0, 1, 2, or 3) to rotate (a, b) by l*90 degrees. This gives (x,y).
--Bill Huber
www.quantdec.com
_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.