using System;
using o0.Geometry2D.Float;

namespace ZIM
{
    public static partial class ZIMMath
    {
        // 向量与x轴的夹角，返回0-360度
        public static float DegreeToXAxis(this Vector v)
        {
            var a = v.x > 0 ? Math.Atan(v.y / v.x) * 180 / Math.PI : 180 + Math.Atan(v.y / v.x) * 180 / Math.PI;
            a = a < 0 ? 360 + a : a;
            return (float)a;
        }
    }
}
