
Applies a vector shift to a line segment pattern.
# S3 method for psp
shift(X, vec=c(0,0), ..., origin=NULL)
Another line segment pattern (of class "psp"
) representing the
result of applying the vector shift.
Line Segment pattern (object of class "psp"
).
Vector of length 2 representing a translation.
Ignored
Location that will be shifted to the origin.
Either a numeric vector of length 2 giving the location,
or a point pattern containing only one point,
or a list with two entries named x
and y
,
or one of the character strings
"centroid"
, "midpoint"
,
"left"
, "right"
, "top"
, "bottom"
,
"topleft"
, "bottomleft"
, "topright"
or
"bottomright"
(partially matched).
Adrian Baddeley Adrian.Baddeley@curtin.edu.au
and Rolf Turner r.turner@auckland.ac.nz
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,
the argument vec
will be ignored; instead the shift will be performed
so that the specified geometric location is shifted to the
coordinate origin origin
should be either a numeric vector of length
2 giving the spatial coordinates of a location, or one of the character
strings "centroid"
, "midpoint"
,
"left"
, "right"
, "top"
, "bottom"
,
"topleft"
, "bottomleft"
, "topright"
or
"bottomright"
(partially matched).
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,
and so on.
shift
,
shift.owin
,
shift.ppp
,
periodify
,
rotate
,
affine
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")
Run the code above in your browser using DataLab