File:Ледовый многоугольник.png
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Size of this preview: 649 × 600 pixels. Other resolutions: 260 × 240 pixels | 520 × 480 pixels | 737 × 681 pixels.
Original file (737 × 681 pixels, file size: 32 KB, MIME type: image/png)
File information
Structured data
Captions
Summary
[edit]DescriptionЛедовый многоугольник.png |
Русский: Ледовый многоугольник English: ice polygon |
Date | |
Source | Own work |
Author | Владислав Молдован |
pascal src code
[edit]uses GraphABC;
const
N = 4;
R = 300;
Inside = true;
K = 0.5;
procedure RLine(x, y, x1, y1: real):=Line(Round(x), Round(y), Round(x1), Round(y1));
procedure Draw(x, y, r, angle: real);
begin
var angle1 := DegToRad(angle);
var angle2 := DegToRad(angle - 90);
var x2 := x + r * Cos(angle1);
var y2 := y + r * Sin(angle1);
var mx := (x + x2) / 2;
var my := (y + y2) / 2;
var r2 := r / 2;
var r3 := r2 * K;
var cx := mx + r3 * Cos(angle2);
var cy := my + r3 * Sin(angle2);
RLine(x, y, x2, y2);
RLine(mx, my, cx, cy);
if r > 20 then
begin
Draw(x, y, r2, angle);
Draw(mx, my, r2, angle);
Draw(mx, my, r3, angle - 90);
Draw(cx, cy, r3, angle + 90);
end;
end;
function GetAngle(x, y, x2, y2: real): real;
begin
var angle := Abs(RadToDeg(ArcTan((y2 - y) / (x2 - x))));
if (x2 = x) and (y2 = y) then
Result := 0
else
if x2 > x then
if y2 > y then Result := angle else Result := 360 - angle
else
if y2 > y then Result := 180 - angle else Result := 180 + angle;
end;
procedure DrawIce(x, y, x1, y1: real):=Draw(x, y, sqrt(Sqr(x1 - x) + Sqr(y1 - y)), GetAngle(x, y, x1, y1));
begin
FloodFill(1, 1, clBlack);
SetPenColor(clCyan);
var Angle := 360 / N;
var W := Window.Width;
var H := Window.Height;
LockDrawing();
MaximizeWindow();
for var i := 0 to N - 1 do
begin
var ang1 := DegToRad(Angle * i);
var ang2 := DegToRad(Angle * (i + 1));
if not Inside then
DrawIce(W + R * Cos(ang1), H + R * Sin(ang1), W + R * Cos(ang2), H + R * Sin(ang2))
else
DrawIce(W + R * Cos(ang2), H + R * Sin(ang2), W + R * Cos(ang1), H + R * Sin(ang1));
end;
Redraw();
end.
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following license:
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.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 09:32, 1 September 2017 | 737 × 681 (32 KB) | Владислав Молдован (talk | contribs) | User created page with UploadWizard |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
File usage on other wikis
The following other wikis use this file:
- Usage on ru.wikibooks.org
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Horizontal resolution | 37.79 dpc |
---|---|
Vertical resolution | 37.79 dpc |