From e46b68003db1df5aa69e9f3b0fe4b5113eeecff9 Mon Sep 17 00:00:00 2001 From: numzero Date: Thu, 8 Oct 2026 20:17:31 +0300 Subject: [PATCH] use a crown cutter it's not exactly correct for a bevel gear though --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 3051836..8885614 100644 --- a/src/main.rs +++ b/src/main.rs @@ -55,6 +55,8 @@ fn main() { let n_rack_teeth = 10; + let r_crown = 18.0; + let n_teeth = 36; let n_teeth_sample = n_teeth; let r_pitch = 0.5 * n_teeth as f32; @@ -95,7 +97,11 @@ fn main() { let gear_offset = t * TPS - (n_teeth_sample as f32 + 5.0); let rack_offset = (t * TPS).fract_gl(); - let rack_y_at_x = |x, profile| rack_shape(x - rack_offset * PI, profile); + let rack_y_at_x = |x, profile| { + let angle = f32::atan2(x, r_crown); + let vx = angle * r_crown; + rack_shape(vx - rack_offset * PI, profile) + }; let cutter_y_at_x = |x| rack_y_at_x(x, &cutter_profile); let kr_to_xy = |k, r: f32| {