Hi,

that is working, great news!

Thank you very much Dear A. Baddeley.

with my best regards,
Volkan Kepoglu

On Tue, Apr 20, 2010 at 6:07 AM, <Adrian.Baddeley@csiro.au> wrote:

> Sorry, that should of course have read delaunay(X) not dirichlet(X)
>
> A
>
> ________________________________________
> From: Baddeley, Adrian (CMIS, Floreat)
>
> Volkan Kepoglu wrote:
>
> > how can i convert the delaunay triangulation to spatial polygons?
>
> You can do this using the 'spatstat' package to construct the triangles
> (spatstat calls deldir to compute them) and the 'maptools' package to
> convert between spatstat and sp formats. See example below.
>
> Adrian Baddeley
> ---------------------------
>
> library(spatstat)
> library(maptools)
>
> x   <- c(2.3,3.0,7.0,1.0,3.0,8.0)
> y   <- c(2.3,3.0,2.0,5.0,8.0,9.0)
> df <- data.frame(x=x, y=y)
>
> # need a boundary window so do one of the following:
> W <- ripras(df, shape="rectangle")
> W <- owin(c(0, 10), c(0, 10))
>
> # create point pattern
> X <- as.ppp(df, W=W)
> plot(X)
>
> # compute Dirichlet triangles
> Y <- dirichlet(X)
> plot(Y)
>
> # convert
> Z <- as(Y, "SpatialPolygons")
>

	[[alternative HTML version deleted]]

