surfacecentroid {icosa} | R Documentation |
Surface centroid point of a spherical point cloud
Description
This function the projected place of the centroid from a pointset on the sphere.
Usage
surfacecentroid(x, ...)
## S4 method for signature 'matrix'
surfacecentroid(x, output = "polar", center = c(0, 0, 0), radius = authRadius)
## S4 method for signature 'data.frame'
surfacecentroid(x, ...)
## S4 method for signature 'SpatialPoints'
surfacecentroid(x, ...)
Arguments
x |
( |
... |
Arguments passed to the |
output |
( |
center |
( |
radius |
( |
Details
The function implements great circle calculations to infer on the place of the centroid, which makes it resource demanding. This is necessary to avoid a particual error that frequently occurrs with other methods for centroid calculation, namely that the place of the centroid is right, but on the opposite hemisphere.
Value
Either an XYZ or a long-lat numeric
vector.
Examples
# generate some random points
allData <- rpsphere(1000)
# select only a subset
points<-allData[allData[,3]>1500,]
# transform to 2d
points2 <- CarToPol(points, norad=TRUE)
# the spherical centroid
sc <- surfacecentroid(points2, output="polar")
sc
#3d plot
plot(points2, xlim=c(-180, 180), ylim=c(-90, 90))
points(sc[1], sc[2], col="red", cex=5, pch=3)