Accord.Imaging.Textures.MarbleTexture.Generate C# (CSharp) Method

Generate() public method

Generate texture.
Generates new texture of the specified size.
public Generate ( int width, int height ) : ].float[
width int Texture's width.
height int Texture's height.
return ].float[
        public float[,] Generate(int width, int height)
        {
            float[,] texture = new float[height, width];
            double xFact = xPeriod / width;
            double yFact = yPeriod / height;

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    texture[y, x] =
                        Math.Min(1.0f, (float)
                            Math.Abs(Math.Sin(
                                (x * xFact + y * yFact + noise.Function2D(x + r, y + r)) * Math.PI
                            ))
                        );

                }
            }
            return texture;
        }