Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const
- largeRadius = 200;
- smallRadius = 98;
- stepSize = 1;
- radiusDif = largeRadius - smallRadius;
- var
- step, maxStep: Integer;
- smallTheta, largeTheta, x, y: Extended;
- graph: array [-largeRadius..largeRadius] of array [-largeRadius..largeRadius] of Boolean;
- bit, a, b: Integer;
- function GetFactor(a, b: Integer): Integer;
- var
- f, l: Integer;
- begin
- Result := a * b;
- l := Trunc(Sqrt(Min(a, b)));
- f := 2;
- repeat
- if ((a mod f) = 0) then
- if ((b mod f) = 0) then
- begin
- a := a div f;
- b := b div f;
- Result := Result div f;
- Continue;
- end;
- f := f + 1;
- until (f > l);
- end;
- begin
- step := -stepSize;
- maxStep := Round(GetFactor(largeRadius, smallRadius) * 2 * Pi);
- repeat
- step := step + stepSize;
- largeTheta := (step / (largeRadius * 1.0));
- smallTheta := (step / (smallRadius * 1.0));
- x := (radiusDif * Cos(largeTheta)) + (smallRadius * Cos(smallTheta));
- y := (radiusDif * Sin(largeTheta)) + (smallRadius * Sin(smallTheta));
- graph[Round(y)][Round(x)] := True;
- //Writeln(FloatToStr(x) + ' ' + FloatToStr(y));
- until (step > maxStep);
- DisplayDebugImgWindow(largeRadius * 2 + 1, largeRadius * 2 + 1);
- bit := CreateBitmap(largeRadius * 2 + 1, largeRadius * 2 + 1);
- FastDrawClear(bit, clWhite);
- DrawBitmapDebugImg(bit);
- for a := -largeRadius to largeRadius do
- for b := -largeRadius to largeRadius do
- if (graph[a][b]) then
- FastSetPixel(bit, b + largeRadius, a + largeRadius, clRed);
- DrawBitmapDebugImg(bit);
- FreeBitmap(bit);
- end.
Add Comment
Please, Sign In to add comment