3D Printer Gosper Curve

A Gosper Curve, 3d printed through a custom g-code compiled with p5.fab.
Supplies
Software: p5.fab. Hardware: Ender 3 Pro 3D printer. Material: PLA.
Research


I wanted to create an object from a single curve that would create a space filled object compact enough to fit on the 3D printer bed with some detail. The Gosper Curve's nature of expanding in a sort of radial way as opposed to out along some axis made it conducive to this goal.
Printer Functions

The first step would be to understand the way that p5.fab compiles g-code from the p5.js java language. Using the library as a reference, I created functions which would achieve the normal processes in initializing, starting, and stopping a print.
Generating the Curve

These functions generated and rendered the Gosper Curve. Using the rule set expressed in the Wikipedia article, a string was produced. The letters "A" and "B" signify a step forward, while the symbols "+" and "-" signify a turn of 60 and -60 degrees respectively. The recursive nature of the curve, means that a variable order should be defined, which means that each letter "A" and "B" will be replaced by more instructions, possibly to infinity. In this case, an order of 4 was defined to contain the curve to the printer bed. The renderer then executes the instructions in a way which adheres to p5.fab's path generation.