The result of the sine function has a range from -1
to 1
.
By adding 1
to it, you move the result above zero.
However, since the range is now 0 .. 2
, the formula has a division by two, to normalize the result again.
This is really basic mathematics by the way. You should brush up on that, software development is not just putting together chunks of code.