File:Gosper curve 4.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file (SVG file, nominally 640 × 640 pixels, file size: 24 KB)

Captions

Captions

Gosper curve of degree 4.

Summary

[edit]
Description
English: Gosper curve of degree 4.
Date
Source Own work
Author Autopilot

Source

[edit]

The SVG file is produced by the following Perl script, which is based on the Logo implementation at Gosper-Kurve.

#!/bin/perl
use Math::Trig;
# SVG Gosper curve generator by Blotwell
# Released under GFDL

my $x=500, $y=2500, $a=90;
my $ln=100;

printf <<HEREDOC, $x,$y;
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
	width="640px" height="640px"
>
<polyline
	stroke="red"
	stroke-width="10"
	fill="none"
	transform="scale(0.1)"
	points="%i,%i
HEREDOC

rg(4);
print <<HEREDOC;
"/>
</svg>
HEREDOC

sub p {printf " %i,%i",$x,$y;}
sub fd {my $n=shift; $x+=$n*cos(deg2rad($a)); $y-=$n*sin(deg2rad($a)); p();}
sub tl {$a+=shift;}
sub rt {$a-=shift;}

sub gl {
	my $st=-1+shift;
	if ($st<0) {
		fd($ln);
		return
	}

	tl(60);  rg($st);
	rt(60);  gl($st); gl($st);
	rt(120); gl($st);
	rt(60);  rg($st);
	tl(120); rg($st);
	tl(60);  gl($st);
}

sub rg {
	my $st=-1+shift;
	if ($st<0) {
		fd($ln);
		return;
	}

	rg($st);
	rt(60);  gl($st);
	rt(120); gl($st);
	tl(60);  rg($st);
	tl(120); rg($st); rg($st);
	tl(60);  gl($st);
	rt(60);
}

Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current17:18, 30 September 2024Thumbnail for version as of 17:18, 30 September 2024640 × 640 (24 KB)Autopilot (talk | contribs)without background element
17:17, 30 September 2024Thumbnail for version as of 17:17, 30 September 2024640 × 640 (24 KB)Autopilot (talk | contribs)with svg version id
17:15, 30 September 2024Thumbnail for version as of 17:15, 30 September 2024640 × 640 (25 KB)Autopilot (talk | contribs)testing with an inkscape save plus an extra square
17:14, 30 September 2024Thumbnail for version as of 17:14, 30 September 2024640 × 640 (24 KB)Autopilot (talk | contribs)trying with a professional white background
16:49, 30 September 2024Thumbnail for version as of 16:49, 30 September 2024640 × 640 (24 KB)Autopilot (talk | contribs)thiner lines
16:47, 30 September 2024Thumbnail for version as of 16:47, 30 September 2024640 × 640 (24 KB)Autopilot (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

Metadata