Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rpsphere

Random point generation on the surface of a sphere


Description

This function will create a predefined number of points randomly distributed on the surface of a sphere with a given radius.

Usage

rpsphere(n = 1, output = "cartesian", radius = authRadius, origin = c(0, 0, 0))

Arguments

n

(numeric) The number of random points to be created.

output

(character) The coordinate system of the new points. Can either be "cartesian" for XYZ coordiates or "polar" for spherical, longitude-latitudes coordinates.

radius

(numeric) The radius of the sphere

origin

(numeric) The center of the sphere (XYZ coordinates).

Details

The function uses a three dimension normal distribution to generate points, which are then projected to the surface of the sphere.

Value

A 3-column (XYZ) or a 2-column (long-lat) numeric matrix.

Examples

randomPoints <- rpsphere(2000, output="polar")
# observe latitudinal pattern
 plot(randomPoints, xlim=c(-180, 180), ylim=c(-90, 90))

icosa

Global Triangular and Penta-Hexagonal Grids Based on Tessellated Icosahedra

v0.10.1
GPL-3
Authors
Adam T. Kocsis [aut, cre]
Initial release
2021-01-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.