rotations | R Documentation |
Generate the matrix for a specified rotation of the sphere
(rot.matrix
) and determine the locations of a set of points under
that rotation (rot.sphere
). Also, rotate a set of points through a specified angle about a specified axis
rot.matrix(northpole, rad=1) rot.sphere(points, northpole, rad = 1, inverse = FALSE) rot.sphere2(points, v, theta)
points |
The coordinates of points to be rotated. An object of class
|
northpole |
For |
rad |
Optional. For |
inverse |
Logical. For |
v |
For |
theta |
For |
It is sometimes necessary to find the locations of points on a sphere under a specified rotation; for example when one of the given points is rotated to the north pole. The benefit of this is that some spherical geometric and trigonometric functions can be more easily evaluated, which is useful in the context of spatial point process analysis.
The function rot.sphere
invokes rot.matrix
to define the
required rotation matrix; this rotation sends the point specified in
northpole
to the north pole (if inverse=FALSE
) along the
shortest great circle arc, or vice versa (if inverse=TRUE
).
However, this rotation may not be entirely suitable for all uses since
the longitude at colatitudes 0, pi
are arbitrary, and are
usually set to 0 for the purposes of calculations, including in the
standard matrix rotations that rot.matrix
generates matrices
for, and rot.sphere
performs. As such, the rotation that is
performed by rot.sphere
may not be the desired rotation:
e.g. for similar reasons to that described in the previous paragraph,
we may need to rotate the sphere such that a point x1 be rotated to
the north pole, and a second point x2 to a semicircle of longitude
phi0, however the rotation that sends x1 to
the north pole sends x2 to a different longitude,
phi1. This can be easily overcome by
first performing the rotation that sends x1 to the north pole, then
performing a second roation on the result, where
northpole=c(0, phi1-phi0) for phi1 > phi0,
or northpole
=c(0, 2π - (φ_{1}-φ_{0}) for phi1 < phi0.
More information about this rotation can be found in Section 3.2.2 of N. I. Fisher et al. (1993).
Under this second rotation (i.e. where the colatitude of the point given
in northpole
has colatitude 0), the axis of rotation passes
through the north and south poles as well as the origin, thus x1 is
invariant under the rotation. Note that a rotation where the colatitude
of the point given in northpole
is pi does not do the same, it
sends the south pole to the north pole along the semicircle of longitude
specified in northpole
. Thus for rotations under which the north
and south poles are invariant, ensure that the colatitude of the point
passed to northpole
is 0.
If the points are to be rotated in a clockwise direction through a known
angle about a known axis, then this can be done using rot.sphere2
,
which applies Rodrigues' rotation formula (see, e.g. Koks, 2006).
This can also be used if we know that the rotation will send a point x to a point y along
the shortest great circle path. In this case the axis of rotation, v is the
unit length vector in the direction of the cross product of x and y, and theta=pi.
The function rot.sphere2
can be used to rotate any point x to the north pole 0sph; simply let
theta to be the colatitude of x and v to be the unit length vector in the direction of the cross product of x and
0sph. To rotate a point to the south pole, set v as for rotation to the north pole, and set
theta to be pi + the colatitude of x.
To perform an inverse rotation using rot.sphere2
, set v to be as for the original rotation, and set
theta to be 2pi - the value of theta used in the original rotation.
For rot.sphere
, if points
is an object of class
sp2
or sp3
, then its radius will be used
rather than that specified in rad
.
The output of rot.matrix
is the matrix for the specified
rotation of the sphere; it has 3 columns and 3 rows.
The output of rot.sphere
is a 2 column matrix, giving the
locations of the points under the specified rotation, in spherical
coordinates.
The output of rot.sphere2
is in the same format as that which the argument codepoints is given in.
Tom Lawrence <email: tjlawrence@bigpond.com>
Fisher, N. I., Embleton, B. J. J. and Lewis, T. (1987) ‘Statistical Analysis of Spherical Data’, 1st paperback edition. Cambridge University Press.
Koks, D. (2006) ‘A Roundabout Route to Geometric Algebra’, in Explorations in Mathematical Physics, ch 4, pp. 144–157. Springer Science + Business Media LLC.
rot.matrix(northpole=c(pi/3, pi/3), rad=1) rot.sphere(points=c(pi/3, pi/3), northpole=c(pi/3,pi/3), rad=1, inverse=FALSE) rot.sphere(points=c(pi/3, pi/3), northpole=c(pi/3,pi/3), rad=1, inverse=TRUE) rot.sphere2(points=c(pi/3, pi/3), v=c(0,0), theta=pi)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.