Course:CPSC-312-2023-Polyhedron-Generator

From UBC Wiki

Polyhedron Generator

Authors: Em Chu, Adam Mitha

What is the problem?

There is no problem. This was done for fun. We created a tool that allows users to generate polyhedra from a plaintext seed using Conway polyhedron notation. It is similar to this online tool except with no GUI and with a different output format.

What is the something extra?

Instead of producing two-dimensional or polyhedral-graph-only output like we initially thought we would, we decided to make STL files instead. This decision was helped by the fact that the default image viewer on macOS allows you to view and rotate STL shapes. Here is an example of such a file which you can rotate in the browser. Unfortunately the UBC wiki doesn't allow me to upload my own; images will have to do. The first two photos are the result of the string "eC" or "expand cube" (which is equivalent to, and implemented as, "aaC"); the latter two are "aC" or "ambo cube."

What did we learn from doing this?

As for learning Prolog, a lot of the code was written in an attempt to work around prolog rather than with it. We have an entire file trying to restore the higher-order list functions of other languages, and most of our predicates work just like functions anyway (the first few arguments are inputs, the last one is an output, and these don't change). I don't think Prolog was the worst language for this use case, but I also don't think our implementation used very much of its power.

Geometry-wise, we learned some interesting relations between the Platonic solids, and what the dual of a polyhedron (or polygon, or graph) is. We learned about the correspondence between polyhedra and planar graphs, though luckily we decided to keep track of faces rather than trying to rediscover peripheral cycles. The representation we decided on was the abstract polytope which worked very well for finding vertices or edges within a polyhedron or face, or faces that contain a certain edge or vertex.

Links to code etc.

https://github.com/mlechu/shape-rotator