Commit bef5de7
committed
Workaround for lack of symmetry in Math.sin.
Chrome 33 included some sin/cos optimisations, which unfortunately broke
our assumption that sin(-x) + sin(x) = 0 for all x. More details here:
https://code.google.com/p/v8/issues/detail?id=3006
This fix uses:
sin(x) = sgn(x) * sin(abs(x))
and:
cos(x) = cos(abs(x))
where it matters, which fixes area calculations for degenerate polygons
such as:
{"type":"Polygon",
"coordinates":[[[-0.0002,0.0001],[0.0002,0.0001],[-0.0002,0.0001]]]}
Fixes d3#1753.1 parent 04fa5dd commit bef5de7
4 files changed
Lines changed: 16 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2877 | 2877 | | |
2878 | 2878 | | |
2879 | 2879 | | |
2880 | | - | |
| 2880 | + | |
2881 | 2881 | | |
2882 | 2882 | | |
2883 | 2883 | | |
| |||
3339 | 3339 | | |
3340 | 3340 | | |
3341 | 3341 | | |
3342 | | - | |
3343 | | - | |
3344 | | - | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
3345 | 3345 | | |
3346 | 3346 | | |
3347 | 3347 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | | - | |
56 | | - | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | | - | |
| 38 | + | |
37 | 39 | | |
38 | | - | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
0 commit comments