Accord.Statistics.Circular.ToCircular C# (CSharp) Method

ToCircular() public static method

Transforms angular data back into circular data (reverts the ToRadians(double[], double, bool) transformation.
public static ToCircular ( this angle, double length, bool wrap = true ) : double
angle this The angle to be reconverted into the original unit.
length double The maximum possible sample value (such as 24 for hour data).
wrap bool /// Whether range values should be wrapped to be contained in the circle. If /// set to false, range values could be returned outside the [+pi;-pi] range. ///
return double
        public static double ToCircular(this double angle, double length, bool wrap = true)
        {
            double m = ((angle + Math.PI) / (2 * Math.PI)) * length;

            if (wrap)
                m = Accord.Math.Tools.Mod(m, length);

            return m;
        }