Yeah, I know, still working on the Hirth? I’ve gotten to a really stable state of my code and I really, really like the result. I had a a version that worked really well using standard OpenSCAD type operations on geometry. It ran reasonably fast. Adrian Mariano mentioned that he had done it with VNFs. I’ve never worked with or understood VNFs (a BOSL2 thing) so I thought I should explore how they work. It took a while to understand vnf_vertex_array because I think the docs on it need a lot of improvement. I suspect Adrian's code does everything mine does, but I enjoyed the process of finding this myself.
It took a few hours but I got the basics down and managed to produce a VNF for a half tooth, and by joining, a full tooth. I used the same approach everyone seems to have adopted at first. I made shapes that are the cross sections of teeth, so these are triangles. This worked but were difficult to work with especially at low tooth counts. Any of you who have experimented with this problem are probably familiar with these so I won’t go into the details.
Making the rounded outer and inner radii often seemed to produce micro flaws where the tooth profile was intersected or differenced to make the final part. I started to look for a way to produce the teeth with he rounded inner and outer radius built in front he beginning. This led to the breakthrough. I began to construct the half tooth using shapes that lie along the radius of the part instead of being at right angles to the radius.
I found that teeth could be constructed from shapes that were all simple quadrilaterals. Two functions produced 2 different quadrilaterals, one for the tooth faces and one for the chamfered parts of the tooth. Each quadrilateral contained 2 points on the base of the part and 2 on the tooth surface. Each quad was rotated a little to produce the rounded inner and outer radii.
The resulting code is really stable, for example you can enter a cone angle of 89 degrees and n=2 teeth and get a perfectly reasonable looking part.
Maybe some of you find this obvious, but I was really pleased to have laid bare this symmetry and basic simplicity. Once I had the code working and fully refactored down, I spent quite an awhile just marveling at the ultimate simplicity of the results. Spending time fully understanding all that was happening in the code finally makes me feel like I fully understand the hirth joint. I intuitively knew it had to be simple at its core, but it was so hard to visualize. Anyway, bottom line is it was a really fun diversion and I’m really happy with where I got to.
A couple of notes on the code for anyone who wants to take a closer look. One function produces a half tooth, but there are 4 distinct half teeth, upper right, upper left, lower right and lower left. Two functions produce the quad paths (shapes) that form the teeth. To make the 4 versions of half tooth, the paths need to be reversed (or not) and need to be reflected through the y axis (or not, using yscale). Also I use $_lower (boolean) as a hidden variable. Best practice is probably to make this explicit, but I’m leaving it as is, at least for now.
The “mince” code determines how many profiles make up a half tooth. I think 4 would work as the minimum per half tooth, but the code sets the min at 5. The number has to be much larger for small numbers of teeth and larger outer radii.
Another interesting thing is that I ended up using 4 different coordinate systems, XYZ, Spherical, Cylindrical and a hybrid I called Sperical2. These made MANY operations way simpler to understand and visualize.
The hirth code is in hirth.7.scad. The guts are in _splineVNF() at the end. Hirth test.7.scad is a customizer setup for testing the library code. Adjust the include calls as necessary for your environment.