Ejemplo n.º 1
0
        public Angle(float value, AngleType angleType = AngleType.Degree)
        {
            switch (angleType)
            {
            case AngleType.Degree:
                _degrees = value < 0 ? value % 361 + 360 : value % 361;
                break;

            case AngleType.Gradian:
                value    = AngleHelper.GradianToDegree(value);
                _degrees = value < 0 ? value % 361 + 360 : value % 361;
                break;

            case AngleType.Radian:
                value    = AngleHelper.RadianToDegree(value);
                _degrees = value < 0 ? value % 361 + 360 : value % 361;
                break;

            case AngleType.Turn:
                value    = AngleHelper.TurnToDegree(value);
                _degrees = value < 0 ? value % 361 + 360 : value % 361;
                break;

            default:
                _degrees = 0f;
                break;
            }
        }
Ejemplo n.º 2
0
 public Angle(Vector2 vector)
 {
     _degrees = AngleHelper.RadianToDegree((float)Math.Atan2(-vector.Y, vector.X));
 }