コード例 #1
0
        public NoiseAccess(INoise source, enuDimUsage noiseDimUsage, bool withCaching = false)
        {
            if (withCaching)
            {
                source = new Cache <INoise>(source);
            }

            switch (noiseDimUsage)
            {
            case enuDimUsage.Noise2D:
                _noise2D = source as INoise2;
                break;

            case enuDimUsage.Noise3D:
                _noise3D = source as INoise3;
                break;

            case enuDimUsage.Noise4D:
                _noise4D = source as INoise4;
                break;

            default:
                break;
            }

            noiseDimUsage = _noiseDimUsage;
            _source       = source;
        }
コード例 #2
0
ファイル: NoiseAnalyse.cs プロジェクト: ErtyHackward/utopia
        public static string Analyse(INoise3 noiseFct, int iteration)
        {
            FastRandom rnd = new FastRandom();

            //Generate randomIteration number in array
            int[,] inputNumber = new int[iteration, 3];
            for (int i = 0; i < iteration; i++)
            {
                inputNumber[i, 0] = rnd.Next();
                inputNumber[i, 1] = rnd.Next();
                inputNumber[i, 2] = rnd.Next();
            }

            long   from = Stopwatch.GetTimestamp();
            double min  = double.MaxValue;
            double max  = double.MinValue;


            for (int i = 0; i < iteration; i++)
            {
                double val = noiseFct.Get(inputNumber[i, 0], inputNumber[i, 1], inputNumber[i, 2]);
                if (val < min)
                {
                    min = val;
                }
                if (val > max)
                {
                    max = val;
                }
            }

            long to = Stopwatch.GetTimestamp();

            return("INoise3 analysed for " + iteration + " iteration. Time needed : " + ((to - from) / (double)Stopwatch.Frequency * 1000.0) + " ms; Min : " + min + " max : " + max);
        }
コード例 #3
0
 public GameRender(Size startingWindowsSize, string WindowsCaption, INoise3 noise, double thresholdFrom, double thresholdTo, bool withBelow, Size ResolutionSize = default(Size))
     : base(startingWindowsSize, WindowsCaption, new SharpDX.DXGI.SampleDescription(1, 0), ResolutionSize)
 {
     _noise         = noise;
     _thresholdFrom = thresholdFrom;
     _thresholdTo   = thresholdTo;
     _withBelow     = withBelow;
 }