예제 #1
0
        public Color Sample(double u, double v)
        {
            //clears the network for each sample
            network.ResetNetwork();

            //computes the distance from the origin
            double dist = (u * u) + (v * v);

            dist = Math.Sqrt(dist);

            //sets the input to the network
            Vector input = new Vector(u, v, dist, 1.0);

            network.SetInput(input);

            //propagates until the maximum depth
            for (int i = 0; i < DEPTH; i++)
            {
                network.Propergate();
            }

            //constructs the color from the output
            Vector output = network.ReadOutput();
            //double y = VMath.Sigmoid(output[0]);
            //double a = Math.Tanh(output[1]) * 0.5;
            //double b = Math.Tanh(output[2]) * 0.5;
            double y = (output[0] + 1.0) * 0.5;
            double a = output[1] * 0.5;
            double b = output[2] * 0.5;

            return(Color.FromYUV(y, a, b));
        }
예제 #2
0
        public Vector Evaluate(double a, double b, double ci)
        {
            //we must reset the network with each invocation
            network.ResetNetwork();

            //sets the input to the network
            Vector input = new Vector(a, b, ci, 1.0);

            network.SetInput(input);

            //propagates until the maximum depth
            for (int i = 0; i < DEPTH; i++)
            {
                network.Propergate();
            }

            //obtains the output from the network
            return(network.ReadOutput());
        }
예제 #3
0
        public double Evaluate(double x, double y)
        {
            //we must reset the network with each invocation
            network.ResetNetwork();

            //sets the input to the network
            Vector input = new Vector(x, y, 1.0);

            network.SetInput(input);

            //propagates until the maximum depth
            for (int i = 0; i < DEPTH; i++)
            {
                network.Propergate();
            }

            //obtains the output from the network
            Vector output = network.ReadOutput();

            return(output[0]);
        }