From: William James Date: 2006-12-21T11:55:07+09:00 Subject: Re: Common point puzzle Bil Kleb wrote: > Warning: the following really needs a sketch. > > I have a series of three (x,y) grids with values, z, > at each point. Each successive grid is twice as fine > as the previous, i.e., dx1 = 2 * dx2 = 4 * dx3. > > For a series of three nested grids, I'd like to compute > (z2-z1)/(z3-z2) at each of the points shared between all > three grids, i.e., at all the points of the coarsest grid. > > The catch? The (x,y) points are not ordered in the same > fashion for each grid. In other words, I need find the > (x,y) coordinate shared by all three for each point in > the coarsest grid. > > Now, I can do this with a bunch of conditional checks, > but I thought it might be possible to use Ruby's set > functions or Array intersection in some elegant way to > create some sort of a mask that I could overlay the medium > and fine grids with to find the coincident points. > > Thanks for reading this far, > -- > Bil Kleb > http://fun3d.larc.nasa.gov What is the layout of the array? Something like this? [ [x1,y1,z1], [x2,y2,z2] ... ]