Globe Rotation Matrix

Share:

Description

Globe Rotation Matrix

Usage

1
gmat(vec, p, alpha)

Arguments

vec

vector axis to rotate about

p

translation point (c(0,0,0))

alpha

angle to rotate, degrees

Details

Given an arbitrary axis, return matrix for rotation about the axis by alpha degrees.

Value

4 by 4 Matrix for translation and rotation

Author(s)

Jonathan M. Lees<jonathan.lees@unc.edu>

References

Rogers and Adams

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
################   kamchatka

kamlat = c(48.5,  65)
kamlon = c(150, 171)

KAMLAT0=mean(kamlat)
KAMLON0=mean(kamlon)


################  korea

 KORlon = c(123,133)
    KORlat = c(33,44)


KORLON0=mean(KORlon)
KORLAT0=mean(KORlat)

# convert to cartesian
v1 = ll2xyz(KORLAT0, KORLON0 )
v2 = ll2xyz(KAMLAT0,  KAMLON0)

###   get cross product
g = X.prod((v1), (v2))

### use dot product to get angle
delta = (180/pi)*acos( sum(v1*v2)/(sqrt(sum(v1^2))*sqrt(sum(v2^2))))

###   get rotation matrix
R1 =gmat(g, c(0,0,0) , -delta)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.