예제 #1
0
        /// <summary>
        /// Initializes an instance of the <see cref="LinearRGB"/> structure.
        /// </summary>
        /// <param name="r"></param>
        /// <param name="g"></param>
        /// <param name="b"></param>
        /// <param name="workingSpace"></param>
        public LinearRGB(double r, double g, double b, WorkingSpace workingSpace = default(WorkingSpace))
        {
            if (!r.Within(Minimum[0], Maximum[0]))
            {
                throw new ArgumentOutOfRangeException(nameof(r));
            }

            if (!g.Within(Minimum[1], Maximum[1]))
            {
                throw new ArgumentOutOfRangeException(nameof(g));
            }

            if (!b.Within(Minimum[2], Maximum[2]))
            {
                throw new ArgumentOutOfRangeException(nameof(b));
            }

            _R = r;
            _G = g;
            _B = b;
            _workingSpace
                = workingSpace == default(WorkingSpace)
                ? WorkingSpaces.Default
                : workingSpace;
        }
예제 #2
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
         return;
     }
     instance = this;
 }
예제 #3
0
파일: RGB.cs 프로젝트: thrmotta/Imagin.NET
        static RGB Compand(Vector uncompandedVector, WorkingSpace workingSpace)
        {
            var    companding      = workingSpace.Companding;
            Vector compandedVector = new[]
            {
                companding.Companding(uncompandedVector[0]).Coerce(1),
                companding.Companding(uncompandedVector[1]).Coerce(1),
                companding.Companding(uncompandedVector[2]).Coerce(1)
            };

            return(new RGB(compandedVector, workingSpace));
        }
예제 #4
0
파일: RGB.cs 프로젝트: thrmotta/Imagin.NET
        /// <summary>
        /// Initializes an instance of the <see cref="RGB"/> structure.
        /// </summary>
        /// <param name="r"></param>
        /// <param name="g"></param>
        /// <param name="b"></param>
        /// <param name="workingSpace"></param>
        public RGB(double r, double g, double b, WorkingSpace workingSpace = default(WorkingSpace))
        {
            /*
             * if (!r.InRange(Minimum[0], Maximum[0]))
             *  throw new ArgumentOutOfRangeException(nameof(r));
             *
             * if (!g.InRange(Minimum[1], Maximum[1]))
             *  throw new ArgumentOutOfRangeException(nameof(g));
             *
             * if (!b.InRange(Minimum[2], Maximum[2]))
             *  throw new ArgumentOutOfRangeException(nameof(b));
             */

            _R = r;
            _G = g;
            _B = b;
            _workingSpace
                = workingSpace == default(WorkingSpace)
                ? WorkingSpaces.Default
                : workingSpace;
        }
예제 #5
0
        public void Draw(WorkingSpace workingSpace, PointF topLeft)
        {
            for (int i = 0; i < 8; ++i)
            {
                var slot = workingSpace.GetPalletSlot(i);
                if (slot.Pallet != null)
                {
                    Draw(slot.Pallet, topLeft.Add(slot.TopLeft));
                }
            }

            for (int i = 0; i < workingSpace.CartridgesSlotsCount; ++i)
            {
                var slot = workingSpace.GetCartridgeSlot(i);
                if (slot.Cartridge != null)
                {
                    Draw(slot.Cartridge, topLeft.Add(slot.TopLeft), slot.Size);
                }
            }

            Draw(workingSpace.Robot, topLeft, workingSpace.Pallets[0, 0].Size);
        }
예제 #6
0
        public void Init()
        {
            robot = new Robot()
            {
                CatchBlockTime = TimeSpan.FromSeconds(1),
                PutBlockTime   = TimeSpan.FromSeconds(2),
                MovementSpeed  = speed
            };

            workingSpace = new WorkingSpace(robot, palletSize, cartridgeSize, 5.0f);
            for (int i = 0; i < 8; ++i)
            {
                workingSpace.GetPalletSlot(i).Pallet = new Pallet(20, 20, blockSize, 0);
            }

            for (int i = 0; i < workingSpace.CartridgesSlotsCount; ++i)
            {
                workingSpace.GetCartridgeSlot(i).Cartridge = new ColorCartridge(i, 10);
            }

            workingSpace.GetCartridgeSlot(5).Cartridge  = null;
            workingSpace.GetCartridgeSlot(10).Cartridge = new ColorCartridge(-1, 0);
            workingSpace.GetCartridgeSlot(15).Cartridge = new ColorCartridge(0, 0);
        }
예제 #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="input"></param>
 /// <param name="workingSpace"></param>
 /// <returns></returns>
 public static RGB ToRGB(this Color input, WorkingSpace workingSpace = default(WorkingSpace))
 {
     return(new RGB(input.R.ToDouble() / 255, input.G.ToDouble() / 255.0, input.B.ToDouble() / 255.0, workingSpace));
 }
예제 #8
0
 public XYZConverter(WorkingSpace sourceWorkingSpace)
 {
     SourceWorkingSpace = sourceWorkingSpace;
     _conversionMatrix  = WorkingSpace.GetRGBToXYZ(SourceWorkingSpace);
 }
예제 #9
0
 public void Init()
 {
     workingSpace = new WorkingSpace(new Robot(), palletSize, cartridgeSize, palletesSeparation);
 }
예제 #10
0
파일: RGB.cs 프로젝트: thrmotta/Imagin.NET
 /// <summary>
 /// Initializes an instance of the <see cref="RGB"/> structure.
 /// </summary>
 /// <param name="input"></param>
 /// <param name="workingSpace"></param>
 public RGB(Vector input, WorkingSpace workingSpace = default(WorkingSpace)) : this(input[0], input[1], input[2], workingSpace)
 {
 }
예제 #11
0
 void Start()
 {
     item         = null;
     workingSpace = WorkingSpace.instance;
     isSelected   = false;
 }
예제 #12
0
 public LinearRGBConverter(WorkingSpace targetWorkingSpace)
 {
     TargetWorkingSpace = targetWorkingSpace == default(WorkingSpace) ? WorkingSpaces.Default : targetWorkingSpace;
     _conversionMatrix  = WorkingSpace.GetXYZToRGB(TargetWorkingSpace);
 }