Hey all, I'm working on a project for school and I'd appreciate it if I could bounce a few ideas around.

Part of the project requires taking in a list of data with each value consisting of an xyz position in space and a uvw magnitude. The initial part of the project I'm concerned with is how to represent each point's uvw gradient.

As far as calculating the gradient goes, I think (though I'm not sure) that just taking the n most significant points for the gradient, up to all of the other points if desired, would be correct. However, would the gradient then be the sum of all the gradients, or the average?

Past that, I'm not sure how to deal with the data. I suppose I'd need a nested data structure, such as arrays of arrays or trees of trees to handle it. With arrays, I could make a 3 dimensional array and insert each value in its order positioned, and I think the only downside would be the poor insertion performance of arrays. On top of that, I think I'd need arrays for each point from there storing at least the n most significant points. I think this would allow me to quickly access any points, as well as compute the gradient for up to n-neighbors.

Alternatively, I could do binary search trees, but other than avoiding the insertion penalty of arrays they don't seem to offer most benefit, from what I can tell anyhow. It seems that in any case, they'll take significantly longer to access data than arrays would. If this was an optimization problem I suppose they'd be superior, but it doesn't seem there's any other way to approach this than brute force.