For rendering a 4k image for the final result. Times are:
Serial = 9.28 s
Parallel = 1.60 s
Speedup =
To compile cmake -B build -S . && cmake --build build
To run ./build/computer_graphics_from_scratch
Use Visual Studio
Lets say we have resolution 1000x1000
width : [-500, 499]
height : [-500, 499]
screen width : [0, 999]
screen height : [0, 999]
The formula the book says is:
screen_width = canvas.width / 2 + canvas_x
screen_height = canvas.height / 2 + canvas_y
screen_width_min = 1000 / 2 + -500 = 0 CORRECT
screen_width_max = 1000 / 2 + 499 = 500 + 499 = 999 CORRECT
screen_height_min = 1000 / 2 + 500 = 500 + 500 = 1000 WRONG
screen_height_max = 1000 / 2 - 500 = 500 - 499 = 1 WRONG
So for height we must do -1
