“`c float radius = chf(“radius”);
float dia = volumevoxeldiameter(0, “height”) / sqrt(3);
int voxel_rad = ceil(radius / dia);
float height_max = f@height;
for(int i = i@ix-voxel_rad; i <= i@ix+voxel_rad; i++) { for(int j = i@iy-voxel_rad; j <= i@iy+voxel_rad; j++) { if(length2(set(i-i@ix, j-i@iy)) < voxel_rad*voxel_rad) { float height = volumeindex(0, "height", set(i, j, 0)); height_max = max(height, height_max); } } }
f@height = height_max; “`