The Ham Sandwich Theorem in SOLIDWORKS

Happy spring everyone! With the weather finally improving after a barrage of Nor’easter storms, it’s time to break out those picnic baskets and have some sandwiches! But what if you want to share a sandwich with someone? Cutting a sandwich may sound like the most mundane task, but only if the sandwich was made neatly. What if the sandwich was jumbled around as you carried it in your basket? The parts slide against each other, making it difficult to ensure a cut that gives each person equal parts of each ingredient. But as I will show you, it is not impossible!

The question that follows: Does a cut that divides a sandwich into two equal parts exist? The funny thing is, it depends on the number of ingredients the sandwich has. For sandwiches that have four or more parts that cut could exist, but it is not guaranteed to exist, as most people would expect. But for a sandwich with three parts, that solution is guaranteed to exist. Even if your ingredients are lopsided and you are the worst sandwich maker in the world, you can still cut your terrible sandwich perfectly in half. Now, let’s prove this true with some geometrical facts and by using the power of SOLIDWORKS 3D design software!

First things first, we need to make a three-part sandwich in SOLIDWORKS. You can make your own at home, but here is the engineering assembly drawing of my lunch, complete with bill of materials.

Ham Sandwich Assembly Drawing

The bread was made by extruding a closed sketch, and the salami was made as a sheet metal part for reasons that will become clear later. Here’s our assembled sandwich in all its glory. I held all tolerances for cutting the slices of bread and placement to +/- 0.0001 in. Sure, it took a couple thousand out of our manufacturing budget, but look at this beauty:

Ham Sandwich SOLIDWORKS model

Every component is perfectly centered and meticulously crafted to ensure regularity of the shapes. In this case, cutting the sandwich in half is easy, just slice it down the middle. However, I have been informed that $3,000 is not a price many people can pay for a sandwich held to those manufacturing tolerances.

So, I will make a sandwich myself to keep the cost down. It may not be perfect, but, rest assured, it will be made with love.

I place the first piece of bread down:

Slide of bread SOLIDWORKS

So far so good. Now for that piece of salami:

Bread and Salami SOLIDWORKS

Erm … well … I seem to have folded my salami. As I said earlier, I’m not prepping for Gordon Ramsay, so this should be close enough.

Now for that last piece of bread. Making sandwiches is hard work, and I can really use a bite so I will take one out of this slice of bread before I place it down.

Our Ham Sandwich in SOLIDWORKS

Well, it is a sandwich, so we’re done here! But now, how do we cut this sandwich in half? This is where it begins to get a little more complicated. A straight cut down the middle isn’t going to cut it (pun intended); we need to be a more clever than that.

Consider this, each one of the ingredients has a point that cuts the mass directly in half. If you just take the slice of bread by itself, for instance, and hover your knife over it at some random place. Chances are likely that, if you cut there, one piece will be bigger than the other. If you start moving the knife towards the imaginary larger piece, the smaller piece gets bigger, and the bigger piece gets smaller, until the situation is the opposite.

This shows that there must be a location where the two halves are equal in mass. For very regular geometries, this point may coincide with the Center of Mass. For varying geometries, the Center of Mass deviates from the Point of Equal Mass (the one that truly cuts our sandwich in half). In this example, let us assume that the Center of Mass is close enough to the Point of Equal Mass to call them coincident. In some cases with extremely lopsided geometry, this assumption may not hold, but for a silly little bite, the accuracy should be more than enough!

Now let’s determine the center of mass for all components in the sandwich. In each component, go to Features > Reference Geometry > Center of mass. This places a center of mass feature at the top of the tree. You’ll find that if you try to select the checkered circle for anything, you cannot. That is because the Center of Mass is a “living” feature that updates with each modification of the geometry. If we want to select it for use as reference geometry we have to create a “Center of Mass Reference Point”. This is extremely simple to do. Right click the Center of Mass feature on the top of the tree and select “Center of Mass Reference Point”. Voila. It creates a feature in a specific point in the tree, much like a snapshot. Make sure that any modifications to your ingredient are before this point!

Center of Mass Reference Point

Repeat that for all three components. Once you’re done, go back to the assembly, and make sure we can see sketches in the view options. We should be able to see all three points.

CAD Sandwich with 3 Points

Now, if recall from your high school geometry class, how many points does it take to define a plane? If you guessed three, then you are correct. If you also guessed that the plane defined by these three points is the cutting plane we should use, then you are very correct!

In the assembly, go to Assembly > Reference Geometry > Plane and select the three points representing the center of mass. You should have a fully defined plane that magically cuts our sandwich in half!

Cut

Now let’s see what the two halves look like.

Two Havles of Ham Sandwich in SOLIDWORKS

They admittedly look unappetizing, but this is the equal division of the sandwich into two parts! Each person gets the same amount of bread and salami! The interesting thing is that this can be extended to sandwiches with more parts, with a catch. You can place as many components as you want, and the cut will still cut it in half as long as the center of mass point is on the plane. This gives us less freedom to place ingredients but will guarantee the cut.

Now that you know how to cut a sandwich in half, you go can go to the picnic and cut your sandwiches in confidence. Just remember to share!

Thanks for following along!

Check out more blogs like this one here. You’ll find helpful articles and educational videos on a wide range of engineering and manufacturing topics to help you maximize efficiency in your job role!

And don’t forget to follow us on Facebook, Twitter and LinkedIn to stay up-to-date on our latest blogs, videos, promotions and more!