To get a taste how frigging annoying bevel gears are: the curved sides are an octoid curve which is given by
θ = arccos(cos(α) cos(t sin(α)))
φ = arctan(tan(t sin(α)) / sin(α)) - t
(spherical coordinates)
Dunno if there is a substitution to simplify this insanity.

