Esempio n. 1
0
        public AngleQuadrantInfo(double angle, double pre)
        {
            this._rotate = ChartHelper.DoubleHasValue(angle);
            if (!this._rotate)
            {
                return;
            }

            //将角度转换为-360到360度之间
            angle = angle % MathEx.ANGLE_360;
            if (angle < ChartConstant.ZERO_D)
            {
                //将负数角度转换为正数角度
                angle += MathEx.ANGLE_360;
            }
            this._angle = angle;


            //角度值无效或小于精度值,则认为不需要旋转
            if (angle <= pre)
            {
                this._rotate = false;
                return;
            }

            double   mathAngle;
            Quadrant quadrant;

            if (angle - MathEx.ANGLE_270 > ChartConstant.ZERO_D)
            {
                //angle:270-360°
                quadrant         = Quadrant.One;
                mathAngle        = angle - MathEx.ANGLE_270;
                this._modRadians = MathEx.AngleToRadians(MathEx.ANGLE_180 - MathEx.ANGLE_90 - mathAngle);
            }
            else if (angle - MathEx.ANGLE_180 > ChartConstant.ZERO_D)
            {
                //angle:180-270°
                quadrant         = Quadrant.Two;
                mathAngle        = angle - MathEx.ANGLE_180;
                this._modRadians = MathEx.AngleToRadians(MathEx.ANGLE_360 - MathEx.ANGLE_90 - angle);
            }
            else if (angle - MathEx.ANGLE_90 > ChartConstant.ZERO_D)
            {
                //angle:90-180°
                quadrant         = Quadrant.Three;
                mathAngle        = angle - MathEx.ANGLE_90;
                this._modRadians = MathEx.AngleToRadians(MathEx.ANGLE_270 - MathEx.ANGLE_90 - angle);
            }
            else
            {
                //angle:0-90°
                quadrant  = Quadrant.Four;
                mathAngle = angle;
            }

            this._radians  = MathEx.AngleToRadians(mathAngle);
            this._quadrant = quadrant;
        }