Demonstrates converting multi-dimensional coordinates to single-dimensional coordinates (up to 4 dimensions)
Go to file
Stephen Seo c18c5dc56a Add object counter to UnitTests
The counter allows for checking if each object in the array is accessed
once.
2021-06-09 14:44:23 +09:00
src Add object counter to UnitTests 2021-06-09 14:44:23 +09:00
third_party Impl n_to_one and one_to_n (up to 4) with tests 2021-06-08 21:44:22 +09:00
.gitignore Impl n_to_one and one_to_n (up to 4) with tests 2021-06-08 21:44:22 +09:00
.gitmodules Impl n_to_one and one_to_n (up to 4) with tests 2021-06-08 21:44:22 +09:00
LICENSE Add LICENSE (The Unlicense) 2021-06-08 21:45:09 +09:00
Makefile Impl n_to_one and one_to_n (up to 4) with tests 2021-06-08 21:44:22 +09:00
README.md Add README.md 2021-06-08 21:49:22 +09:00

README.md

One To N and N To One

This "library" demonstrates converting multi-dimensional coordinates to one-dimensional coordinates (and back), up to 4 dimensions. If you examine the source, it should become apparent how to apply this to more dimensions.

Note the Makefile only creates the UnitTests and the unit testing library is added as a git submodule (so you need to do git submodule update --init to get the unit testing framework).

Notes for those who may be confused

x_width refers to the size of the first dimension of the array. So if it is equivalent to 10, then this means that the first dimension contains values from 0-9 inclusive. Thus, a "width" is required for each of the n-1 dimensions to correctly calculate the required indices.