2020-09-09 10:27:49 +02:00
|
|
|
#include "Inkplate.h"
|
|
|
|
#include "SdFat.h"
|
2020-09-10 13:50:09 +02:00
|
|
|
|
2020-09-14 15:44:57 +02:00
|
|
|
const int n = 500;
|
2020-09-14 12:07:34 +02:00
|
|
|
|
2020-09-10 13:50:09 +02:00
|
|
|
Inkplate display(INKPLATE_1BIT);
|
2020-09-07 11:40:01 +02:00
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
|
2020-09-09 10:27:49 +02:00
|
|
|
display.begin();
|
|
|
|
|
|
|
|
display.joinAP("e-radionica.com", "croduino");
|
|
|
|
|
2020-09-14 12:07:34 +02:00
|
|
|
Serial.println("aaaa");
|
2020-09-09 10:27:49 +02:00
|
|
|
delay(500);
|
2020-09-07 11:40:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
2020-09-09 10:27:49 +02:00
|
|
|
display.clearDisplay();
|
2020-09-07 11:40:01 +02:00
|
|
|
|
2020-09-14 12:07:34 +02:00
|
|
|
// Code block for generating random points and sorting them in a counter
|
|
|
|
// clockwise direction.
|
|
|
|
int xt[n];
|
|
|
|
int yt[n];
|
|
|
|
|
|
|
|
for (int i = 0; i < n; ++i)
|
2020-09-09 14:18:37 +02:00
|
|
|
{
|
2020-09-14 12:07:34 +02:00
|
|
|
xt[i] = random(100, 700);
|
|
|
|
yt[i] = random(100, 500);
|
2020-09-07 11:40:01 +02:00
|
|
|
}
|
2020-09-14 12:07:34 +02:00
|
|
|
|
|
|
|
int k;
|
|
|
|
for (int i = 0; i < n - 1; ++i)
|
|
|
|
|
|
|
|
for (int j = i + 1; j < n; ++j)
|
|
|
|
if (atan2(yt[j] - 300, xt[j] - 400) < atan2(yt[i] - 300, xt[i] - 400))
|
|
|
|
{
|
|
|
|
k = xt[i], xt[i] = xt[j], xt[j] = k;
|
|
|
|
k = yt[i], yt[i] = yt[j], yt[j] = k;
|
|
|
|
}
|
|
|
|
|
|
|
|
display.clearDisplay();
|
|
|
|
display.drawPolygon(xt, yt, n, 1);
|
2020-09-09 10:27:49 +02:00
|
|
|
display.display();
|
2020-09-14 12:07:34 +02:00
|
|
|
delay(5000);
|
2020-09-07 11:40:01 +02:00
|
|
|
|
2020-09-14 12:07:34 +02:00
|
|
|
display.clearDisplay();
|
|
|
|
display.fillPolygon(xt, yt, n, 1);
|
|
|
|
display.display();
|
2020-09-07 11:40:01 +02:00
|
|
|
delay(5000);
|
|
|
|
}
|