Разное о выращивании табака на Алтае
Вы не вошли.
Страницы 1
#include <stdio.h>
#include "fabgl.h"
fabgl::VGAController DisplayController;
fabgl::Canvas canvas(&DisplayController);
int width = 900;
int height = 450;
int R=10;
int G=10;
int B=10;
int RGB1=100;
void setup()
{Serial.begin(115200);
DisplayController.begin();
DisplayController.setResolution(VGA_640x480_60Hz) ;
canvas.setGlyphOptions(GlyphOptions().FillBackground(false).DoubleWidth(1));
canvas.selectFont(&fabgl::FONT_std_24);
canvas.setPenColor(Color::Red);}
int changed;
double scale = 1./128;
double cx = -.6, cy = 0;
void mandel(int skip) {
int iter, max_iter = 256;
double x, y, zx, zy, zx2, zy2;
for (int i = 0; i < height; i += skip) {
y = (i - height/2) * scale + cy;
for (int j = 0; j < width; j += skip) {
x = (j - width/2) * scale + cx;
zx = hypot(x - (double).25, y);
if (x < zx - 2 * zx * zx + (double).25) continue;
if ((x + 1)*(x + 1) + y * y < 1/16) continue;
zx = zy = zx2 = zy2 = 0;
for (iter = 0; iter < max_iter && zx2 + zy2 < 4; iter++) {
zy = 2 * zx * zy + y;
zx = zx2 - zy2 + x;
zx2 = zx * zx;
zy2 = zy * zy;
}
if (iter < max_iter) {
canvas.setPixel(j-150,i-50,RGB888(R,G+iter*RGB1,B));
if (skip < 2) { int16_t tx, ty;
}
}
}
}
}
void loop()
{ static int resolution=1;
if (resolution) mandel(resolution--);
Serial.println(resolution);
if (resolution==0) {
resolution=1;
width = random(2000);
height = random(1000);
Serial.println(width);
Serial.println(height);
R=random(255);
G=random(255);
B=random(255);
RGB1=random(255);
canvas.clear(); }
}
Не в сети
Не в сети
Не в сети
Страницы 1