GLBasic forum

Main forum => FAQ => Topic started by: mentalthink on 2012-Aug-26

Title: Question about Sin a Cos , perhaps can be more quick?¿
Post by: mentalthink on 2012-Aug-26
Hi I put here this question... becuause not it´s a doubt, else it´s an idea...
In the forum we have 2 libraries whit cos and sin very fasters both... but I rebember reading some book, of ASM of Amstrad CPC, I think i read something... in the 80 decades when the programmers don´t have too much machines, they make something like use only a quadrant of Sin or Cos, and when they want make a complete revolution in Radians, they multiply this values of the first quadrant each time needed.

I´m not sure if this can have any advantage, perhaps today can be insignificant, and I only want to ask, for if someelse can do, or can teach me a little how make a cosine library and I try it.

Thanks.
Iván J.
Title: Re: Question about Sin a Cos , perhaps can be more quick?¿
Post by: kanonet on 2012-Aug-26
Dividing a full circle in smaller parts, and just calculate the small part is what my lib currently does, its of cause faster/accurater than doing an approximation for the full circle. Yes this obvious trick is very old.
Title: Re: Question about Sin a Cos , perhaps can be more quick?¿
Post by: bigsofty on 2012-Aug-26
Its called the Midpoint Circle Algorithm, see here, http://en.wikipedia.org/wiki/Midpoint_circle_algorithm A very handy trick for quick drawing of circles as Kanonet said. Its heavy use of integers made it perfect for Z80 assembly on the CPC too.
Title: Re: Question about Sin a Cos , perhaps can be more quick?¿
Post by: mentalthink on 2012-Aug-26
Hi thanks kanonet and bigsofty... I´m a bit ignorant  :-[ :-[ =D

Thanks for the link too I take a look, it´s very interesting know new things... programmins it´s too much huge Art...  :o

Thanks to both.
Title: Re: Question about Sin a Cos , perhaps can be more quick?¿
Post by: bigsofty on 2012-Aug-27
Np, a good programmer should never admit that he does not know it all!  :S

BTW, the Code Snippets forum is for posting bits of your code to share, not really for discussion.  ;)

Edit:

Wait a min, that's wrong, it should be...

Np, a good programmer should never admit he knows it all!  :S

   :D
Title: Re: Question about Sin a Cos , perhaps can be more quick?¿
Post by: mentalthink on 2012-Aug-27
Hi Bigsofty, thanks for the advice... I think only I have a reply or anyone, this it´s the fact for not put in main thread.   :giveup:

Ian thanks for move the threand to here!!!  :good: