Page 1 of 1

Working on a computational geometry lib...

Posted: Thu Sep 26, 2013 10:15 pm
by Pixel_Outlaw
Hello again,

I really suck at math for the most part but I'm trying to implement a CAD like library of intersection functions.

The user Bike from #Lisp (irc.freenode.net) said I should probably not return lists but use structures, classes and multiple return values. I'll probably get around to that later.

Right now I just have a series of computations. More to come if there is interest.
Kind of pointless without a solid common GUI library but maybe it could be used in a back end...

I'd very much like to eventually have an AutoCAD like program that is true free software.
AutoCAD lets one load Lisp functions into the software meaning you can do whatever you want (very much like Emacs in the extensibility idea).

So...yeah just putting this out there. I still need to find out how atan2 works in Lisp to finishing finding my direction calculations.

Linky:
https://github.com/RyanBurnside/CAD_Math

Re: Working on a computational geometry lib...

Posted: Fri Sep 27, 2013 4:59 am
by edgar-rft
The Common Lisp ATAN function has an optional second argument. If you give two numbers as arguments to ATAN then it will work like atan2 in other programming languages. Note that the second argument must be a REAL number (integer, ratio, float), i.e. not a COMPLEX number.

In case of doubt: atan2 num1 num2 -> (atan num1 num2) == (atan (/ num1 num2))

Re: Working on a computational geometry lib...

Posted: Fri Sep 27, 2013 11:15 am
by nuntius
I would encourage you to create a CL binding to an existing library rather than attempting to create a new one from scratch.
These things require a large number of functions, and the math can be quite hard to get right.

Here is an "easy read" showing some of the possible gotchas. http://www.mpi-inf.mpg.de/~kettner/pub/ ... gta_06.pdf

Re: Working on a computational geometry lib...

Posted: Sat Sep 28, 2013 12:17 am
by Pixel_Outlaw
nuntius wrote:I would encourage you to create a CL binding to an existing library rather than attempting to create a new one from scratch.
These things require a large number of functions, and the math can be quite hard to get right.

Here is an "easy read" showing some of the possible gotchas. http://www.mpi-inf.mpg.de/~kettner/pub/ ... gta_06.pdf
I've considered the loss of precision and realize that computers are really bad tools to model shapes thanks to truncation error...
Do you have a library in mind to wrap?
I really hate to use something written in C/C++ etc as those don't really further the language itself...

Re: Working on a computational geometry lib...

Posted: Sat Sep 28, 2013 7:24 pm
by nuntius
I really think the Lisp community needs to engage the C/C++ community more. Look at the success Clojure (JVM Lisp) has had to get a feel for the possibilities.

Its not always glorious work, but it grants rapid access to large repositories of existing code. ECL is a good implementation for such tasks.

Here are some links that may be of interest depending on your actual goals.

http://www.cgal.org/
http://www.csc.fi/english/pages/elmer
http://www.freecadweb.org/
http://www.openscad.org/
http://brlcad.org/
http://sourceforge.net/projects/netgen-mesher/
http://wias-berlin.de/software/tetgen/

Re: Working on a computational geometry lib...

Posted: Sat Sep 28, 2013 10:19 pm
by Pixel_Outlaw
Thank you for the links. :)

Re: Working on a computational geometry lib...

Posted: Thu Nov 07, 2013 8:57 pm
by nuntius
Some more links.

http://solvespace.com (Quite fun and powerful for its small size, roughly 30kloc. Alas, it does have limits and bugs.)
http://www.opencascade.org/
http://opensourceecology.org/wiki/CAD_tools