Beispiel #1
0
    public float[,] SmoothGrid(float[,] grid)
    {
        int filterSize = filterRadius * 2 + 1;
        int width      = grid.GetLength(0);
        int height     = grid.GetLength(1);

        float[,] newGrid = new float[width, height];

        SmoothFilterGrid filterGrid = new SmoothFilterGrid(filterSize, width, height, smoothingCurve);

        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                filterGrid.ApplySmoothing(ref newGrid, x, y, grid[x, y]);
            }
        }

//		int gridPoints = (width * height);
//		int samplePoints = gridPoints * filterSize * filterSize;
//		Debug.Log("Smoothing " + gridPoints.ToString("E2") + " points (" + samplePoints.ToString("E2") + " samples) took " + (Time.realtimeSinceStartup - lastTime).ToString("E2") + " seconds");
        return(newGrid);
    }
	public float[,] SmoothGrid (float[,] grid)
	{
		int filterSize = filterRadius * 2 + 1;
		int width = grid.GetLength(0);
		int height = grid.GetLength(1);

		float[,] newGrid = new float[width, height];

		SmoothFilterGrid filterGrid = new SmoothFilterGrid (filterSize, width, height, smoothingCurve);

		for (int x = 0; x < width; x++)
		{
			for (int y = 0; y < height; y++)
			{
				filterGrid.ApplySmoothing(ref newGrid, x, y, grid[x,y]);
			}
		}

//		int gridPoints = (width * height);
//		int samplePoints = gridPoints * filterSize * filterSize;
//		Debug.Log("Smoothing " + gridPoints.ToString("E2") + " points (" + samplePoints.ToString("E2") + " samples) took " + (Time.realtimeSinceStartup - lastTime).ToString("E2") + " seconds");
		return newGrid;
	}