directionCosines: Utility functions for spherical coordinate and projections.

Description Usage Arguments Details Value Author(s) Examples

View source: R/directionCosines.R

Description

Convert back and forth between lon/lat and direction cosines and also project spherical coordinates on a local tangent plane.

Usage

1
2
3

Arguments

x

A two column matrix of lon/lat coordinates in degrees.

x1

A vector of direction cosines defining the intersection of the tangent plane with the unit sphere

x2

A matrix of direction cosines that will be projected onto the plane defined by x2.

Grid

A three column matrix of direction cosines

Details

The conversion functions are based on straight forward definitions of spherical coordinates. The projection function is done by two rotations, first around the Z axis and then around the Y axis.

Value

directionCosines A three column matrix of direction cosines.

toSphere A two column matrix of longitudes and latitudes.

projectionSphere A two column matrix of Euclidean coordinates on the tangent plane to x1. The convention is that the origin (0,0) is mapped to x1 and the X- axis are points along the meridian through x1. The Y axis are points on the great circle passing through x1 and perpendicular to the meridian.

Author(s)

Doug Nychka

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# 
# icosahedron:
 phi = (1 + sqrt(5))/2
  V = matrix(c(0, 1, phi, 0, 1, -phi, 0, -1, phi, 0, -1, -phi, 
        1, phi, 0, -1, phi, 0, 1, -phi, 0, -1, -phi, 0, phi, 
        0, 1, -phi, 0, 1, phi, 0, -1, -phi, 0, -1), 12, 3, byrow = TRUE)

# check : library( rgl); plot3d( V, size=10, col="red4" )
# as lon lat:
V2<- toSphere( V)
plot( V2)

# lon lat grid
 lGrid<- make.surface.grid(  list(x= seq( -10,10,, 10), y= seq( -20,20,,10)) )
 
 dGrid<- directionCosines( lGrid)
 pairs( dGrid)
 # also try:   library( rgl); plot3d(  dGrid)
 

LatticeKrig documentation built on Nov. 9, 2019, 5:07 p.m.