We have two things to celebrate today:

1. Yesterday the new version of OpenSCAD was released! OpenSCAD 2015.03 now includes many long-awaited options such as **concat()** (see kitwallace‘s guest post on Day 229 of MakerHome), **list comprehension**, **text()**, **offset()**, and even **2D minkowski**.

2. Saturday will be a Super Pi Day, as it will be March 14, 2015 (3/4/15). Math geeks wherever dates are written in that particular format (sorry, Europe, but I’ll celebrate e day with you next year on January 27) will be celebrating by throwing pies at professors, solving pi-themed Sudoku puzzles, and generally appreciating circles.

To celebrate both of these things simultaneously, today’s model is a pi-flavored illusion cup that was made using some of the new features in OpenSCAD. For bonus pi-ness, the ridges are made using the same general trigonometric functions we used in our trigonometric bracelet models.

**Thingiverse link to download and print: http://www.thingiverse.com/thing:719104**

Most people will think that the cup is taller than it is around, but the cup is in fact shorter than its circumference. And we can prove it!

Proof by print:

Suppose the diameter of the base is 1 unit.

Then the circumference of the base is pi units.

The side of the cylinder is divided into three sections of equal height.

Each of those three heights is equal to the diameter of the base.

Thus the height of the cylinder is equal to 3 units.

Note 3 is less than pi.

Therefore the height is less than the circumference.

QED/yay

Here’s the OpenSCAD code we used to make this model. The idea is to use the new **list comprehensions** in OpenSCAD to quickly generate a list of points that trace out a trigonometric function, and then use those points to construct a polygon. Then we use the new **offset()** function to make a slightly smaller version of that same polygon, and subtract it. By using linear_extrude three separate times we can get the ridges going in a zig-zag pattern. Finally, we used the new **text() **function to stamp a pi-day message on the bottom of the cup.

// mathgrrl super pi day cup // requires OpenSCAD 2015.03 woot ////////////////////////////////////////////////////////////////////// // PARAMETERS pi = 3.14159; factor = 40; diameter = factor; radius = diameter/2; amplitude = 1; frequency = 24; s = 1; c = 0; twist = 3*360/frequency; myoffset = .8; step = 1; ////////////////////////////////////////////////////////////////////// // TRIG FUNCTION AROUND A CIRCLE function f(t) = 1+sin(s*frequency*t)*cos(c*frequency*t); function g(t) = [ (radius+amplitude*f(t))*cos(t), (radius+amplitude*f(t))*sin(t) ]; ////////////////////////////////////////////////////////////////////// // CONSTRUCT SOME LISTS mypoints = [ for (i = [0 : step: 360]) g(i) ]; echo(mypoints); myorder = [ for (i = [0 : 1 : 360/step]) i ]; echo(myorder); ////////////////////////////////////////////////////////////////////// // MODULE FOR SIDE SEGMENTS module sidepiece(twist){ linear_extrude(height=factor*pi/3, twist = twist, slices = factor){ difference(){ polygon(points=mypoints, paths=[myorder]); offset(r = -1*myoffset) { polygon(points=mypoints, paths=[myorder]); }; } } } ////////////////////////////////////////////////////////////////////// // RENDERS FOR SIDE SEGMENTS translate([0,0,0]) sidepiece(twist); translate([0,0,factor*pi/3]) sidepiece(-twist); translate([0,0,factor*pi*2/3]) sidepiece(twist); ////////////////////////////////////////////////////////////////////// // RENDER FOR BASE WITH PI STAMP b = 0.05; difference(){ linear_extrude(height=b*factor*pi/3, twist = b*twist, slices = b*factor){ polygon(points=mypoints, paths=[myorder]); } translate([0,-factor/8,-1]) linear_extrude(height=2) rotate(180,[1,0,0]) text( "Happy", halign="center",valign="center", size=factor/6, font="Futura"); translate([0,factor/8,-1]) linear_extrude(height=2) rotate(180,[1,0,0]) text( "\u03C0 Day", halign="center",valign="center", size=factor/6, font="Futura"); }

Happy pi day everyone! Celebrate wisely.