Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -4,35 +4,35 @@ import <Utilities/Conversion.sl>;
initPoints := [[0,0],[1,0]];
f1(point(1)) :=
let
matrix := [[cos(45 * (pi/180)), -sin(45 * (pi/180))],
[sin(45 * (pi/180)), cos(45 * (pi/180))]];
in
head(transpose((1/sqrt(2)) * matmul(matrix, transpose([point]))));
let
matrix := [[cos(45 * (pi/180)), -sin(45 * (pi/180))],
[sin(45 * (pi/180)), cos(45 * (pi/180))]];
in
head(transpose((1/sqrt(2)) * matmul(matrix, transpose([point]))));
f2(point(1)) :=
let
matrix := [[cos(135 * (pi/180)), -sin(135 * (pi/180))],
[sin(135 * (pi/180)), cos(135 * (pi/180))]];
in
head(transpose((1/sqrt(2)) * matmul(matrix, transpose([point])))) + initPoints[2];
let
matrix := [[cos(135 * (pi/180)), -sin(135 * (pi/180))],
[sin(135 * (pi/180)), cos(135 * (pi/180))]];
in
head(transpose((1/sqrt(2)) * matmul(matrix, transpose([point])))) + initPoints[2];
matmul(X(2),Y(2))[i,j] := sum(X[i,all]*Y[all,j]);
entry(steps(0), maxX(0), maxY(0)) :=
let
scaleX := maxX / 1.5;
scaleY := maxY;
shiftX := maxX / 3.0 / 1.5;
shiftY := maxY / 3.0;
in
round(run(steps, initPoints) * [scaleX, scaleY] + [shiftX, shiftY]);
let
scaleX := maxX / 1.5;
scaleY := maxY;
shiftX := maxX / 3.0 / 1.5;
shiftY := maxY / 3.0;
in
round(run(steps, initPoints) * [scaleX, scaleY] + [shiftX, shiftY]);
run(steps(0), result(2)) :=
let
next := f1(result) ++ f2(result);
in
result when steps <= 0
else
run(steps - 1, next);
let
next := f1(result) ++ f2(result);
in
result when steps <= 0
else
run(steps - 1, next);

View file

@ -9,66 +9,66 @@ using namespace std;
int main(int argc, char** argv)
{
int threads = 0;
if(argc > 1) threads = atoi(argv[1]);
Sequence< Sequence<int> > result;
int threads = 0;
if(argc > 1) threads = atoi(argv[1]);
Sequence< Sequence<int> > result;
sl_init(threads);
sl_init(threads);
int width = 500;
if(argc > 2) width = atoi(argv[2]);
int height = width;
if(argc > 3) height = atoi(argv[3]);
int width = 500;
if(argc > 2) width = atoi(argv[2]);
int height = width;
if(argc > 3) height = atoi(argv[3]);
CImg<unsigned char> visu(width, height, 1, 3, 0);
CImgDisplay draw_disp(visu);
CImg<unsigned char> visu(width, height, 1, 3, 0);
CImgDisplay draw_disp(visu);
SLTimer compTimer;
SLTimer drawTimer;
SLTimer compTimer;
SLTimer drawTimer;
int steps = 0;
int maxSteps = 18;
if(argc > 4) maxSteps = atoi(argv[4]);
int waitTime = 200;
if(argc > 5) waitTime = atoi(argv[5]);
bool adding = true;
while(!draw_disp.is_closed())
{
compTimer.start();
sl_entry(steps, width, height, threads, result);
compTimer.stop();
int steps = 0;
int maxSteps = 18;
if(argc > 4) maxSteps = atoi(argv[4]);
int waitTime = 200;
if(argc > 5) waitTime = atoi(argv[5]);
bool adding = true;
while(!draw_disp.is_closed())
{
compTimer.start();
sl_entry(steps, width, height, threads, result);
compTimer.stop();
drawTimer.start();
visu.fill(0);
drawTimer.start();
visu.fill(0);
double thirdSize = ((result.size() / 2.0) / 3.0);
thirdSize = (int)thirdSize == 0 ? 1 : thirdSize;
double thirdSize = ((result.size() / 2.0) / 3.0);
thirdSize = (int)thirdSize == 0 ? 1 : thirdSize;
for(int i = 1; i <= result.size(); i+=2)
{
unsigned char shade = (unsigned char)(255 * ((((i / 2) % (int)thirdSize) / thirdSize)) + 0.5);
for(int i = 1; i <= result.size(); i+=2)
{
unsigned char shade = (unsigned char)(255 * ((((i / 2) % (int)thirdSize) / thirdSize)) + 0.5);
unsigned char r = i / 2 <= thirdSize ? shade : 255/2;
unsigned char g = thirdSize < i / 2 && i / 2 <= thirdSize * 2 ? shade : 255/2;
unsigned char b = thirdSize * 2 < i / 2 && i / 2 <= thirdSize * 3 ? shade : 255/2;
const unsigned char color[] = {r,g,b};
unsigned char r = i / 2 <= thirdSize ? shade : 255/2;
unsigned char g = thirdSize < i / 2 && i / 2 <= thirdSize * 2 ? shade : 255/2;
unsigned char b = thirdSize * 2 < i / 2 && i / 2 <= thirdSize * 3 ? shade : 255/2;
const unsigned char color[] = {r,g,b};
visu.draw_line(result[i][1], result[i][2], 0, result[i + 1][1], result[i + 1][2], 0, color);
}
visu.display(draw_disp);
drawTimer.stop();
visu.draw_line(result[i][1], result[i][2], 0, result[i + 1][1], result[i + 1][2], 0, color);
}
visu.display(draw_disp);
drawTimer.stop();
draw_disp.set_title("Dragon Curve in SequenceL: %d Threads | Steps: %d | CompTime: %f Seconds | Draw Time: %f Seconds", threads, steps, drawTimer.getTime(), compTimer.getTime());
draw_disp.set_title("Dragon Curve in SequenceL: %d Threads | Steps: %d | CompTime: %f Seconds | Draw Time: %f Seconds", threads, steps, drawTimer.getTime(), compTimer.getTime());
if(adding) steps++;
else steps--;
if(adding) steps++;
else steps--;
if(steps <= 0) adding = true;
else if(steps >= maxSteps) adding = false;
if(steps <= 0) adding = true;
else if(steps >= maxSteps) adding = false;
draw_disp.wait(waitTime);
}
draw_disp.wait(waitTime);
}
sl_done();
return 0;
sl_done();
return 0;
}