Example 1.
(n = 5, ratio = 1)
gnuplot script 1:
n = 5
ratio = 1.0
A = 2*pi/n
c = 2*cos(A)
d = ratio*c*(1 - cos(A))/(1 + cos(A))
max(x,y) = x < y ? y : x
f1(x,y) = max(max(abs(y - c) - d, y*cos(A) - x*sin(A) - c/cos(A)), \
max(d - abs(y*cos(A) - x*sin(A) - c), y*cos(3*A) - x*sin(3*A) - c + d))
f2(x,y) = f1(y*sin(A) + x*cos(A), y*cos(A) - x*sin(A))
f3(x,y) = f1(y*sin(2*A) + x*cos(2*A), y*cos(2*A) - x*sin(2*A))
f4(x,y) = f1(y*sin(3*A) + x*cos(3*A), y*cos(3*A) - x*sin(3*A))
f5(x,y) = f1(y*sin(4*A) + x*cos(4*A), y*cos(4*A) - x*sin(4*A))
set xrange [-2.5:2.5]
set yrange [-2.5:2.5]
set size ratio -1
set samples 256
set isosamples 256
set contour base
set cntrparam levels discrete 0.0
unset key
unset surface
set table 'f1.dat'
splot f1(x,y)
unset table
set table 'f2.dat'
splot f2(x,y)
unset table
set table 'f3.dat'
splot f3(x,y)
unset table
set table 'f4.dat'
splot f4(x,y)
unset table
set table 'f5.dat'
splot f5(x,y)
unset table
plot 'f1.dat' w l lw 2 lc rgb "#0099ff", \
'f2.dat' w l lw 2 lc rgb "#0099ff", \
'f3.dat' w l lw 2 lc rgb "#0099ff", \
'f4.dat' w l lw 2 lc rgb "#0099ff", \
'f5.dat' w l lw 2 lc rgb "#0099ff"
Example 2.
(n = 6, ratio = 1)
gnuplot script 2:
n = 6
ratio = 1.0
A = 2*pi/n
c = 1
d = ratio*c/3
max(x,y) = x < y ? y : x
f1(x,y) = max(max(abs(y - c) - d, y - sqrt(3)*x - 4*c), \
max(d - abs(y*cos(A) - x*sin(A) - c), y*cos(4*A) - x*sin(4*A) - c + d))
f2(x,y) = f1(y*sin(A) + x*cos(A), y*cos(A) - x*sin(A))
f3(x,y) = f1(y*sin(2*A) + x*cos(2*A), y*cos(2*A) - x*sin(2*A))
f4(x,y) = f1(y*sin(3*A) + x*cos(3*A), y*cos(3*A) - x*sin(3*A))
f5(x,y) = f1(y*sin(4*A) + x*cos(4*A), y*cos(4*A) - x*sin(4*A))
f6(x,y) = f1(y*sin(5*A) + x*cos(5*A), y*cos(5*A) - x*sin(5*A))
set xrange [-2.5:2.5]
set yrange [-2.5:2.5]
set size ratio -1
set samples 256
set isosamples 256
set contour base
set cntrparam levels discrete 0.0
unset key
unset surface
set table 'f1.dat'
splot f1(x,y)
unset table
set table 'f2.dat'
splot f2(x,y)
unset table
set table 'f3.dat'
splot f3(x,y)
unset table
set table 'f4.dat'
splot f4(x,y)
unset table
set table 'f5.dat'
splot f5(x,y)
unset table
set table 'f6.dat'
splot f6(x,y)
unset table
plot 'f1.dat' w l lw 2 lc rgb "#0099ff", \
'f2.dat' w l lw 2 lc rgb "#0099ff", \
'f3.dat' w l lw 2 lc rgb "#0099ff", \
'f4.dat' w l lw 2 lc rgb "#0099ff", \
'f5.dat' w l lw 2 lc rgb "#0099ff", \
'f6.dat' w l lw 2 lc rgb "#0099ff"
( Mathematical softwares used: Graph, gnuplot )
Related posts:
Related posts:
No comments:
Post a Comment