File talk:Flag of New Zealand.svg
From Wikimedia Commons, the free media repository
[edit] Code used to generate stars for version of 5 August 2009 20:52
In R
(Public Domain by ButterStick)
f <- function(x) {(x/(2*sin(2*pi/5)))+(cos(2*pi/10)/(2*sin(2*pi/10)))};
a <- sin(pi/10)/sin(7*pi/10);
X <- matrix(0,10,6);
for(n in 0:4) X[2*n+1,1]<-(1/120)*(f(10)*cos((n*2*pi/5)-(pi/2))+60+(24*sin(2*pi*82/360))); for(n in 0:4) X[2*n+1,2]<-(1/120)*(f(10)*sin((n*2*pi/5)-(pi/2))-12-(24*cos(2*pi*82/360)));
for(n in 1:5) X[2*n,1]<-(1/120)*(a*f(10)*cos((((2*n)-1)*2*pi/10)-(pi/2))+60+(24*sin(2*pi*82/360))); for(n in 1:5) X[2*n,2]<-(1/120)*(a*f(10)*sin((((2*n)-1)*2*pi/10)-(pi/2))-12-(24*cos(2*pi*82/360)));
for(n in 0:4) X[2*n+1,3]<-(1/120)*(f(12)*cos((n*2*pi/5)-(pi/2))); for(n in 0:4) X[2*n+1,4]<-(1/120)*(f(12)*sin((n*2*pi/5)-(pi/2)));
for(n in 1:5) X[2*n,3]<-(1/120)*(a*f(12)*cos((((2*n)-1)*2*pi/10)-(pi/2))); for(n in 1:5) X[2*n,4]<-(1/120)*(a*f(12)*sin((((2*n)-1)*2*pi/10)-(pi/2)));
for(n in 0:4) X[2*n+1,5]<-(1/120)*(f(14)*cos((n*2*pi/5)-(pi/2))+60); for(n in 0:4) X[2*n+1,6]<-(1/120)*(f(14)*sin((n*2*pi/5)-(pi/2))+36);
for(n in 1:5) X[2*n,5]<-(1/120)*(a*f(14)*cos((((2*n)-1)*2*pi/10)-(pi/2))+60); for(n in 1:5) X[2*n,6]<-(1/120)*(a*f(14)*sin((((2*n)-1)*2*pi/10)-(pi/2))+36);
15*X;
f is the radius of the red star given horizontal length; g is the total radius including white border (note that the white border is a constant); a is the ratio of the inner radius to the red star's radius. The first two columns of X are the x and y coordinates of the radius-10 star; then the next two for the radius-12 star and the last for 14. "15" in "15*X" is the height of the image. I know that there are more elegant methods (both mathematically and in R) to do this; long story short I am lazy!
Taking the stars inside a circle makes thinking about moving the stars much easier! ButterStick (talk) 08:03, 5 August 2009 (UTC)
:Actually, thinking about it I did not account for the greater inner radius necessary due to SVG's methods with borders. I will get to it when I have more motivation... ButterStick (talk) 08:10, 5 August 2009 (UTC) Code corrected above. ButterStick (talk) 10:39, 5 August 2009 (UTC)