Pages: [1]   Go Down
Author Topic: 3D look up tables possible?  (Read 684 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
God Member
*****
Karma: 1
Posts: 530
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a need at the moment for a variable that is looked up from a 3D table, I can't say I know about how to use arrays - so I'm not sure if using arrays is the way to go about it, or if indeed a 3 dimensional array is possible.

How would I go about creating and using a lookup table? Size wise, I'm hoping to be able to use a table with a size of roughly 10 x 20.

Furthermore, these values will need to be interpolated between table cells - but we'll deal with that later...

Thanks in advance!
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25802
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Size wise, I'm hoping to be able to use a table with a size of roughly 10 x 20.
That's 2D
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't say I know about how to use arrays ...

You could Google "c++ array table".

I found around 23,000,000 hits. The first pageful was about multi-dimensional arrays.
Logged

UK
Offline Offline
God Member
*****
Karma: 1
Posts: 530
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Size wise, I'm hoping to be able to use a table with a size of roughly 10 x 20.
That's 2D

Of course! I was thinking of the values in the table as being the "third" dimension... No wonder all the 3D info I've looked at seems to be over complicated so far.
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can have as many dimensions as you want. End of the day, they are represented as a linearly addressed array.

So all it takes is for you to decide how you want to store / address the data, and retrieve accordingly.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


10x20 => 200 entries in your table. Is every entry a byte, int, long or float? Be aware that the amount of RAM is limited in Arduino's (depends on which you use) and if the array is readonly you might consider put it in program space (google PROGMEM).

Also if the array contains a lot of the same values you might consider using sparse array's. See - http://en.wikipedia.org/wiki/Sparse_matrix -
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

UK
Offline Offline
God Member
*****
Karma: 1
Posts: 530
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I will look through this, thank you - the arrays will be read only yes.
Logged

Pages: [1]   Go Up
Jump to: