示例#1
0
        private float[,] GetInterpolatedData(Int2 position, int iterations)
        {
            var interpolator = new BicubicInterpolator(ServiceLocator.I.TerrainData.PickSeedData(Origin.X + position.X, Origin.Z + position.Z));
            var data         = new float[2 + iterations, 2 + iterations];

            for (int i = 0; i < 2 + iterations; i++)
            {
                for (int j = 0; j < 2 + iterations; j++)
                {
                    data[i, j] = interpolator.GetValue((float)i / (1 + iterations), (float)j / (1 + iterations));
                }
            }
            return(data);
        }
示例#2
0
    private float[,] InterpolateSeedData(float[,] seed, int iterations)
    {
        var interpolator = new BicubicInterpolator(seed);
        var data         = new float[2 + iterations, 2 + iterations];

        for (int i = 0; i < 2 + iterations; i++)
        {
            for (int j = 0; j < 2 + iterations; j++)
            {
                data[i, j] = interpolator.GetValue((float)i / (float)(1 + iterations), (float)j / (float)(1 + iterations));
            }
        }

        return(data);
    }
示例#3
0
        private TricubicInterpolator(double[] xs, double[] ys, double[] zs, double[][][] vs,
                                     double?dxLower = null, double?dxUpper = null,
                                     double?dyLower = null, double?dyUpper = null,
                                     double?dzLower = null, double?dzUpper = null)
        {
            this.xs      = xs;
            this.dxLower = dxLower;
            this.dxUpper = dxUpper;

            bicubicInterpolators = new BicubicInterpolator[xs.Length];

            for (int i = 0; i < xs.Length; ++i)
            {
                bicubicInterpolators[i] = new BicubicInterpolator(ys, zs, vs[i], dyLower, dyUpper, dzLower, dzUpper);
            }
        }
示例#4
0
    private float[,] GetInterpolatedData(Int2 position, int iterations)
    {
        //Todo fix "7" WTF?!
        var interpolator = new BicubicInterpolator(_meshBuilder.PickSeedData(_origin.X + position.X - 7, _origin.Z + position.Z));
        var data         = new float[2 + iterations, 2 + iterations];

        for (int i = 0; i < 2 + iterations; i++)
        {
            for (int j = 0; j < 2 + iterations; j++)
            {
                data[i, j] = interpolator.GetValue((float)i / (float)(1 + iterations), (float)j / (float)(1 + iterations));
            }
        }

        return(data);
    }