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

@ -1,81 +0,0 @@
with Ada.Numerics.Elementary_Functions;
with SDL.Video.Windows.Makers;
with SDL.Video.Renderers.Makers;
with SDL.Video.Rectangles;
with SDL.Events.Events;
procedure Fractal_Tree is
Width : constant := 600;
Height : constant := 600;
Level : constant := 13;
Length : constant := 130.0;
X_Start : constant := 475.0;
Y_Start : constant := 580.0;
A_Start : constant := -1.54;
Angle_1 : constant := 0.10;
Angle_2 : constant := 0.35;
C_1 : constant := 0.71;
C_2 : constant := 0.87;
Window : SDL.Video.Windows.Window;
Renderer : SDL.Video.Renderers.Renderer;
Event : SDL.Events.Events.Events;
procedure Draw_Tree (Level : in Natural;
Length : in Float;
Angle : in Float;
X, Y : in Float)
is
use SDL;
use Ada.Numerics.Elementary_Functions;
Pi : constant := Ada.Numerics.Pi;
X_2 : constant Float := X + Length * Cos (Angle, 2.0 * Pi);
Y_2 : constant Float := Y + Length * Sin (Angle, 2.0 * Pi);
Line : constant SDL.Video.Rectangles.Line_Segment
:= ((C.int (X), C.int (Y)), (C.int (X_2), C.int (Y_2)));
begin
if Level > 0 then
Renderer.Set_Draw_Colour (Colour => (0, 220, 0, 255));
Renderer.Draw (Line => Line);
Draw_Tree (Level - 1, C_1 * Length, Angle + Angle_1, X_2, Y_2);
Draw_Tree (Level - 1, C_2 * Length, Angle - Angle_2, X_2, Y_2);
end if;
end Draw_Tree;
procedure Wait is
use type SDL.Events.Event_Types;
begin
loop
while SDL.Events.Events.Poll (Event) loop
if Event.Common.Event_Type = SDL.Events.Quit then
return;
end if;
end loop;
delay 0.100;
end loop;
end Wait;
begin
if not SDL.Initialise (Flags => SDL.Enable_Screen) then
return;
end if;
SDL.Video.Windows.Makers.Create (Win => Window,
Title => "Fractal tree",
Position => SDL.Natural_Coordinates'(X => 10, Y => 10),
Size => SDL.Positive_Sizes'(Width, Height),
Flags => 0);
SDL.Video.Renderers.Makers.Create (Renderer, Window.Get_Surface);
Renderer.Set_Draw_Colour ((0, 0, 0, 255));
Renderer.Fill (Rectangle => (0, 0, Width, Height));
Draw_Tree (Level, Length, A_Start, X_Start, Y_Start);
Window.Update_Surface;
Wait;
Window.Finalize;
SDL.Finalise;
end Fractal_Tree;

View file

@ -30,4 +30,4 @@ svg: {
drawTree svg 0.5*width height trunkLength startingAngle
'svg ++ "</svg>"
write "fractal.svg" svg
svg >> "fractal.svg"

View file

@ -1,4 +1,4 @@
color 555
gcolor 555
proc tree x y angle depth .
glinewidth depth * 0.4
xn = x + cos angle * depth * 1.4 * (randomf + 0.5)

View file

@ -1,31 +0,0 @@
Red [Needs: 'View]
color: brown
width: 9
view/tight/options/flags/no-wait [ ; click image to grow tree
img: image 1097x617 draw [
pen brown line-width 9 line 500x600 500x500] [grow]
] [offset: 0x0] [no-border]
ends: reduce [500x500 pi * 3 / 2] ; list of terminal nodes
da: pi * 30 / 180 ; angle of branches in radians
ea: pi * 5 / 180 ; offset added to angle to break symmetry
l: 200 ; branches initial lenght
scale: 0.7 ; branches scale factor
grow: does [ ; grows branches
l: l * scale
color: 2 * color + leaf / 3
width: width - 1
newends: copy []
foreach [p a] ends [
a1: a + da - ea
p1: p + as-pair l * cos a1 l * sin a1
a2: a - da - ea
p2: p + as-pair l * cos a2 l * sin a2
append img/draw compose/deep [
pen (color) line-width (width) line (p1) (p) (p2)]
append newends reduce [p1 a1 p2 a2]
]
ends: newends
]