File talk:Flag of New Zealand.svg

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

Code used to generate stars for version of 5 August 2009 20:52[edit]

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)[reply]

: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)[reply]

geometrics of the New-Zealand stars[edit]

1) For reference of construction I use [1] or [2] and [3].

2) All 4 stars in the flag of New Zealand are constructed in the same way and their (red) sizes are defined by their (maximal) x-diameter and the thickness of their white border which is relative to the flags height 1/120 for all stars.

3) The stars are all mathematical 5-stars, i.e. made up by (regular) pentagrams (rotational symmetric under 1/5-th rotation) and one top must point upwards (parallel to the hoist, left flag edge).

4) If we draw one (a unit) star/pentagram we will have later scale this up, because we need 3 different sizes (10/120 12/120 14/120) for the 4 needed stars.

5) Consider e.g only the smallest star, the outer right most one. It's width should be 1/24 of the flags width or 1/12 of its height (which is the same), but this line of "defining width" (it defines the size of the red star) is not a line crossing the star's center! THIS IS VERY IMPORTANT (and decisive).

6) If we translate the star, that the coordinate origin is no more in its center, a further scaling will destroy its 5-fold rotation symmetry – thus the old construction was wrong in principle! The scaling must happen with the center of the star in the coordinate origin!

7) Because the defining width (of the star) is not a radial line (a line crossing the coordinate origin), its length will NOT be scaled with the scaling factor, only be proportional to it! E.g. consider a square with its center in the coordinate origin, but its 4 corners pointing to east, west, north south (in diagonal directions!). Now scaling up the square by a factor of will increase it's border-line thickness not by , but only by ! Similar we must notice that the correct angle for the defining width is halve of it's top-angle, thus a scaling by of the star will increase its border-thickness (measured orthogonal to the defining star-width) only by . And therefore the correct factor for getting an additional border-thickness of 1 is , a special (well-known)irrational number, namely .

8) Practical conclusion: If the flag's height is 120 (like in the reference), the smallest star has "red-diameter" 10, its "white-diameter" must be – the factor 2 is due to the fact that we need border thickness on opposite (two) sides – to give the red star a white border of thickness 1. Achim1999 (talk) 11:37, 5 June 2012 (UTC)[reply]

I based my version on the official Ministry of Culture and Heritage specification (as suggested in our image description), but your references give essentially the same dimensions (modulo a factor of two), so it shouldn't matter that you used them.
I'm sure you know more about SVG than me, but even I can look at your file in Inkscape (or some other SVG editor), and see that your borders are too big. At your default resolution, they should be 4 pixels in width, but they are actually about 4.2 pixels across. I don't claim mine are exactly right, but they come much closer than yours. My ones (again at their default resolution) should be 5 pixels across, and they seem slightly larger than this at 256x magnification, but are clearly less than 5.01 pixels across.
I don't follow your argument about the construction of the stars. What do you think will be wrong with the ones Hugh Jass's code produces? Based on a few measurements, the resulting stars seem fine to me. --Avenue (talk) 14:33, 5 June 2012 (UTC)[reply]
0) Thank you for not starting a revision war -- but first solve this issue objectively.
1) Well, as you agree that my given references are effectively the same as yours, this is fine and we can focus on / use it in agreement. (Your given reference is the same as my second, only all distances halved)
2) I did neither measurements nor guess/estimate distances/sizes but do use the given unique (writen down) construction rules and make logical conclusions leading to an effective (and used by me) flag coding.
3) This is not a question of SVG (coding) but of pure mathematics -- thus if your svg-editor is wrong, or your physically screen scaling is not 100% the same in x-direction and y-direction you are already lost!
4) You should try to understand my reasoning/conclusions! Your reasoning is an experimental / empirical one, which should not be trusted. ;)
5) From my previous (didacticaly writen to my best) reasoning, the points 1 - 4 are easily understandable, I think at least. Thus you should try to understand point 5) and 6) because then you have understood why the old construction MUST be false. And understanding the remaining points you may be able to locate a possible coding typo/error in the current svg-file. :-) Achim1999 (talk) 15:30, 5 June 2012 (UTC)[reply]
I am using the horizontal and vertical rulers in Inkscape (which have markings down to 0.02 pixels at full 256x magnification), so the scaling of my monitor should be irrelevant. Of course it is possible that Inkscape is malfunctioning, but I think it is more likely that one (or more) of us is wrong. And I have to admit I am wrong, in part; the size of your border for Beta Crucis (the star nearest the Union Jack) looks very close to correct - perhaps a bit too wide, but out by less than 0.01 pixels, anyway. The other three are all definitely too wide in Inkscape (4.2 pixels, not 4). Previously I had only checked two of the other three stars, sorry. --Avenue (talk) 21:09, 5 June 2012 (UTC)[reply]
Sorry, but Inkscape (or whatever SVG-editor) is not a valid reference or only verification-tool. :-( Use your brain!! And all 4 stars should have the same absolute white border-thickness in the flag! Thus, what are you talking of? Achim1999 (talk) 22:20, 5 June 2012 (UTC)[reply]
Remark: I still wonder a bit, because I indeed checked the flag-construction on my monitor by eye and had scaled it up to 9600 x 4800 pixels. On the other hand the difference of 1,7 % (not 5%) in border-thickness of a star is not easily recognizable. BTW: It would be of significant advantage if there is always a viewBox attribute in the first svg-statement. Achim1999 (talk) 15:52, 5 June 2012 (UTC)[reply]
They made (finally) a bigger drawing of the construction sheet at http://www.mch.govt.nz/files/NZ%20Flag%20-%20proportions.JPG and I will try checking that as soon as I can. User:Zscout370 (Return fire) 18:35, 5 June 2012 (UTC)[reply]
We need not a bigger drawing (its is big enough and moreover there exits writen words which are explaining this description! *LOL*), in contrast You, Avenue, (you also Zscout370?) need better understanding of the current construction description and its logical implications. :-) Achim1999 (talk) 21:59, 5 June 2012 (UTC)[reply]

Update color shades[edit]

{{Edit request}} I updated the source codes to use the RGB color shades as I taken from the Pantone website, everyone who has rights to update the image can copy the following source codes from here:

Click to see the source code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"

height="600" width="1200">

<defs>
<clipPath id="Canton">
<path d="M 0,0 L 600,0 L 600,300 L 0,300 z"/>
</clipPath>

<clipPath id="Diagonals">
<path d="M 0,0 L 300,150 L 0,150 z M 300,0 L 600,0 L 300,150 z M 300,150 L 600,150 L 600,300 z M 300,150 L 300,300 L 0,300 z"/>
</clipPath>

<g id="Pentagram">
<g id="Arm" transform="translate(0,-0.324925)">
<path d="M 0,0 L 0,0.5 L 1,0 z"/>
<path d="M 0,0 L 0,-0.5 L 1,0 z" transform="rotate(-36,1,0)"/>
</g>
<use xlink:href="#Arm" transform="scale(-1,1)"/>
<use xlink:href="#Arm" transform="rotate(72,0,0)"/>
<use xlink:href="#Arm" transform="rotate(-72,0,0)"/>
<use xlink:href="#Arm" transform="rotate(-72,0,0) scale(-1,1)"/>
</g>
</defs>

<rect fill="#012169" x="0" y="0" width="1200" height="600"/>

<g id="Flag_of_the_United_Kingdom">
<path id="Saint_Andrews_Cross" stroke="#fff" d="M 0,0 L 600,300 M 0,300 L 600,0" stroke-width="60" clip-path="url(#Canton)"/>
<path id="Saint_Patricks_Cross" stroke="#c8102e" d="M 0,0 L 600,300 M 0,300 L 600,0" stroke-width="40" clip-path="url(#Diagonals)"/>
<g id="Saint_Georges_Cross">
<path stroke="#fff" d="M 300,0 L 300,300 M 0,150 L 600,150" stroke-width="100" clip-path="url(#Canton)"/>
<path stroke="#c8102e" d="M 300,0 L 300,300 M 0,150 L 600,150" stroke-width="60" clip-path="url(#Canton)"/>
</g>
</g>

<g id="Southern_Cross">
<g id="Gamma_Crucis">
<use xlink:href="#Pentagram" fill="#fff" transform="translate(900,120) scale(45.4)"/>
<use xlink:href="#Pentagram" fill="#c8102e" transform="translate(900,120) scale(30)"/>
</g>
<g transform="rotate(82,900,240)">
<g id="Delta_Crucis">
<use xlink:href="#Pentagram" fill="#fff" transform="translate(900,120) rotate(-82) scale(40.4)"/>
<use xlink:href="#Pentagram" fill="#c8102e" transform="translate(900,120) rotate(-82) scale(25)"/>
</g>
<g id="Beta_Crucis">
<use xlink:href="#Pentagram" fill="#fff" transform="translate(900,380) rotate(-82) scale(45.4)"/>
<use xlink:href="#Pentagram" fill="#c8102e" transform="translate(900,380) rotate(-82) scale(30)"/>
</g>
</g>
<g id="Alpha_Crucis">
<use xlink:href="#Pentagram" fill="#fff" transform="translate(900,480) scale(50.4)"/>
<use xlink:href="#Pentagram" fill="#c8102e" transform="translate(900,480) scale(35)"/>
</g>
</g>
</svg>

-- Great Brightstar (talk) 02:40, 15 September 2019 (UTC)[reply]

✓ Done -- User: Perhelion 14:29, 16 September 2019 (UTC)[reply]

Some comments on precision[edit]

The ratios relating to a pentagram can be found here

  • Line 11: The precise value of -0.324925 should be:
  • Lines 35,40,44,49: The precise value of the gain of the size of the stars by the borders should be: instead of just 15.4.--Mike Rohsopht (talk) 12:35, 30 July 2021 (UTC)[reply]