> Even though onions aren't perfectly symmetrical
The question I have is not about modeling an imperfect object as a perfect abstraction, it's about modeling a 3D object as a 2d object, and assuming that the optimization still holds. I think it's pretty plainly clear that it doesn't. Think about some cross-section of the onion that's closer to you and smaller than the center cross-section. Let's say it's of radius 0.25 instead of 1. The slices you take of it will be much more vertical than the center slice. This changes things. My intuition tells me it means the optimal solution is shallower than the solution found here, since you'd want the "average" cross-section to follow this constant.
The author dealt with this outside the article, and posted a link to his slides in this HN post. The relevant slides begin at [1].
At the end of the day a straight cut is limiting. The next step would be to design the perfect onion dicing knife.
Those slides show that the solution won't work on actual onions. Call the innermost layer of the onion its "biological center", and call the center of the spheroid approximately occupied by the onion its "geometrical center".
As is beautifully illustrated on slide 50, the biological center is generally not particularly close to the geometrical center, and this introduces huge distortions in slices that cut close to the biological center.* A single layer of the onion can run parallel to the knife cut for quite some distance.
* The slides also observe that in reality, before chopping an onion, you cut off the top and bottom. This same phenomenon explains why you have to do that; a vertical cut through the top or bottom end of the onion would just give you one huge piece. (You also need to get rid of the roots on the bottom and the sprouts on the top, but even if you didn't, you'd have to cut off the top and the bottom because they curve the wrong way.)
As you point out, without a perfectly symmetrical onion of course this will not work very well. You would need to use a moving geometrical center point when slicing for best results.
Further, as noted elsewhere the outer layers are thicker in a real onion, so we need to reformulate to take this into account.
The other obvious simple improvement I can think of would be to use radial cuts in both directions. Each direction with the its own optimized floating center point of course. Reformulations would need to take this into account - although the end result would be quite close, and likely well within the margin of error for almost any human being aiming at an imagined floating center point below a cutting board :).
Haven’t had enough coffee to think about this rigorously.
My intuition says that as long as you could get to the desired 3D shape from revolving the 2D shape around an axis, essentially integrating the area into a volume, the results will be valid or equivalent.
I don’t think that’s the entire story, there are probably other ways to simplify 3D shapes. And yes, onions will have non constant variations (or ones that don’t cancel out to 0) along the sweep which is what actually invalidates the real world application.
If you model the (half) onion as a stack of these slices, it’s clear that the radius of each slice varies over the height of the onion; so the points below the onion found by this method towards which you need cut will form a curve, not a straight line. That is hard to accomplish with a straight knife that makes planar cuts.
Isn't that where calculus and intergrals come into to play? As the radius approaches infinity type of stuff?
Pretty much, and if you take smaller segments, you get a more accurate answer. Exactly the same as cutting an onion, if you cut it into quarters, then seperate layer by layer and chop each individually, you get a finer result.
I believe you are supposed to calculate R*0.55... once for the max onion radius and use the same cut on the smaller disks. That way the smaller disk is cut identically to the inner part of the larger disk.
The same cut (in terms of angle) on smaller disks would be impossible with a real knife. You'd have to bend the knife in order to achieve it.