R: Apply Vector Translation To Line Segment Pattern

shift.psp {spatstat} | R Documentation

## Apply Vector Translation To Line Segment Pattern

### Description

Applies a vector shift to a line segment pattern.

### Usage

     ## S3 method for class 'psp'
    shift(X, vec=c(0,0), ..., origin=NULL)

### Arguments

`X` | Line Segment pattern (object of class `"psp"`).
`vec` | Vector of length 2 representing a translation.
`...` | Ignored
`origin` | Character string determining a location that will be shifted to the origin. Options are `"centroid"`, `"midpoint"` and `"bottomleft"`. Partially matched.

### Details

The line segment pattern, and its window, are translated by the vector `vec`.

This is a method for the generic function `shift`.

If `origin` is given, then it should be one of the character strings `"centroid"`, `"midpoint"` or `"bottomleft"`. The argument `vec` will be ignored; instead the shift will be performed so that the specified geometric location is shifted to the origin. If `origin="centroid"` then the centroid of the window will be shifted to the origin. If `origin="midpoint"` then the centre of the bounding rectangle of the window will be shifted to the origin. If `origin="bottomleft"` then the bottom left corner of the bounding rectangle of the window will be shifted to the origin.

### Value

Another line segment pattern (of class `"psp"`) representing the result of applying the vector shift.

### Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au

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

### See Also

`shift`, `shift.owin`, `shift.ppp`, `periodify`, `rotate`, `affine`

### Examples

      X <- psp(runif(10), runif(10), runif(10), runif(10), window=owin())
      plot(X, col="red")
      Y <- shift(X, c(0.05,0.05))
      plot(Y, add=TRUE, col="blue")

      shift(Y, origin="mid")

[Package spatstat version 1.54-0 Index]