SOLVESPACE -- parametric 2d/3d CAD
Examples
Tutorials
Features
Download
Reference
Technology
Library
Forum
Contact
USER FORUM

(you are viewing a thread; or go back to list of threads)

Using SolveSpace as a 2D angular constraint solver for an optical layout program (by Sean)
Hi there,

I've been trying to come up with a way to programmatically create optical layouts (graphics containing components such as mirrors and showing the path that laser light takes around such components). This avoids having to manually maintain such layouts in vector graphics editing programs such as Inkscape. This is particularly irritating when it comes to optics, because rotating a mirror results in the light beams having to be realigned all over the diagram.

I've written up a more detailed description over on the FreeCAD forum, if you care to take a look: https://forum.freecadweb.org/viewtopic.php?f=10&t=21712

I was hoping to use an existing constraint solver that can handle angles, because my attempts to write my own or adapt others has so far been unfruitful. The critical feature for such a solver is that it must be able to handle cyclic graphs (when one node connects to another via two different edges); this is paramount for optical layouts (interferometers - which I draw all the time - use mirrors to split light and recombine the beams having taken two different paths). I thought FreeCAD would work, but it apparently can't handle cyclic graphs.

Can anyone give me an idea of whether this would be possible with SolveSpace? My idea would be to use SolveSpace's library as the solver for my Python program.

Thanks for reading!
Sun Apr 9 2017, 09:35:53
(no subject) (by Jonathan Westhues)
SolveSpace permits arbitrary cyclic dependencies. (In fact, the solver never explicitly builds a dependency graph; it mostly just solves the whole thing in one big Newton's method.) It's unlikely to be optimally fast, convergent, etc. for the problem that you describe, which contains structure that we don't exploit, but it should work.
Sun Apr 9 2017, 21:58:43
(no subject) (by Sean)
Hi Jonathan, that's great! Are there any code examples using the library to solve a set of points with constraints? I can see tutorials for the GUI, but not for the library.
Mon Apr 10 2017, 13:24:03
(no subject) (by Jonathan Westhues)
No tutorials, just the documentation and some examples. I'd suggest trying your geometry in the GUI first, then coding it once everything works.
Tue Apr 11 2017, 00:55:16
(no subject) (by Sean)
Ok, cheers for the info - I'll look into it.
Tue Apr 11 2017, 17:39:27
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):
© 2008-2018 SolveSpace contributors. Most recent update Nov 22 2018.