Angle Difference - CSharp System

CSharp examples for System:Math Number

Description

Angle Difference

Demo Code


using System.Text;
using System.Collections.Generic;
using System;/* w  w w . j  ava 2  s  .  c  om*/

public class Main{
        public static double AngleDiff(double angle1, double angle2)
        {
            double angleError = angle1 - angle2;
            if (angleError < -Math.PI) angleError += 2 * Math.PI;
            else if (angleError > Math.PI) angleError -= 2 * Math.PI;
            return angleError;
        }
}

Related Tutorials