Home AMX User Forum AMX General Discussion

NetLinx math library

So with all this recent discussion about open source projects and how sexy they can be etc I thought I'd finally get round to putting up an initial version of the native netlinx math library I've been working on.

Presently the library is pretty basic, partially due to a lack of time, but also due to a lack on knowledge on my part (I'm working on it though). The initial release gives you:
- ceiling
- floor
- round
- inverse square root
- a fast square root (I'm working on an accuracte / real sqrt, but haven't had any success so far)
- logarithm (to an arbitary base)
- natural log
- log base 2
- log base 10
- power
- a boolean 'isWholeNumber' test
- the ability to decompile and recompile floating point values (if for whatever reason you feel the need)

The next milestone I will be trying to work towards is a set of trig functions.

I've set it up as a google code project to keep things nice and easy. At the moment it is licensed under the Mozilla Public License so feel free to grab a copy and start using it in any projects you desire. If you do make any modifications, improvements or optimisations please respect the license and share alike (only the math.axi, not your whole project). If anyone is keen to become a contributor let me know and I'll give you full access, I'm putting this out there to try an kick start a community effort. Also, if you just grab a copy and just find it useful let me know to :).

Anyway, here it is https://code.google.com/p/amx-netlinx-math/.

*Edit*
This has now merged into the NetLinx Common Libraries project.

Looking forward to seeing how this turns out.


P.S. I've also got a string manipulation library in the works so stay tuned.

Update:
String library here.

Comments

  • Jorde_VJorde_V Posts: 393
    Nice to see you take an initiative, I'll definitely check it out. And see if I can help out in any way :)
  • truetrue Posts: 307
    Yay for log functions. That was going to be one of the next things I was going to work on.
  • a_riot42a_riot42 Posts: 1,624
    PhreaK wrote: »
    So with all this recent discussion about open source projects and how sexy they can be etc I thought I'd finally get round to putting up an initial version of the native netlinx math library I've been working on.


    Looking at the Math file, it seems like a lot of this code is derivative of other code I have seen before. Are you sure you have the exclusive rights to it?
    Paul
  • PhreaKPhreaK Posts: 966
    The log and power algorithms are public domain domain. The fast inverse square root algorithm is an old one which, as noted, was originally created by Greg Walsh and later popularized in Quake II. Then everything that is remaining is mine.

    So as far as I know licensing wise it's all solid. What had you concerned?
  • a_riot42a_riot42 Posts: 1,624
    PhreaK wrote: »
    The log and power algorithms are public domain domain. The fast inverse square root algorithm is an old one which, as noted, was originally created by Greg Walsh and later popularized in Quake II. Then everything that is remaining is mine.

    So as far as I know licensing wise it's all solid. What had you concerned?

    I'd seen the math_inv_sqrt in other code, and thought I had seen the math_log function elsewhere too so I thought I would ask. I never looked into whether that code was in the public domain or still under copyright by id Software. How did you find out that it was public domain? If it is, that would be cool as I would like to use it for an upcoming project.
    Paul
  • PhreaKPhreaK Posts: 966
    id never had the copyright for that inverse square root algorithm. Carmack is one seriously smart uber geek but it's not his original work. There's a full history of it here and a follow up here.

    Chris Lomont also has a nice paper on how it works.
Sign In or Register to comment.