Convert Line Segment Pattern to Linear Network
Converts a line segment pattern to a linear network.
## S3 method for class 'psp' as.linnet(X, ..., eps, sparse=FALSE)
X |
Line segment pattern (object of class |
... |
Ignored. |
eps |
Optional. Distance threshold. If two segment endpoints
are closer than |
sparse |
Logical value indicating whether to use a sparse matrix
representation, as explained in |
This command converts any collection of line segments into a linear
network by guessing the connectivity of the network,
using the distance threshold eps
.
If any segments in X
cross over each other, they are first
cut into pieces using selfcut.psp
.
Then any pair of segment endpoints lying closer than eps
units apart, is treated as a single vertex. The linear network
is then constructed using linnet
.
It would be wise to check the result by plotting the degree of each vertex, as shown in the Examples.
If X
has marks, then these are stored in
the resulting linear network Y <- as.linnet(X)
,
and can be extracted as marks(as.psp(Y))
or marks(Y$lines)
.
A linear network (object of class "linnet"
).
The result also has an attribute "camefrom"
indicating
the provenance of each line in the resulting network.
For example camefrom[3]=2
means that the third line segment
in the result is a piece of the second segment of X
.
Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.
# make some data A <- psp(0.09, 0.55, 0.79, 0.80, window=owin()) B <- superimpose(A, as.psp(simplenet)) # convert to a linear network L <- as.linnet(B) # check validity L plot(L) text(vertices(L), labels=vertexdegree(L)) # show the pieces that came from original segment number 1 S <- as.psp(L) (camefrom <- attr(L, "camefrom")) parts <- which(camefrom == 1) plot(S[parts], add=TRUE, col="green", lwd=2)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.