To: Tourist Trap
Your cuestions:
Position 999 =
blo = 1 row = 10 col = 9 niv = 10
:::::::::::::::::::::::::::::::::::
row = 4
col = 8
level = 2
Position = 138
Position item in an array larger than 3D
Re: Position item in an array larger than 3D
Hi, dodicat:
I'm glad to talk to you again!
Your cuestion:
dodicat:
24300000 Size of one dimensional array
position required = 21000000
Element 26 28 24 10 30
26*28 = 728 = block
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
lrcvs:
blo = 778 row = 10 col = 30 niv = 24
I'm glad to talk to you again!
Your cuestion:
dodicat:
24300000 Size of one dimensional array
position required = 21000000
Element 26 28 24 10 30
26*28 = 728 = block
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
lrcvs:
blo = 778 row = 10 col = 30 niv = 24
Re: Position item in an array larger than 3D
To dodicat:
Your cuestion:
What method would you use to get the 5 dimensional co-ordinates
of a given position in the single dimension equivalent array.?
Well, now I do not go into mathematical calculations ...
... But I approach it / I guess as follows:
I have a transparent cube, if type a sphere inside the cube, points (coordinates with integer values) of the sphere, will be within the cube.
In the above example, the vertices (X, Y, Z) of a cube, could be transformed into a value of a position, as showed in the previous example.
If we use the same principle to the field, should work the same, that's my idea, I hope not wrong too.!
Your cuestion:
What method would you use to get the 5 dimensional co-ordinates
of a given position in the single dimension equivalent array.?
Well, now I do not go into mathematical calculations ...
... But I approach it / I guess as follows:
I have a transparent cube, if type a sphere inside the cube, points (coordinates with integer values) of the sphere, will be within the cube.
In the above example, the vertices (X, Y, Z) of a cube, could be transformed into a value of a position, as showed in the previous example.
If we use the same principle to the field, should work the same, that's my idea, I hope not wrong too.!
Re: Position item in an array larger than 3D
To dodicat and fxm:
Both methods are correct.
The important thing is that you can demonstrate that position occupies one element in an array / block / dim ...
Both methods are correct.
The important thing is that you can demonstrate that position occupies one element in an array / block / dim ...
Re: Position item in an array larger than 3D
My work is more secillo, less showy, but it is also correct.
Calculate position:
Calculate position:
Code: Select all
cls
input "Filas del bloque unidad = ";ro 'rows block unity
input "Columnas del bloque unidad = ";co 'cols block unity
input "Niveles del bloque unidad = ";le 'levels block unity
print
input "Posicion Fila = ";a 'position row
input "Posicion Columna = ";b 'positiion col
input "Posicion Nivel = ";c 'position level
input "Numero de Bloque = ";d 'position number block
P = ((a - 1) * co) + b + ((ro * co * (c - 1))) + ((ro * co * le) * (d-1))'position
print "Position = ";p
sleep
end
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Calculate Dim/block/array..., col, level,row
dim as integer c,co,d,f,h,k,l,p,r
cls
input "Numero de filas del bloque unidad (filas <= columnas) = "; r
input "Numero de columnas del bloque unidad (columnas >= filas) = ";c
input "Numero de niveles del bloque unidad = ";l
input "Posicion a buscar = ";p
h = l
'calculate block
if p mod (r*c*l) <> 0 then
d = int(p/(r*c*l))+1
else
d = int(p/(r*c*l))
end if
':::::::::::::::::::::::::::::::::
print "bloque = ";d
'calculate level
l = (int(p/(r*c))+1)
if p mod (r*c) = 0 then l = l-1
k = l-((d-1)*h)
':::::::::::::::::::::::::::::::::
'print "Nivel_1 = ";l
print "Nivel_2 = ";k
'calculate col
if p < c then co = p
if p >= c then co = p mod c
if p mod c = 0 then co = c
':::::::::::::::::::::::::::::::::
print "Columna = ";co
'calculate row
f = ((p-co-((r*c)*(l-1)))/c)+1
':::::::::::::::::::::::::::::::::
print "Fila = ";f
print
color 12
print "blo = ";d;" fil = ";f; " col = ";co; " niv = ";k
sleep
end