1 ) A computer-implemented method for generating an N-dimensional lattice of points that respects features in an N-dimensional digital image, where N is an integer greater than zero, the method comprising: initializing said lattice of said points in a subset of space sampled by said image; optimizing said lattice by moving said points to extremize a composite function of spatial coordinates of said points; wherein said composite function is a weighted combination of a first function of pair-wise distances between said points, and a second function of sampled values of said image near said points; and wherein said optimized lattice of points is usable to generate a mesh for simulation of a process associated with said image.