![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Chit Chat The place for open discussions. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
I'm trying to make sense of some map Logic...
Imagine a map, divided in cells, extending from -250 to 250, including 0,in both x and y axes... Its easy obtaining the total amount of squares. (250*250+1) will give me the number of Lines and of collumns, so the total amout of cell is (rows*Collumns).... In this case: 501*501=251001 For some reason, I HAVE TO USE THIS IN A SEARCH, but Then it gets complicated.... How do I get the Coordinates for a specific cell, trough its number... Imagine I need to convert cell 36862 to X:Y , HOW????
__________________
Paulo Gomes Porto, Portugal PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD PPC: Qtek9000, 1GB SD DLL Version Listing |
|
||||
|
Thanks, but it shed litle light for what i need..
you forgot that I have negative values, referenced to a 0 colun and a 0 row, so my map look a litle like this: -3 -2 -1 0 1 2 3 +--+--+--+--+--+--+--+ 3 |01|02|03|04|05|06|07| +--+--+--+--+--+--+--+ 2 |08|09|10|11|12|13|14| +--+--+--+--+--+--+--+- 1 |15|16|17|18|19|20|21| +--+--+--+--+--+--+--+ 0 |22|23|24|25|26|27|28| +--+--+--+--+--+--+--+ -1 |29|30|31|32|33|34|35| +--+--+--+--+--+--+--+ -2 |36|37|38|39|40|41|42| +--+--+--+--+--+--+--+ -3 |44|45|46|47|48|49|50| +--+--+--+--+--+--+--+ Only a LOT larger...
__________________
Paulo Gomes Porto, Portugal PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD PPC: Qtek9000, 1GB SD DLL Version Listing Last edited by Cableguy : 05-31-2008 at 01:15 AM. |
|
||||
|
Yes, it works fine, but could you explain a bit your logic...
How the actual calculations works....
__________________
Paulo Gomes Porto, Portugal PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD PPC: Qtek9000, 1GB SD DLL Version Listing |
|
||||
|
Klaus you must be a math-magician!
I like Cableguy couldn't see how your code works, but the explanation was great and you made it look so simple. Personally I hate maths and always struggle with it ![]() Regards, RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|