-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support alphahull #92
Comments
More comprehensive: https://babichmorrowc.github.io/post/2019-03-18-alpha-hull/ |
I'm less sure about this. I've got |
Interesting! Yes the abitrary-ness is awful - I feel like if we had more accessibility it would be easier to tweak and hone (same old story!). |
Note also that there are cases in which results will be very dependent on |
You know about concaveman? https://github.com/mapbox/concaveman R wrapper: https://github.com/joelgombin/concaveman |
Oh but https://twitter.com/mourner/status/1035092508701847552 if that exists I can't find it |
Cool, thanks heaps, I hadn't seen concaveman at all, so will definitely incorporate that in my stuff. Also great to see that tweet, because I've also been thinking some kind of "Delaunator" approach is likely to be the only ultimately satisfactory way. |
Hey, the paper behind "concaveman" is really cool, and very trivial to implement. Shall we just implement our own C++/C version for general |
It is bad |
Oh, really? |
I mean that sexist name |
Okay, so I had a read through the |
For me it's about turning bespoke types into general form, so methods on the sc_ verbs that make PATH, SC, etc work on this format |
here's a re-spatializer example f <- "https://raw.githubusercontent.com/gdsbook/book/master/data/tokyo/tokyo_clean.csv"
library(dplyr)
tokyo <- readr::read_csv(f) |> dplyr::filter(user_id == "95795770@N00")
##|> mutate(unique_vert = as.integer(factor(paste(longitude, latitude, sep = "-"))))
## or
utokyo <- dplyr::distinct(tokyo, longitude, latitude)
a <- alphahull::ahull(utokyo$longitude, utokyo$latitude, .1)
#' @param xa a single row of ahull()$arcs
rc_data <- function (xa) {
# c, r, v, theta, ...
c <- xa[1, 1:2]
r <- xa[1, 3]
v <- xa[1, 4:5]
theta <- xa[1, 6]
angles <- alphahull:::anglesArc(v, theta)
seqang <- seq(angles[1], angles[2], length = 100)
x <- c[1] + r * cos(seqang)
y <- c[2] + r * sin(seqang)
cbind(x, y)
}
coords <- purrr::map_dfr(seq_len(nrow(a$arcs)), function(.x) tibble::as_tibble(rc_data(a$arcs[.x, , drop = FALSE])), .id = "arc")
plot(sfheaders::sfc_linestring(coords, x = "x", y = "y", linestring_id = "arc"))
|
Start with
The text was updated successfully, but these errors were encountered: