Sin and Cos – The Programmers Friend!

I was doing a little bit of searching on the internet for how I might go about drawing a simple circle on an LED matrix. I then stumbled upon an excellent website which had some great information on using Sin and Cos to not only draw circles but also for making game mechanics work.

For example, if you were making a game that is similar to say, Micro Machines you would need to work out the angle and speed that the car is travelling when the player is accelerating / turning etc… The website goes into all of this and has been a great learning experience for me.

Micro Machines Screenshot
MicroMachines

 

The site also goes into Polar to Cartesian conversions, making psuedo 3D graphics from 2D graphics (like the Super Nintendo Mode 7 games such as Super Mario Kart and F-ZERO). The site includes lots of code examples too.

Here is a Super Mario Kart Game Track (this is the actual graphic that you drive on).
SuperMarioKartMapMushroomCup5

Here is that same graphic but now with Mode 7 enabled:
Mode7

Here is the link!

http://www.helixsoft.nl/articles/circle/sincos.htm

 

 

Image References:

http://www.helixsoft.nl/articles/circle/sincos.htm

http://www.snesmaps.com/maps/SuperMarioKart/SuperMarioKartMapMushroomCup5.png

http://3.bp.blogspot.com/-29zV9JDyvK8/Ug0zTTHIr3I/AAAAAAAAiM8/OtEACB3VDSU/s1600/Super_Mario_Kart_(SNES)_45.png

http://www.superdownloads.com.br/imagens/screenshots/1/0/105480,O.png