⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 angle.java

📁 一个飞机调度员模拟训练程序,可以添加跑道数量,控制飞机飞行的速度.默认的密码可以在AtcSystem类里面修改,其中内置了三个用户名.这套系统是我和几个国外同学合力开发的,希望对大家有帮助
💻 JAVA
字号:

/**
 * A class providing a number of functions for calculating with angles.
 * 
 * @author James M. Clarke
 * @version 03/02/2007
 */
public abstract class Angle
{
        /**
         * Finds the angle clockwise between two angles
         * 
         * @param   angle1 the starting angle
         * @param   angle2 the finishing angle
         * @return     the angle clockwise between the two angles, measured in radians
        */ 
        public static float diffClockwise(float angle1, float angle2)
        {
            //Find the angle (clockwise) between two angles
            angle1 = normal(angle1);
            angle2 = normal(angle2);
            if (angle1 < angle2) {  return angle2-angle1; }
            else {  return (float) (2*Math.PI)-(angle1-angle2); }
        }
        
        /**
         * Finds the angle anticlockwise between two angles
         * 
         * @param   angle1 the starting angle
         * @param   angle2 the finishing angle
         * @return     the angle anticlockwise between the two angles, measured in radians
        */ 
        public static float diffAnticlockwise(float angle1, float angle2)
        {
            //Find the angle (clockwise) between two angles
            angle1 = normal(angle1);
            angle2 = normal(angle2);
            if (angle1 < angle2) { return (float) (2*Math.PI)-(angle2-angle1);  }
            else { return angle1-angle2; }
        }    

        /**
         * Converts an angle to an angle in the same direction that is between 0 and 2PI radians.
         * 
         * @param   angle the angle to be converted
         * @return  the equivalent angle between 0 and 2PI radians
        */        
        public static float normal(float angle)
        {            
            //Make sure that the angle is between 0 and 2*PI
            if ( angle > (2 * ((float) Math.PI))) { angle = angle - (2 * ((float) Math.PI)); angle = normal(angle);}
            if ( angle < (0F * ((float) Math.PI))) { angle = angle + (2 * ((float) Math.PI)); angle = normal(angle);}
            return angle;
        }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -