Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / logarithm function?

Author
Message
mindsclay
11
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 12th Jul 2014 05:05 Edited at: 12th Jul 2014 05:09
LOG is not the logarithmic function in AGK. How could one perform a logarithm in AppGameKit? IS there a plugin or such?

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 12th Jul 2014 06:12 Edited at: 12th Jul 2014 06:14
I wrote an approximation one a while back: http://forum.thegamecreators.com/?m=forum_view&t=193433&b=41&msg=2308174#m2308174. I don't remember the maths to it and it may not be very accurate. You'll have to play with it. Don't rely on it as a proper log() function. I also haven't tested it thoroughly.

Edit: It may also be worth emailing Paul (or finding him on the forums) to add in a log function. Shouldn't take him very long.
mindsclay
11
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 20th Jul 2014 08:28
Thanks. But that approximation is way off. log base 10 of 5 produces 0.50000 when it should actually be 0.69897

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
mindsclay
11
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 20th Jul 2014 08:34 Edited at: 20th Jul 2014 08:36
I find it hard to believe that there is nothing on the internet for writing a logarithmic function... that actually works.

I found one example code that will give a correct result for say log base 2 for 16 as 4. Because 2 to the 4th power is 16. But log base 10 for 5 produces 0.00000 instead of 0.69897.


I found an equation for natural logarithm but it only works when the number is between 0 and 2.

Why wouldn't there be any math functions in AppGameKit?? How would I move an object in a spiral without any trigonometric functions??

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 21st Jul 2014 12:26
Try with an accuracy of 30.

The following code produces a result of 0.698970

mindsclay
11
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 24th Jul 2014 05:46
Thank you!

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)

Login to post a reply

Server time is: 2024-04-25 14:42:27
Your offset time is: 2024-04-25 14:42:27