Skip to content

Instantly share code, notes, and snippets.

@wactbprot
Created June 2, 2016 10:04
Show Gist options
  • Save wactbprot/60b81c2771ae11c8e3b94c149ae52659 to your computer and use it in GitHub Desktop.
Save wactbprot/60b81c2771ae11c8e3b94c149ae52659 to your computer and use it in GitHub Desktop.
extract positions
l <- readLines("svg.html")
l <- unlist( regmatches(l, gregexpr("d=\"M([0-9,]*)A", l)))
l <- gsub("[d=\\\"AM]", "", l)
l <- strsplit(l,",")
m <- lapply(l, function(e){
c(as.numeric(e[1]), as.numeric(e[2]))
})
M <- t(matrix(unlist(m), nrow = 2, ncol=length(l)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment