Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

endpoints.psp

Endpoints of Line Segment Pattern


Description

Extracts the endpoints of each line segment in a line segment pattern.

Usage

endpoints.psp(x, which="both")

Arguments

x

A line segment pattern (object of class "psp").

which

String specifying which endpoint or endpoints should be returned. See Details.

Details

This function extracts one endpoint, or both endpoints, from each of the line segments in x, and returns these points as a point pattern object.

The argument which determines which endpoint or endpoints of each line segment should be returned:

which="both"

(the default): both endpoints of each line segment are returned. The result is a point pattern with twice as many points as there are line segments in x.

which="first"

select the first endpoint of each line segment (returns the points with coordinates x$ends$x0, x$ends$y0).

which="second"

select the second endpoint of each line segment (returns the points with coordinates x$ends$x1, x$ends$y1).

which="left"

select the left-most endpoint (the endpoint with the smaller x coordinate) of each line segment.

which="right"

select the right-most endpoint (the endpoint with the greater x coordinate) of each line segment.

which="lower"

select the lower endpoint (the endpoint with the smaller y coordinate) of each line segment.

which="upper"

select the upper endpoint (the endpoint with the greater y coordinate) of each line segment.

The result is a point pattern. It also has an attribute "id" which is an integer vector identifying the segment which contributed each point.

Value

Point pattern (object of class "ppp").

Author(s)

and Rolf Turner r.turner@auckland.ac.nz

See Also

Examples

a <- psp(runif(10), runif(10), runif(10), runif(10), window=owin())
  plot(a)
  b <- endpoints.psp(a, "left")
  plot(b, add=TRUE)

spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.