I still think the calculations themselves are not relevant, it just seems like some experiment (especially with the screens from the video in mind).
However, I'll try and explain what I think the code does (without more information it's not that easy):
First, he loops over all screen pixels and calculates a color for those.
double ydepth = y - height / 2;
would cause the depth to be negative for all pixels at the top half of the screendouble xdepth = x - width / 2;
would cause the depth to be negative for the left half of the screen
This seems to be done in order to center the generated pattern within the screen. There are those 2 black segments (lower left and upper right), but the code you posted doesn't explain what is done here.
int xx = (int) (xdepth) & 5;
would set the value of xx
to 0 (i.e. black) whenever neither bits 1 nor 3 (5 is binary 101) are set. Thus xx
can only have the values 0, 1, 4 and 5 which would cause those black streaks.
xx * 128
would boost the value to 0, 128, 512 and 640, which would result in a different depending on how pixels
is used. (If pixels
represents colors in ARGB format, 0 would be black, 128 would be dark blue, 512 would be dark green (almost black) and 640 would also be dark blue with some slight green component.
That being said, I just skimmed over the code and did some example calculations where necessary. For more information just follow that trail.