File:Спиральные квадраты.png

Summary

Description
Русский: Спиральные квадраты
English: Spiral squares
Polski: Spiralne kwadraty
Date
Source Own work
Author Владислав Молдован

Pascal source code

// https://ru.wikibooks.org/wiki/Книга программиста/Книга фракталов
uses GraphABC;
const
  Min = 1;
  DeltaAng = Pi / 20;
  CX = 320;
  CY = 240;

var
  R: real;
  A: real;

procedure Draw(r, angle: real);
begin
  var ang1 := angle + Pi / 4;
  var x1 := Round(CX + r * Cos(ang1));
  var y1 := Round(CY + r * Sin(ang1));
  
  var ang2 := angle + 3 / 4 * Pi;
  var x2 := Round(CX + r * Cos(ang2));
  var y2 := Round(CY + r * Sin(ang2));
  
  var ang3 := angle + 5 / 4 * Pi;
  var x3 := Round(CX + r * Cos(ang3));
  var y3 := Round(CY + r * Sin(ang3));
  
  var ang4 := angle + 7 / 4 * Pi;
  var x4 := Round(CX + r * Cos(ang4));
  var y4 := Round(CY + r * Sin(ang4));
  
  Line(x1, y1, x2, y2);
  Line(x2, y2, x3, y3);
  Line(x3, y3, x4, y4);
  Line(x4, y4, x1, y1);
end;

begin
  R := 320;
  A := 0;
  
  LockDrawing();
  repeat
    Draw(R, A);
    A := A + DeltaAng;
    R := R * Sin(Pi / 4) / Sin(3 * Pi / 4 - DeltaAng);
  until R <= Min;
  Redraw();
end.

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-4.0#Спиральные%20квадраты.pngCategory:Self-published work
Category:Groups of rectangles Category:Turtle graphics Category:Spiral diagrams Category:Images with Pascal source code
Category:CC-BY-SA-4.0 Category:Groups of rectangles Category:Images with Pascal source code Category:Self-published work Category:Spiral diagrams Category:Turtle graphics