# Generating equally distributed voxel points based on a given point

I have a list of seed points that each of them indicates the bottom-left value of a voxel. In order to improve the accuracy of my function, I need to equally sample my points and apply my functions on them.For instance, with 0.5 step-size, I should get 27 seed points on the related voxel. Here is an example:

seedpoints= {{33, 55, 12}, {33, 55, 13}, {33, 56, 12}, {33, 56, 13}, {33, 57, 12}, {33, 57, 13}, {33, 58, 12}, {33, 58, 13}, {33, 59, 11}, {33, 59, 12}, {100, 70, 14}, {100, 71, 12}, {100, 71, 13}, {100, 71, 14}, {101, 68, 13}, {101, 69, 12}, {101, 69, 13}, {101, 70, 12}, {101, 70, 13}};
(*h=stepsize*)


Based on the first seed point, I should nearly get:

desiredoutput={{33,55,12},{33+h,55,12},{33+2h,55,12},{33,55+h,12},{33+h,55+h,12},...,{33+2h,55+2h,12+2h}};(*all points must be on the related voxel,meanly 33+2h<=34 && 55+2h<=56 &&12+2h<=13*)


I hope, it is sufficiently clear. Any help or idea is appreciated.

Maybe this way:

hh = Tuples[{0, h, 2 h}, 3];
Plus[hh, ConstantArray[#, 27]] & /@ seedpoints // Flatten[#, 1] &


{{33,55,12},{33,55,12+h},{33,55,12+2 h},{33,55+h,12},{33,55+h,12+h},{33,55+h,12+2 h},{33,55+2 h,12},{33,55+2 h,12+h},<<498>>,{101+2 h,70,13+2 h},{101+2 h,70+h,13},{101+2 h,70+h,13+h},{101+2 h,70+h,13+2 h},{101+2 h,70+2 h,13},{101+2 h,70+2 h,13+h},{101+2 h,70+2 h,13+2 h}}

• That's nearly what I want, thanks. – cesm Jul 16 '13 at 7:47
• @cesm So maybe I can improve it, tell me why it is "nearly" :) – Kuba Jul 16 '13 at 8:45
• Oops, sorry. There had been a confusion, that's exactly what I want:) Thank you :) – cesm Jul 27 '13 at 14:26

You might want to consider putting the sample points at the centers of the subvoxels, instead of at their corners. This would both reduce the step size and eliminate duplicate sample points for adjacent voxels. For instance, in Kuba's code use
n = 3; hh = Tuples[Range[1,2n,2],3]/(2n);
You still have 27 sample points/voxel, but h = 1/3 instead of 1/2.

• Thanks, that's another point of view. – cesm Jul 16 '13 at 7:50