/usr/share/genius/examples/sierpinski.gel is in genius-common 1.0.23-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # Category: Chaos
# Name: Draw Sierpinski's triangle using the chaos game
function dist(p1,p2) = sqrt((p1@(1)-p2@(1))^2+(p1@(2)-p2@(2))^2);
p = [0,0;1,0;0.5,sqrt(3)/2];
LinePlotDrawLegends = false;
LinePlotClear();
PlotWindowPresent(); # Make sure the window is raised
x=[0.5,0.5];
LinePlotWindow = [-0.1,1.1,-0.1,sqrt(3)/2+0.1];
points = null;
for n=1 to 10000 do (
j=randint(3)+1;
x = 0.5*x + 0.5*p@(j,);
points = [points;x];
# Draw every 100 iterations
if n%100 == 0 then (
# The Freeze and Thaw make the animation smoother, avoids flicker
PlotCanvasFreeze();
LinePlotClear();
LinePlotDrawPoints(points,"color","blue");
PlotCanvasThaw();
)
);
PlotCanvasFreeze();
LinePlotClear();
LinePlotDrawPoints(points,"color","blue");
PlotCanvasThaw();
|