Well before trying to do this in three dimensions I think it's easier to use a 2d or data oriented approach in place especially as the data is only one dimension