Working on a computational geometry lib...

Discussion of Common Lisp
Post Reply
Pixel_Outlaw
Posts: 43
Joined: Mon Aug 26, 2013 9:24 pm

Working on a computational geometry lib...

Post by Pixel_Outlaw » Thu Sep 26, 2013 10:15 pm

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

edgar-rft
Posts: 226
Joined: Fri Aug 06, 2010 6:34 am
Location: Germany

Re: Working on a computational geometry lib...

Post by edgar-rft » Fri Sep 27, 2013 4:59 am

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))

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: Working on a computational geometry lib...

Post by nuntius » Fri Sep 27, 2013 11:15 am

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

Pixel_Outlaw
Posts: 43
Joined: Mon Aug 26, 2013 9:24 pm

Re: Working on a computational geometry lib...

Post by Pixel_Outlaw » Sat Sep 28, 2013 12:17 am

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...

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: Working on a computational geometry lib...

Post by nuntius » Sat Sep 28, 2013 7:24 pm

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/

Pixel_Outlaw
Posts: 43
Joined: Mon Aug 26, 2013 9:24 pm

Re: Working on a computational geometry lib...

Post by Pixel_Outlaw » Sat Sep 28, 2013 10:19 pm

Thank you for the links. :)

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: Working on a computational geometry lib...

Post by nuntius » Thu Nov 07, 2013 8:57 pm

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

Post Reply