I've been desperately attempting to create a sphere tool in my voxel engine. I know the general function for creating a sphere:
public bool getPoint (int x, int y, int z) {
return (x*x+y*y+z*z < r*r) ? true : false;
}
This function will create a sphere assuming the origin is at (0, 0, 0). Yet I want to be able to create a sphere with a custom origin (or user-defined) say the origin is at (10, 10, 10). How would I modify this function to move the origin to a different position?