Luis Belmonte Abellan
unread,May 14, 2012, 2:17:07 PM5/14/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to log...@googlegroups.com
Formulas para el calculo del numero de orden en la posicion de un
elemento dentro de un array.
Array 2D
Array origen Z (5,6) = (row, col)
Posicion el elemento a buscar Z (4,5)= (a,b)
Posicion = ((a - 1) * col) + b
Posicion = ((4 - 1) * 6) + 5 = 23
::::::::::::::::::::::::::::::::::::::::::::::::::::::
Array 3D
Array origen Z (5,6,7) = (row, col, level)
Posicion el elemento a buscar Z (4,5,6) = (a,b,c)
Posicion = ((a - 1) * col) + b + ((row * col) * ( level - 1))
Posicion = ((4 - 1) * 6) + 5 ((5 * 6) * (7 - 1)) =
::::::::::::::::::::::::::::::::::::::::::::::::::::::
Array > 3D
Array origen Z (5,6,7,8) = (row, col, level,dimension)
Posicion el elemento a buscar Z (4,5,7,8) = (a,b,c,d)
Posicion = ((a - 1) * col) + b + ((row * col) * (level - 1)) + (row *
col * level) * (dimension -1))
Posicion = ((4 - 1) * 6) + 5 ((5 * 6) * (7 - 1)) + (5 * 6 * 7) * (8 - 1)) =
:::::::::::::::::::::::::::::::::::::::::::::::::::::
Si dimensiones > 3D :
Array origen Z (5,6,7,8) = (row, col, level,d1)
dx = d1
Array origen Z (5,6,7,8,9) = (row, col, level,d1,d2)
dx = d1 * d2
Array origen Z (5,6,7,8,9,10) = (row, col, level,d1,d2,d3)
dx = d1 * d2 * d3