Displaying 1 result from an estimated 1 matches for "leavesoutline".
2010 Jun 02
2
Faster union of polygons?
...quot;, "Y")))
# Lots of polygons:
releaf <- function(leaf)cbind(leaf[,1]+rnorm(1,0,50),leaf[,2]+rnorm(1,0,50))
leaves <- replicate(500, releaf(leaf), simplify=FALSE)
# Make into gpc.poly class:
leaves <- lapply(leaves, as, "gpc.poly")
# Make union .....
system.time({
leavesoutline <- union(leaves[[1]], leaves[[2]])
for(i in 3:length(leaves))leavesoutline <- union(leavesoutline, leaves[[i]])
})
# about 1sec here.
# Check it:
plot(leavesoutline)
thanks!
Remko
-------------------------------------------------
Remko Duursma
Research Lecturer
Centre for Plants and t...