Bestand:Sierpinski-Curve-2.png
Uit testwiki
Naar navigatie springen
Naar zoeken springen
Sierpinski-Curve-2.png (512 × 512 pixels, bestandsgrootte: 2 kB, MIME-type: image/png)
Dit bestand is afkomstig van Wikimedia Commons en kan ook in andere projecten gebruikt worden. De bestandsbeschrijvingspagina wordt hieronder weergegeven.
| BeschrijvingSierpinski-Curve-2.png |
English: Sierpinski Curves (fractals) of orders 1 and 2. Drawn by a Java program I did myself. |
| Datum | |
| Bron | Eigen werk |
| Auteur | User:Nol Aders |
Pseudocode
points = [] // Array dels punts
max_order = 8 // Nombre d'ordres a avaluar
// Punts inicials
points <- Point.new(0, -1, :top) // Amunt
points <- Point.new(1, 0, :right) // Dreta
points <- Point.new(0, 1, :bottom) // Avall
points <- Point.new(-1, 0, :left) // Esquerra
// Crear cada ordre a partir dels punts de l'anterior
for order in 1..max_order
// Els punts actuals ja no surten al nou ordre
current = points.clone
points.clear
// La distància depèn de l'ordre
d = sd = 0.5 / (2 ** (order - 1))
// Crear punt nou a partir de cada punt de l'ordre anterior
for point in corrent
px = point.x
py = point.y
case point.type
when :top // Amunt
points <- Point.new(px - d - sd, py - sd, :top)
points <- Point.new(px - d, py, :right)
points <- Point.new(px + d, py, :left)
points <- Point.new(px + d + sd, py - sd, :top)
when :right // Dreta
points <- Point.new(px + sd, py - d - sd, :right)
points <- Point.new(px, py - d, :bottom)
points <- Point.new(px, py + d, :top)
points <- Point.new(px + sd, py + d + sd, :right)
when :bottom // Avall
points <- Point.new(px + d + sd, py + sd, :bottom)
points <- Point.new(px + d, py, :left)
points <- Point.new(px - d, py, :right)
points <- Point.new(px - d - sd, py + sd, :bottom)
when :left // Esquerra
points <- Point.new(px - sd, py + d + sd, :left)
points <- Point.new(px, py + d, :top)
points <- Point.new(px, py - d, :bottom)
points <- Point.new(px - sd, py - d - sd, :left)
end
end
end
Pascal src code
uses GraphABC;
procedure RLine(x, y, x1, y1: real) := Line(Round(x), Round(y), Round(x1), Round(y1));
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 Draw(x, y, x1, y1: real; inverted: boolean);
begin
var angle := GetAngle(x, y, x1, y1);
var s := 1 - 2 * Ord(inverted);
var r := Sqrt(Sqr(x1 - x) + Sqr(y1 - y)) / 2;
var ang1 := DegToRad(angle - 60 * s);
var xA := x + r * Cos(ang1);
var yA := y + r * Sin(ang1);
var ang2 := DegToRad(angle - 120 * s);
var xB := x1 + r * Cos(ang2);
var yB := y1 + r * Sin(ang2);
if 2 * r < 8 then
begin
RLine(x, y, xA, yA);
RLine(xA, yA, xB, yB);
RLine(xB, yB, x1, y1);
end
else
begin
Draw(x, y, xA, yA, not inverted);
Draw(xA, yA, xB, yB, inverted);
Draw(xB, yB, x1, y1, not inverted);
end;
end;
begin
Draw(100, 100, 400, 450, false);
end.
Deze wiskundige afbeelding zou opnieuw moeten worden aangemaakt als een SVG-bestand door vectorafbeeldingen te gebruiken. Dit heeft een aantal voordelen; zie Commons:Media for cleanup voor meer informatie. Als er een SVG-formaat van deze afbeelding bestaat, dan deze graag uploaden. Nadat u dit heeft gedaan, gelieve dit sjabloon te vervangen door het sjabloon {{vector version available|nieuwe bestandsnaam.svg}} op deze afbeeldingspagina.
|
| Toestemming wordt verleend voor het kopiëren, verspreiden en/of wijzigen van dit document onder de voorwaarden van de GNU-licentie voor vrije documentatie, versie 1.2 of enige latere versie als gepubliceerd door de Free Software Foundation; zonder Invariant Sections, zonder Front-Cover Texts, en zonder Back-Cover Texts. Een kopie van de licentie is opgenomen in de sectie GNU-licentie voor vrije documentatie.http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
| Dit bestand is gelicenseerd onder de Creative Commons-licentie Naamsvermelding-Gelijk delen 3.0 Unported | ||
| ||
| Deze licentietag is toegevoegd aan dit bestand in verband met de GFDL licentie-update.http://creativecommons.org/licenses/by-sa/3.0/CC BY-SA 3.0Creative Commons Attribution-Share Alike 3.0truetrue |
Bijschriften
Beschrijf in één regel wat dit bestand voorstelt
Items getoond in dit bestand
beeldt af
juli 2005
image/png
Bestandsgeschiedenis
Klik op een datum/tijd om het bestand te zien zoals het destijds was.
| Datum/tijd | Miniatuur | Afmetingen | Gebruiker | Opmerking | |
|---|---|---|---|---|---|
| huidige versie | 9 jan 2007 16:39 | 512 × 512 (2 kB) | wikimediacommons>Dbc334 | cleared and compressed |
Bestandsgebruik
Dit bestand wordt op de volgende pagina gebruikt:
