Precompute constant in arc approximation function
#438 aberto em 29 de out. de 2020
Métricas do repositório
- Stars
- (56 estrelas)
- Métricas de merge de PR
- (Métricas PR pendentes)
Description
Discussed with @kwcantrell earlier today. In the following function:
It should be possible to rewrite the first line as
var numSamples = Math.floor(Math.abs(19.09859 * totalAngle));
... since the 60 / pi value will always be the same. This may save us some time, since in theory this function is called once for every internal node when doing the circular layout; Kalen brought up that if JS' interpreter is smart enough it may already be doing this behind the scenes, but at least this way we will make the code a bit clearer.
When we make this change, we should also add a comment explaining things / linking to this issue so the person reading the code knows where the 19.09859... figure came from.