I assume you use integer for the coordinates. You could do something like the following:
for (int z = A.z; z <= B.z; z++) {
for (int y = A.y; y <= B.y; y++) {
for (int x = A.x; x <= B.x; x++) {
// Do things here.. You can get the coordinates from the x, y, and z variables.
}
}
}
This will basically iterate through every point (*) including the point given (A and B).
I don't know what you're looking for but it seems to me this is what you ask.
Here's a fast example without using z (tested with cpp.sh):
// Example program
#include <iostream>
struct point {
int x, y, z;
} A, B;
int main()
{
A.x = 3;
A.y = 4;
//A.z = 0;
B.x = 7;
B.y = 5;
//B.z = 0;
//for (int z = A.z; z <= B.z; z++) {
for (int y = A.y; y <= B.y; y++) {
for (int x = A.x; x <= B.x; x++) {
// Do things here.. You can get the coordinates from the x, y, and z variables.
if (x == A.x && y == A.y) printf("A[%i, %i]", A.x, A.y);
else if (x == B.x && y == B.y) printf("B[%i, %i]", B.x, B.y);
else printf("[%i, %i]", x, y);
}
printf("\n");
}
//}
}
Example above will print all the coordinates like so: [x, y]
. Oh, and also the above example won't work if B is smaller than A.. Need to do something about that, probably a check or even a dynamic approach.