コード例 #1
0
ファイル: SegmentDisplay4.cs プロジェクト: XZelnar/MicroWorld
        public float GetBrightness(float x, float y)
        {
            Components.Logics.SegmentDisplay4Logics l = Logics as Components.Logics.SegmentDisplay4Logics;
            if (l.digits[0] == 0 && l.digits[1] == 0 && l.digits[2] == 0 && l.digits[3] == 0)
            {
                return(0f);
            }
            double v = 0f;

            for (int i = 0; i < W.Length; i++)
            {
                if (v < W[i].VoltageDropAbs)
                {
                    v = W[i].VoltageDropAbs;
                }
            }
            if (v > NeededVoltage)
            {
                v = NeededVoltage;
            }
            float dx = x - Graphics.Position.X + Graphics.Size.X / 2,
                  dy = y - Graphics.Position.Y + Graphics.Size.Y / 2;

            return((float)(Math.Sqrt(dx * dx + dy + dy) / 100 / (v / NeededVoltage)));
        }
コード例 #2
0
ファイル: SegmentDisplay4.cs プロジェクト: XZelnar/MicroWorld
        //============================================================LOGICS========================================================

        public override void Reset()
        {
            base.Reset();

            Components.Logics.SegmentDisplay4Logics l = Logics as Components.Logics.SegmentDisplay4Logics;
            l.digits[0] = 0;
            l.digits[1] = 0;
            l.digits[2] = 0;
            l.digits[3] = 0;
        }