## Welcome to MakerHome

We've completed our yearlong print-a-day project! New projects will be posted at www.mathgrrl.com/hacktastic.

All mathgrrl designs and associated images and files on MakerHome are licensed under the Creative Commons Attribution Non-Commercial Share Alike license. If you want to use designs, images, or files outside of the terms of this license, please email request@mathgrrl.com.

## Friday, May 16, 2014

### Day 263: Friday Fail: Off-by-one edition

Being off by one is probably the simplest, most common coding mistake you can make, but it got me this week while I was trying to make tessellating Cairo pentagon tiles for Frank Morgan and his students at Williams College. These Cairo tiles are supposed to have a mirror symmetry as shown in the drawing below, but the ones I printed didn't have this symmetry, so I knew something was wrong.

It took me a while to figure it out, but the culprit was a for loop in OpenSCAD that I had started at 1 instead of 0. By "a while" I mean I didn't figure it out until the next day! It's obvious now, but maybe knowing what kind of error this can cause in a 3D model will help someone else identify this mistake sooner than I did, so let me explain. The coordinates I was using for the pentagon were as follows:

/////////////////////////////////////////////////////////////
// point data ///////////////////////////////////////////////

points_cairo = [
[-1,0],[1,0],[2.3660,2.3660],[-2.3660,2.3660],[0,3.7321]
];

My simple pentagon module just forms the convex hull around five spheres at these points, and five spheres translated a bit up from these five points, to make a rounded pentagon tile:

/////////////////////////////////////////////////////////////
// render ///////////////////////////////////////////////////

/////////////////////////////////////////////////////////////
// pentagon module //////////////////////////////////////////

hull(){
for (i = [0:4]){
// the five points of the pentagon