예제 #1
0
        public static Color FromHsv(double _hue, double _saturation, double _value)
        {
            double c = _value * _saturation;
            double h = Meth.RMod(_hue, 1) * 6;
            double x = c * (1 - Meth.Abs(h % 2 - 1));

            double r = 0, g = 0, b = 0;

            if (0 <= h && h < 1)
            {
                r = c;
                g = x;
            }
            else if (1 <= h && h < 2)
            {
                r = x;
                g = c;
            }
            else if (2 <= h && h < 3)
            {
                g = c;
                b = x;
            }
            else if (3 <= h && h < 4)
            {
                g = x;
                b = c;
            }
            else if (4 <= h && h < 5)
            {
                b = c;
                r = x;
            }
            else if (5 <= h && h < 6)
            {
                b = x;
                r = c;
            }

            double m = _value - c;

            return(new Color((byte)((r + m) * 255), (byte)((g + m) * 255), (byte)((b + m) * 255)));
        }
예제 #2
0
파일: Point.cs 프로젝트: TodesBrot/Mekanik
 public static Point operator %(Point _one, Point _two) => new Point(Meth.RMod(_one.X, _two.X), Meth.RMod(_one.Y, _two.Y));
예제 #3
0
파일: Vector.cs 프로젝트: TodesBrot/Mekanik
 public static Vector operator %(Vector _one, Vector _two) => new Vector(Meth.RMod(_one.X, _two.X), Meth.RMod(_one.Y, _two.Y));