# Geometric Constraint Solver

BRL-CAD supports many primitives, including a 2D sketch primitive, but we do not presently provide the means to specify values that are undetermined or otherwise dependent calculations. That is to say that there is no support for constraints and parametrics such that a modeler can define a sphere such that the sphere's radius necessarily maintains tangency with a given planar surface or (in the 2D case) that a line segment must remain at a fixed angle relative to another line segment.

This task would focus on implementing basic support for this feature in the BRL-CAD geometry format. Past work has focused on a full, generic constraint system for 2D and 3D modeling. For this year's task, we are proposing a slightly different approach to the problem, with more "incremental" steps towards the final goal:

- Beginning with the 2D sketch primitive, integrate existing BSD licensed 2D constraint solving functionality from exising projects:

In particular, psketcher offers some Qt visualizations of sketch editing - a good "first step" would be to make a "Qt sketch editor" for BRL-CAD's sketch objects. Note that this will require replacing GSL with something else (probably Eigen) for matrix functionality in psketcher's src/mmcMatrix/mmcMatrix.cpp, and possibly other refactoring.

- Once a solving framework is in place and working with BRL-CAD sketch objects, test out the Gecode constraint solver by defining the 2D constraints from the above solvers in the Gecode framework - see how its solving speed compares to the dedicated 2D solutions, and how straightforward it is to use Gecode to solve such problems.

- If Gecode proves viable, begin expressing 3D constraints.

# References

- https://code.google.com/p/psketcher/
- https://code.google.com/p/sketchsolve/
- http://www.gecode.org/
- http://www.gecode.org/doc-latest/reference/classCartesianHeart.html
- src/librt/primitives/sketch
- contains sources pertaining to BRL-CAD's 2D sketch primitive

Requirements:

- Familiarity with C/C++

Note: Previous GSoC projects have made some progress towards a parametrics/constraint library. Please check libpc Developer Doc as well as the libpc source. While it is certainly a viable route to pick up where those efforts left off, the above approaches are likely to require less "up front" work for visible results.