diff --git a/ImageStreams/main.cpp b/ImageStreams/main.cpp index cb0aafa..e9b5ac9 100644 --- a/ImageStreams/main.cpp +++ b/ImageStreams/main.cpp @@ -65,7 +65,7 @@ void automata(std::string filename){ std::vector r1(width, 0); std::vector r2(width, 0); - r1[width/2] = 1; + r1[width/3] = 1; ImageType image(width, height, filename); for(int y = 0; y < height; ++y){ @@ -78,6 +78,25 @@ void automata(std::string filename){ } } +inline double logistic_step(double in, double c){ + return c * in * (1.0 - in); +} + +template +void logistic(std::string filename) { + size_t size = 800; + double x = 0.5; + double start = 3.7; + double end = 4.0; + + ImageType image(size, size, filename); + for(int i = 0; i < size*size; ++i){ + double c = start + i * (end - start) / (size*size); + // I know; the order of evaluation is implementation defined + image << typename ImageType::pixel(x = logistic_step(x, c), x = logistic_step(x, c), x = logistic_step(x, c)); + } +} + int main(int argc, const char * argv[]){ xor_color("xor_color.png"); xor_color("xor_color.bmp"); @@ -90,5 +109,8 @@ int main(int argc, const char * argv[]){ automata("automata.png"); automata("automata.bmp"); + + logistic("logistic.png"); + logistic("logistic.bmp"); }