codex/knife-clearance-wedge-geometry.py

knife-clearance-wedge-geometry.py
"""Original angle-definition diagram; Python 3.14.4, NumPy 2.3.5, Matplotlib 3.10.7.
Run in the mirrored media directory; writes knife-clearance-wedge-geometry.png to cwd.
Angles are illustrative geometry, not an instrument setting recommendation.
"""
from pathlib import Path
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.patches import Arc, Polygon

alpha, beta = 10.0, 35.0
assert 0 < alpha < alpha + beta < 90
fig, ax = plt.subplots(figsize=(8, 5), dpi=100, facecolor='white')
fig.subplots_adjust(left=.035, right=.985, top=.86, bottom=.12)
a, b = np.deg2rad([alpha, alpha + beta])
length = 4.6
ax.add_patch(Polygon([[0, 0], [length, length*np.tan(a)],
                     [length, length*np.tan(b)]], facecolor='#e3e8ef',
                    edgecolor='#34465e', linewidth=2))
ax.fill_between([-1, 5], [-1.0, -1.0], [0, 0], color='#f7eee0')
ax.plot([-1, 5], [0, 0], color='#a16d27', linewidth=2)
ax.text(3.25, -.35, 'Freshly cut surface', ha='center', color='#76511f', fontsize=12)
ax.text(3.5, 1.85, 'Knife material', ha='center', fontsize=13, color='#34465e')
ax.scatter([0], [0], color='black', s=26, zorder=5)
ax.annotate('Cutting edge', xy=(0, 0), xytext=(-.65, -.65),
            arrowprops={'arrowstyle': '->', 'color': '#333'}, fontsize=12)
ax.add_patch(Arc((0, 0), 4.3, 4.3, theta1=0, theta2=alpha,
                 color='#087f8c', linewidth=2.5))
ax.annotate(r'Clearance $\alpha=10^\circ$', xy=(2.13, .19), xytext=(2.4, -.82),
            fontsize=13, color='#087f8c',
            arrowprops={'arrowstyle': '->', 'color': '#087f8c', 'lw': 1.3})
ax.add_patch(Arc((0, 0), 2.7, 2.7, theta1=alpha, theta2=alpha+beta,
                 color='#ad3d72', linewidth=2.5))
ax.annotate(r'Wedge $\beta=35^\circ$', xy=(1.2, .64), xytext=(.1, 2.4),
            fontsize=13, color='#ad3d72',
            arrowprops={'arrowstyle': '->', 'color': '#ad3d72', 'lw': 1.3})
ax.text(4.65, .95, 'Flank', fontsize=11, color='#34465e', rotation=alpha,
        ha='right')
ax.text(2.9, 3.0, 'Other blade face', fontsize=11, color='#34465e',
        rotation=alpha+beta, ha='center')
ax.set(xlim=(-1.0, 5.1), ylim=(-1.05, 4.2), aspect='equal')
ax.axis('off')
fig.suptitle('Clearance is orientation; wedge is blade geometry', fontsize=15, y=.96)
fig.text(.5, .035, 'Ideal straight faces. Angles exaggerated for clarity; no cutting setting is prescribed.',
         ha='center', fontsize=10, color='#444')
fig.savefig(Path.cwd()/'knife-clearance-wedge-geometry.png', facecolor='white')
plt.close(fig)