Closed schloerke closed 4 years ago
Hmmmmm:
1.73/2 # hex.bin spec
#> [1] 0.865
2206/2557 # current recommendation
#> [1] 0.8627298
2214/2557
#> [1] 0.8658584
2206/2547
#> [1] 0.866117
Created on 2020-08-19 by the reprex package (v0.3.0)
I suspect this hasn't been a problem since the munging of the aspect ratio is so minor.
It's probably worth changing the recommendation, but if we do that I'd rather pick nicer numbers than 2206/2557 etc. Any thoughts?
These dimensions are close to integer values when scaled.
library(magrittr)
close_integers <- function(digits) {
(1:5000 * sqrt(3) / 2) %>%
round(digits = digits) %>%
as.character() %>%
grepl(".", ., fixed = TRUE) %>%
magrittr::not() %>%
which() %>%
setNames(., (. * sqrt(3) / 2) %>% round()) %>%
as.list() %>%
{tibble::tibble(d = as.numeric(names(.)), D = unlist(unname(.)))} %>%
print(n = Inf)
}
close_integers(2)
#> # A tibble: 50 x 2
#> d D
#> <dbl> <int>
#> 1 84 97
#> 2 181 209
#> 3 265 306
#> 4 362 418
#> 5 446 515
#> 6 543 627
#> 7 627 724
#> 8 724 836
#> 9 808 933
#> 10 905 1045
#> 11 989 1142
#> 12 1086 1254
#> 13 1170 1351
#> 14 1254 1448
#> 15 1267 1463
#> 16 1351 1560
#> 17 1435 1657
#> 18 1532 1769
#> 19 1616 1866
#> 20 1713 1978
#> 21 1797 2075
#> 22 1894 2187
#> 23 1978 2284
#> 24 2075 2396
#> 25 2159 2493
#> 26 2256 2605
#> 27 2340 2702
#> 28 2437 2814
#> 29 2521 2911
#> 30 2605 3008
#> 31 2702 3120
#> 32 2786 3217
#> 33 2883 3329
#> 34 2967 3426
#> 35 3064 3538
#> 36 3148 3635
#> 37 3245 3747
#> 38 3329 3844
#> 39 3426 3956
#> 40 3510 4053
#> 41 3607 4165
#> 42 3691 4262
#> 43 3775 4359
#> 44 3788 4374
#> 45 3872 4471
#> 46 3956 4568
#> 47 4053 4680
#> 48 4137 4777
#> 49 4234 4889
#> 50 4318 4986
close_integers(3)
#> # A tibble: 5 x 2
#> d D
#> <dbl> <int>
#> 1 1170 1351
#> 2 1351 1560
#> 3 2521 2911
#> 4 3691 4262
#> 5 3872 4471
close_integers(4)
#> # A tibble: 1 x 2
#> d D
#> <dbl> <int>
#> 1 2521 2911
Created on 2020-08-19 by the reprex package (v0.3.0)
@hadley While they are not "pretty" numbers, 2521 x 2911
is a perfect match for a hexagon.
2911 * sqrt(3) / 2
#> [1] 2521
Created on 2020-08-19 by the reprex package (v0.3.0)
There are also these pretty numbers:
close_integers(1) %>% dplyr::filter(as.character(d) %>% grepl("00$", .) | as.character(D) %>% grepl("00$", .))
#> # A tibble: 7 x 2
#> d D
#> <dbl> <int>
#> 1 433 500
#> 2 866 1000
#> 3 1299 1500
#> 4 1500 1732
#> 5 1700 1963
#> 6 3200 3695
#> 7 3400 3926
close_integers(1) %>% dplyr::filter(as.character(d) %>% grepl("0$", .) & as.character(D) %>% grepl("0$", .))
#> # A tibble: 4 x 2
#> d D
#> <dbl> <int>
#> 1 840 970
#> 2 1810 2090
#> 3 2650 3060
#> 4 3620 4180
2650 x 3060
isn't bad. I still put my vote in for 2521 x 2911
as it's an arbitrary number in the end, but requires no visual adjustments from the svg.
2521 x 2911 sounds good. Want to do a PR to contributing.md
?
And the pull request template?
@hadley Will do!
From https://en.wikipedia.org/wiki/Hexagon#Parameters
d
is the short diameterD
is the maximal diameterCreated on 2020-08-19 by the reprex package (v0.3.0)
This does not equal
2206px
.Reversing the formula
Created on 2020-08-19 by the reprex package (v0.3.0)
This does not equal
2557px
.I'd like to get the
plumber
hex added in https://github.com/rstudio/hex-stickers/pull/29 but want to be sure that I'm required to squish/stretch the image from a perfect hexagon.cc @allisonhorst