| 1234567891011121314151617181920 |
- When asked to add a fillet/rounded corner between two flat faces in OpenSCAD:
- Build the shape as a single extruded 2D cross-section rather than unioning separate solids.
- To place a circular arc exactly tangent to two planar faces meeting at a known angle:
- 1. Express both face planes as line equations in the 2D cross-section plane.
- 2. Solve for the circle centre that sits at distance r from both lines simultaneously. For two faces meeting where one is y=0 and the other is some line az + by = c, this is a system of two distance equations.
- 3. The tangent point on each face is the foot of the perpendicular from the centre to that face — giving exact arc start/end angles via atan2.
- 4. The arc sweeps between those two angles using a for loop inside a concat()-built polygon.
- 5. Extrude the profile with linear_extrude, rotating as needed so extrusion goes in the correct world axis.
- For a specific common case — two panels of thickness t meeting at angle ang degrees, with the outer junction at the origin — the fillet centre is:
- - centre_y = r
- - centre_z = junction_z + r * (1 - 1/sin(ang/2 + 45)) (or derive directly from the two distance equations)
- The arc spans 180° down to 180° - ang° (for a junction where one face is vertical and the other tilts by ang).
- ---
- The core lesson: don't round a sharp boolean union — compute the exact tangent circle analytically and build it into the profile from the start.
|