Making Art with Mathematical Equations, Inequalities and Functions (Mappings, Transformations)
Monday, September 12, 2011
Flag of the United States - plotting contour maps using gnuplot (graphing inequalities using Graph)
gnuplot script:
a = 1.0
b = 1.9
c = 7.0/13.0
d = 0.76
f = 7.0/130.0
g = 19.0/300.0
k = 0.0308
l = 1.0/13.0
star(x,y) = \
( (5+sqrt(5))*abs(x) - sqrt(10-2*sqrt(5))*(y+4*k) \
+ abs( (5+3*sqrt(5))*abs(x) + sqrt(50+10*sqrt(5))*y ) \
+ abs( 2*sqrt(5)*abs(x) - 2*sqrt(25+10*sqrt(5))*y ) \
- abs( (5-3*sqrt(5))*abs(x) - sqrt(50-10*sqrt(5))*y \
+ abs( (5+3*sqrt(5))*abs(x) + sqrt(50+10*sqrt(5))*y ) \
- abs( 2*sqrt(5)*abs(x) - 2*sqrt(25+10*sqrt(5))*y ) ) ) / k
set xrange [0:b]
set yrange [-a:0]
fun(x,y) = \
( x < d && y > -c \
&& star( x - g, y + f ) > 0 \
&& star( x - 3*g, y + f ) > 0 \
&& star( x - 5*g, y + f ) > 0 \
&& star( x - 7*g, y + f ) > 0 \
&& star( x - 9*g, y + f ) > 0 \
&& star( x - 11*g, y + f ) > 0 \
&& star( x - g, y + 3*f ) > 0 \
&& star( x - 3*g, y + 3*f ) > 0 \
&& star( x - 5*g, y + 3*f ) > 0 \
&& star( x - 7*g, y + 3*f ) > 0 \
&& star( x - 9*g, y + 3*f ) > 0 \
&& star( x - 11*g, y + 3*f ) > 0 \
&& star( x - g, y + 5*f ) > 0 \
&& star( x - 3*g, y + 5*f ) > 0 \
&& star( x - 5*g, y + 5*f ) > 0 \
&& star( x - 7*g, y + 5*f ) > 0 \
&& star( x - 9*g, y + 5*f ) > 0 \
&& star( x - 11*g, y + 5*f ) > 0 \
&& star( x - g, y + 7*f ) > 0 \
&& star( x - 3*g, y + 7*f ) > 0 \
&& star( x - 5*g, y + 7*f ) > 0 \
&& star( x - 7*g, y + 7*f ) > 0 \
&& star( x - 9*g, y + 7*f ) > 0 \
&& star( x - 11*g, y + 7*f ) > 0 \
&& star( x - g, y + 9*f ) > 0 \
&& star( x - 3*g, y + 9*f ) > 0 \
&& star( x - 5*g, y + 9*f ) > 0 \
&& star( x - 7*g, y + 9*f ) > 0 \
&& star( x - 9*g, y + 9*f ) > 0 \
&& star( x - 11*g, y + 9*f ) > 0 \
&& star( x - 2*g, y + 2*f ) > 0 \
&& star( x - 4*g, y + 2*f ) > 0 \
&& star( x - 6*g, y + 2*f ) > 0 \
&& star( x - 8*g, y + 2*f ) > 0 \
&& star( x - 10*g, y + 2*f ) > 0 \
&& star( x - 2*g, y + 4*f ) > 0 \
&& star( x - 4*g, y + 4*f ) > 0 \
&& star( x - 6*g, y + 4*f ) > 0 \
&& star( x - 8*g, y + 4*f ) > 0 \
&& star( x - 10*g, y + 4*f ) > 0 \
&& star( x - 2*g, y + 6*f ) > 0 \
&& star( x - 4*g, y + 6*f ) > 0 \
&& star( x - 6*g, y + 6*f ) > 0 \
&& star( x - 8*g, y + 6*f ) > 0 \
&& star( x - 10*g, y + 6*f ) > 0 \
&& star( x - 2*g, y + 8*f ) > 0 \
&& star( x - 4*g, y + 8*f ) > 0 \
&& star( x - 6*g, y + 8*f ) > 0 \
&& star( x - 8*g, y + 8*f ) > 0 \
&& star( x - 10*g, y + 8*f ) > 0 ) \
? 2 : ( (x > d || y < -c) && sin(y*pi/l) < 0 ) ? 0 : 1
set pm3d map
unset colorbox
set palette model RGB defined (0 '#BB133E', 1 'white', 2 '#002664')
set size ratio -1
set samples 760, 400
set isosamples 760, 400
set bmargin 0
set lmargin 0
set rmargin 0
set tmargin 0
unset key
unset xtics
unset ytics
unset border
splot fun(x,y)
Graph example:
The grf file download page: Flag of the United States.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment