R/MeanAzimuth.R

MeanAzimuth <- function (azimuths) 
{
    sin_ = AddSinVectors(azimuths)
    cos_ = AddCosVectors(azimuths)
    azimuth = atan(sin_/cos_)
    azimuth = ToSexagesimal(azimuth)
    if ((sin_ > 0) && (cos_ > 0)) {
        azimuth = azimuth
    }
    if ((sin_ > 0) && (cos_ < 0)) {
        azimuth = azimuth + 180
    }
    if ((sin_ < 0) && (cos_ > 0)) {
        azimuth = azimuth + 360
    }
    if ((sin_ < 0) && (cos_ < 0)) {
        azimuth = azimuth + 180
    }
    return(azimuth)
}

Try the VecStatGraphs2D package in your browser

Any scripts or data that you put into this service are public.

VecStatGraphs2D documentation built on May 2, 2019, 12:36 p.m.