[R] mutlidimensional in.convex.hull(wasmultidimensionalpoint.in.polygon??)

Keith Jewell k.jewell at campden.co.uk
Fri Dec 18 16:05:00 CET 2009


Syntax suggestions implemented.
Inhull's original author consulted.
Function submitted for potential inclusion in geometry package.

Seasons greetings to all.

Keith Jewell
---------------------------------
"baptiste auguie" <baptiste.auguie at googlemail.com> wrote in message 
news:de4e29f50912180238m45c4b7c3g792113d5b6c4c7ae at mail.gmail.com...
Hi,

Excellent, thanks for doing this!

I had tried the 2D case myself but I was put off by the fact that
Octave's convhulln had a different ordering of the points to R's
geometry package (an improvement to Octave's convhulln was made after
it was ported to R). I'm not sure how you got around this but it's
good to see that the result was worth the effort!

Below are a few minor syntax suggestions,

# p <- dim(calpts)[2]   # columns in calpts
# and other similar lines could be replaced with
ncol(calpts)
nrow(testpts)
nrow(hull)

# length(degenflag[degenflag])
# can probably be written
sum(degenflag)

# center = apply(calpts, 2, mean)
# more efficient
colMeans(calpts)

Would you consider submitting this function to the maintainer of the
geometry package, after checking it's OK with inhull's original
author?

Best regards,

baptiste




More information about the R-help mailing list