arcpoints: Calculation of point coordinates along an arc

View source: R/utils-spherical.R

arcpointsR Documentation

Calculation of point coordinates along an arc

Description

This function calculates points along an arc between two points and a circle center.

Usage

arcpoints(
  p1,
  p2,
  breaks = 2,
  origin = c(0, 0, 0),
  onlyNew = FALSE,
  output = "cartesian",
  radius = authRadius
)

Arguments

p1

(numeric) Vector, XYZ or longitude-latitude coordinates of the first point along the arc.

p2

(numeric) Vector, XYZ or longitude-latitude coordinates of the last point along the arc.

breaks

(integer) The number of points inserted between p1 and p2. Has to be positive.

origin

(numeric) vector, The center of the circle in XYZ coordinates (default is c(0,0,0)).

onlyNew

(logical) Should p1 and p2 be omitted from the result?

output

(character) The coordinate system of the output points. Can either be "polar" for longitude-latitude or "cartesian" for XYZ data.

radius

(numeric) Single value, the radius of the circle in case the input points have only polar coordinates. Unused when XYZ coordinates are entered. Defaults to the authalic radius of Earth ca. 6371.007km.

Details

The function always returns the smaller arc, with angle alpha < pi.

Value

Either an XYZ or a long-lat numeric matrix.

Examples

# empty plot
plot(NULL, NULL, xlim=c(-180, 180), ylim=c(-90,90))
# then endpoints of the arc
point1<-c(-45,-70)
point2<-c(130,65)
points(arcpoints(point1, point2, breaks=70, output="polar"))


adamkocsis/icosa documentation built on Aug. 20, 2024, 1:35 a.m.