Lets say I have two locations, each one with X, Y, Z, and a int. Each location represents one cube in a 1000 x 1000 world. Lets say I had one location at 500, 343, 284, with an int 1. Another one at 800, 100, 212, with an int 3. Lets say I wanted to make a whole cube, where location one is at one corner, and the other one is at the far other corner of the cube. Now lets say I want to take every block in that cube and change the int to 0. What algorithm would let me calculate which pixels are in the cube even though each location could be anywhere within the area of the world. How?
If the locations are suitably indexed by x, y, z, then
If they are not, then:
This code is written for clarity rather than efficiency. It could be optimized to exit early if any of the "inside" tests return "false", of course.
Also, I assumed you didn't really mean "cube" (which is a shape whose sides have equal lengths). Instead, I assumed you were just talking about a block-shaped thing with sides parallel to the x,y,z axes.