This commit is contained in:
Miloslav Ciz 2024-05-05 23:13:54 +02:00
parent 44be4a9522
commit 780920e41b
13 changed files with 1794 additions and 1756 deletions

View file

@ -171,7 +171,9 @@ Bear in mind the main purpose of this quiz is for you to test your understanding
68. [Elon Musk's](elon_musk.md) net worth is about 200 billion USD, suppose he spends all his net worth on $1 prostitutes, how many times to the Moon and back would they reach? Suppose the length of a [woman](woman.md) with stretched arms is 2 meters, distance to the Moon 380000 km and neglect the fact that there are only 8 billion people on Earth. Also considering cost of normal living to be $30 per day and average life span 70 years how many lifetimes could he live off of this fortune?
69. Say we have a square digital image, i.e. a grid of pixels of resolution *N x N*. We want to scale it down to *N/2 x N/2*. For this we could subdivide the image into 2x2 blocks and out of each block take only one pixel, for example the top left one, discarding the three other pixels. However there is a danger in doing this -- for example downscaling a black and white [dithering](dithering.md) pattern (a kind of checker board) this way would result in either a completely black or completely white image, drastically changing the overall brightness of the whole image! What's this problem called and how could we prevent it?
70. Give numeric answers to queries that will follow, then compute average error against each correct answer; you want an error not greater than 3. Number of essential software freedoms defined by GNU. Year when Creative Commons non-profit was established. PDP 10 word size divided by 5 (use integer division). Century (its one-based sequential number) in which Western Roman Empire officially ended (lost its last emperor). Century in which [Nikola Tesla](tesla.md) was born. Year when first man set foot on the Moon.
71. Did you enjoy this quiz?
71. You've probably seen a game freeze and become unresponsive and then you likely heard audio get stuck too in a weird way: a short piece of sound is just played over and over like a broken vinyl record. Why does this happen? How and WHY is audio typically implemented here?
72. Mention at least one advantage and one disadvantage of using [matrices](matrix.md) to represent transformations in 3D engines.
72. Did you enjoy this quiz?
### Answers
@ -245,7 +247,9 @@ Bear in mind the main purpose of this quiz is for you to test your understanding
68. About 1052 distances to the Moon, about 260926 lives.
69. It's called [aliasing](aliasing.md), it's addressed by [antialiasing](antialiasing.md) which usually suppresses or removes the effect by increasing the sampling frequency, in our case of downscaling image this would mean replacing each of the small 2x2 blocks by an average pixel value in that block, i.e. taking into account all four samples as opposed to just one.
70. 4, 2001, 7 (the word size is 36), 5 (year 476), 19 (year 1856), 1969.
71. yes
71. Continuous audio is normally implemented with a [circular buffer](circular_buffer.md) -- that is we have a buffer of audio samples of certain size *N* and that is being played over and over, with the play head going from start to finish and then back to start again; the program has to keep updating this buffer regularly to fill it with new samples to play and it has to keep ahead of the play head. Circular buffer is nice because we don't have to shift it as a whole (which would require moving a lot of values in memory), the only thing that is moving is the play head, that's why it's used as opposed to e.g. a queue. When a game freezes, it stops operating correctly and it stops updating the audio buffer, so whatever is in it will just be played over and over in a loop.
72. Main advantage is that a matrix can hold any combination of transformations and that applying all the transformations is then simply performed by performing a single matrix multiplication which additionally may be implemented with quite fast matrix multiplication algorithms. Not only can a matrix represent for example the whole translation+rotation+scale transformation of a single object, it can hold any number of such transformations performed in any order so that we can for example precompute a matrix that will perform world transformation, camera space transformation and view space transformations all at once! That's very fast. Disadvantages of matrices may be that they can only hold affine transformations (i.e. they can't represent ANY transformation whatsoever), it may also be a bit harder to extract back the parameters of the transformation from a matrix (though it can be done) etc. Also in case of some extreme memory limitations matrices may take up more space than would be strictly needed.
73. yes
## Other