with text_io ; separate (Drei_D) procedure Berechne_SIRDS (SIRDS : in out SIRDS_RT) is Hintergrund_Abstand : constant positive := SIRDS.Bild'last (1) / 5 ; Identisches_Pixel : array (SIRDS.Bild'range (1)) of positive range SIRDS.Bild'range (1) ; Pixel_Abstand : positive range (Hintergrund_Abstand - Pixel_T'last).. (Hintergrund_Abstand + Pixel_T'last) ; Linkes_Pixel : integer ; Rechtes_Pixel : integer ; Pixel : positive range SIRDS.Bild'range (1) ; A : constant positive := 48_271 ; M : constant positive := 2_147_483_647 ; -- 2**31 - 1 Q : constant positive := M / A ; R : constant positive := M mod A ; Zufallsvariable : integer := 731_392_714 ; function Zufallszahl return Pixel_T is begin Zufallsvariable := A * (Zufallsvariable mod Q) - R * (Zufallsvariable / Q) ; if Zufallsvariable <= 0 then Zufallsvariable := Zufallsvariable + M ; end if ; return Pixel_T (long_float (Pixel_T'last) * long_float (Zufallsvariable) / long_float (M) ) ; end Zufallszahl ; begin text_io.put_line ("Berechnen von """ & SIRDS.Name.all & """: Start") ; for y in SIRDS.Bild'range (2) loop for x in SIRDS.Bild'range (1) loop Identisches_Pixel (x) := x ; end loop ; for x in reverse SIRDS.Bild'range (1) loop Pixel_Abstand := Hintergrund_Abstand - SIRDS.Bild (x, y) ; Linkes_Pixel := x - (Pixel_Abstand + (y mod 2)) / 2 ; Rechtes_Pixel := Linkes_Pixel + Pixel_Abstand ; if (1 <= Linkes_Pixel) and (Rechtes_Pixel <= SIRDS.Bild'last (1)) then loop Pixel := Identisches_Pixel (Rechtes_Pixel) ; exit when Pixel = Linkes_Pixel ; if Pixel < Linkes_Pixel then Identisches_Pixel (Rechtes_Pixel) := Linkes_Pixel ; Rechtes_Pixel := Linkes_Pixel ; Linkes_Pixel := Pixel ; else Rechtes_Pixel := Pixel ; end if ; Identisches_Pixel (Rechtes_Pixel) := Linkes_Pixel ; end loop ; end if ; end loop ; for x in SIRDS.Bild'range (1) loop if Identisches_Pixel (x) = x then SIRDS.Bild (x, y) := Zufallszahl ; else SIRDS.Bild (x, y) := SIRDS.Bild (Identisches_Pixel (x), y) ; end if ; end loop ; end loop ; text_io.put_line ("Berechnen von """ & SIRDS.Name.all & """: Ende") ; text_io.new_line ; end Berechne_SIRDS ;