I'm plotting gear curves, and I observe that for some parameter values ParametricPlot[]
does not plot all the teeth:
gearCurve[a_, b_, n_] := ParametricPlot[
{
(a + 1/b Tanh[b Sin[n t]]) Cos[t],
(a + 1/b Tanh[b Sin[n t]]) Sin[t]
},
{t, 0, 2 Pi},
Axes -> False];
gearCurve[10, 5, 38]
produces the following image:
What is going on?
Answer
Yaroslav Bulatov posted a great answer addressing this problem on StackOverflow.
Among several good illustrations the answer includes this undocumented option:
Method -> {Refinement -> {ControlValue -> (*radians*) }}
Alexey Popkov also gave an excellent analysis of the Plot algorithm.
His answer includes the apparently equivalent but cleaner (in degrees rather than radians as above):
Method-> {MaxBend -> (*degrees*) }
Example:
gearCurve[a_, b_, n_] :=
ParametricPlot[
{(a + 1/b Tanh[b Sin[n t]]) Cos[t],
(a + 1/b Tanh[b Sin[n t]]) Sin[t]},
{t, 0, 2 Pi},
Axes -> False,
Method-> {MaxBend -> 1}
];
gearCurve[10, 5, 38]
Comments
Post a Comment