[R] inout() in splancs working properly?
Rainer Hurling
rhurlin at gwdg.de
Sat Jun 2 21:59:16 CEST 2001
I have a problem with function 'inout()' in package 'splancs' on CRAN-R
Version 1.2.3 under FreeBSD4.3-STABLE.
The following script produces and draws points and a polygon-surrounded
area. Repeating the same script many times shows, that points on the
polygon-line often, but not always, are outside of the polygon-area.
library(splancs)
# dataset with polygon (convex hull)
ds1 <- as.points(rnorm(10),rnorm(10))
ds1.poly <- ds1[chull(ds1),]
# plot area within convex hull
plot(ds1, type="n")
polymap(ds1.poly, border="lightblue", col="lightblue", lwd=1)
# Next dataset in and out of first one
ds2 <- as.points(rnorm(100),rnorm(100))
points(ds2[inout(ds2,ds1.poly),], col="green", pch=20)
points(ds2[!inout(ds2,ds1.poly),], col="orange", pch=20)
points(ds1[inout(ds1,ds1.poly),], col="black", pch=20)
points(ds1[!inout(ds1,ds1.poly),], col="red", pch=20)
If points lay on the polygon-line, inout() tells sometimes they are
inside (black points), sometimes outside (red points) of the surrounded
(here ligthblue) area.
Same with another dataset, testing against the given polygon. Points
inside are shown in green, outside in orange color. Some of the orange
points must be green points?
Is my understanding of function inout() correct? I am looking for a
function, that gives all points inside the area, including points laying
on the polygon-line, as 'TRUE' or 'inside'.
I had a look at your source code at 'splancs/src/ipippa.f', but had not
been able to resolve my problem here. (Perhaps variable 'iwind' is not
modified correctly at all situations?)
It would be very nice, if you could give me a hint what I'm doing wrong
and how to solve my problem.
Excuse me for my weaky english. Many thanks in advance.
Rainer Hurling
--
Rainer Hurling, Ass. d. Fd. email: rhurlin at gwdg.de
Institut fuer Forstzoologie und Waldschutz http://www.gwdg.de/~rhurlin
Georg-August Universitaet Goettingen office: 0551 39-2291
Buesgenweg 3, D-37077 Goettingen, GERMANY fax: 0551 39-2089
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list