Example #1
0
        static public bool create(Dictionary <string, object> dict, List <Wave> waves)
        {
            if (MiniJsonHelper.getString(dict, "type", "") != "sinStraight")
            {
                return(false);
            }
            int num = MiniJsonHelper.getInt(dict, "num", 1);

            float[] degree      = MiniJsonHelper.getFloatArray(dict, "degree");
            float[] waveLength  = MiniJsonHelper.getFloatArray(dict, "waveLength");
            float[] amplitude   = MiniJsonHelper.getFloatArray(dict, "amplitude");
            float[] peakedPower = MiniJsonHelper.getFloatArray(dict, "peakedPower");
            float[] phase       = MiniJsonHelper.getFloatArray(dict, "phase");
            float[] sec         = MiniJsonHelper.getFloatArray(dict, "sec");

            // 生成
            var rand = new Random();

            for (int i = 0; i < num; ++i)
            {
                var wave = new SinStraightWave();
                wave.Degree      = frand(degree, rand);
                wave.WaveLength  = frand(waveLength, rand);
                wave.Amplitude   = frand(amplitude, rand);
                wave.PeakedPower = frand(peakedPower, rand);
                wave.PhaseSpeed  = frand(phase, rand);
                wave.setTime(frand(sec, rand));
                waves.Add(wave);
            }

            return(true);
        }
Example #2
0
 private void timeTxt_TextChanged(object sender, EventArgs e)
 {
     if (wave_ == null)
     {
         return;
     }
     wave_.setTime(StrConv.toFloat(timeTxt.Text, wave_.Time));
 }
Example #3
0
        // クローン作成
        override public Wave clone()
        {
            var obj = new SinStraightWave();

            obj.Degree      = Degree;
            obj.WaveLength  = WaveLength;
            obj.Amplitude   = Amplitude;
            obj.phaseSpeed_ = phaseSpeed_;
            obj.setTime(Time);
            obj.PeakedPower = PeakedPower;
            return(obj);
        }