File:Gosper curve 3.svg

From testwiki
Jump to navigation Jump to search
Original file (SVG file, nominally 320 × 320 pixels, file size: 24 KB)

This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

Summary

Description
English: Gosper curve of degree 4.
Date
Source Own work based on: Gosper curve 3.png by Arbol01
Author
Vector:
Other versions
A raster version of this image is available. It should be used in place of this vector image when superior.
File:Gosper curve 3.svgFile:Gosper curve 3.png

In general, it is better to use a good SVG version.


Bitmap image
SVG development
InfoField
 The SVG code is valid.
 This geometry was created with perl.

Source

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;
<svg xmlns="http://www.w3.org/2000/svg"
	width="640px" height="640px"
>
<polyline
	stroke="black"
	stroke-width="30"
	stroke-linejoin="round"
	fill-opacity="0"
	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

Public domain I, the copyright holder of this work, release this work into the public domain. This applies worldwide.
In some countries this may not be legally possible; if so:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

17 March 2007

File history

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

Date/TimeThumbnailDimensionsUserComment
current23:13, 22 March 2025Thumbnail for version as of 23:13, 22 March 2025320 × 320 (24 KB)wikimediacommons>Ilzolenderemoving terminal comma that interferes with rendering, adding white background, other changes

The following page uses this file: