F-RAD - functional representation aided design

Brandon Martin-Anderson - May 2012

F-RAD

What did you work on?

I built a web-based solid CAD tool. The tool has two interesting features. First, designs are specified textually instead of graphically. Specifically, the user produces a boolean functional representation by specifying a javascript function that takes a two- or three-dimensional point and returns a boolean value corresponding to the interiority of the point. Second, the design (which itself has no inherent resolution) is approximated by a mesh of triangles using the marching triangles algorithm and presented as a rotatable model in-browser using webgl.

What is the prior art?

This tool has several principal components: script-based CAD, web-based CAD, boolean functional representations, and marching triangles approximation.

Web CAD:

Tinkercad - https://tinkercad.com/home/

3dtin - http://www.3dtin.com/

Script-based modeling:

OpenSCAD http://www.openscad.org/

Boolean f-reps:

OpenCAD

F-rep editor - http://fab.cba.mit.edu/classes/S62.12/people/keeter.matt/gui/index.html

Marching Triangles

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.34.4045

What did you accomplish?

Work proceeded in several stages. First I built a simple two-dimensional javascript f-rep evaluator that simply evaluates the interiority function for every pixel in the viewport. Using this interface I developed an expressive domain specific language for creating and manipulating f-reps. I expanded the language to create three-dimensional f-reps, and implemented the marching triangles algorithm to approximate the surface of the f-rep in three dimensions. One particular challenge (and potential innovation) was the work involved in searching for surfaces and surface normals given only a boolean representation.

What did you learn?

I learned how to warp coordinate spaces; how to find the circumcenter of a triangle using barycentric coordinates; a whole lot of vector math, including how to rotate one vector around another; how to display and rotate 3d models using webgl; how to find the surface and normal of an f-rep-defined implicit surface.

What are the implications for future work?

F-RAD could potentially enable a great deal of collaboration on three-dimensional design. First, it is an exceptionally expressive and extensible solid design tool. Through a combination of mathematical primitives, coordinate transformations, and scripting nearly every shape is expressible. Second, since the canonical form of a F-RAD object is a textual document, distributed design projects can use text-native content versioning systems (eg git, mercurial) to manage project development. Lastly, since F-RAD runs completely in-browser without any server-side components, F-RAD scales nearly infinitely and presents very little barrier to entry for a new user.

What are your plans for the project?

There are a number of meshing bugs and improvements that are needful before wide deployment. Subdivision in places with higher detail and decimation in places with low detail, for example. The next step after that is an STL export feature. Eventually I’d like to start an open source project to completely specify a 3d printer design using F-RAD. Open source projects are able to produce high quality artifacts without central coordination by hill-climbing up the design space by accepting or rejecting a large number of diffs according to an objective function. If the objective function is well-defined, can be applied to project diffs easily, and the project receives a large number of diffs, the project tends to rise in quality fairly fast. A 3d printer project using F-RAD could potentially satisfy all those requirements - the objective function is well-defined, F-RAD could enable a large number of contributions, and the 3d-printer itself would enable easy testing of diffs by allowing the printing of the contributions. What’s especially exciting about this project in particular, is that as the project improves the rate at which diffs can be evaluated will increase, increasing the rate of improvement of the project.

What resources are you leaving for others?

Code for F-REP is in the class repository, and at http://fab.cba.mit.edu/classes/S62.12/people/martinanderson.brandon/solver3.html.

Appendix - intermediate experiments

Draw lines - solver.html

Evaluate and triangulate 2d shapes - solver2.html

Fit polynomials to points - curvefit.html