pos_angle: Convert an angle to its equivalent value in the range 0 to...

View source: R/math_funcs.R

pos_angleR Documentation

Convert an angle to its equivalent value in the range 0 to 2*pi

Description

Given an angle in radians, shift it to a value between 0 and 2*pi.

Usage

pos_angle(x)

Arguments

x

Angle (IN RADIANS)

Details

This function was originally included in the code for the ULaval primary production model.

Value

Corresponding angle between 0 and 2*pi (IN RADIANS)

Examples

angle_rad <- -4.3*pi
pos_angle(angle_rad)

# starting with an angle in degrees: convert to radians, calculate positive angle, convert back
angle_deg <- -365
pos_angle(angle_deg*pi/180) * 180/pi

# multiple angles
pos_angle(c(-3, -2*pi, 4*pi, 0, 5*pi, pi/2))


BIO-RSG/oceancolouR documentation built on April 30, 2024, 7:54 a.m.