'sin' does not just give better results, it is the right trigonometric function to use.

For the code you need to know:

* width:height aspect ratio (width / height as floating point number as...