Wednesday, August 17, 2016

Rounded Cross - cross with rounded corners (圓角十字形)



gnuplot script:

a = 2
b = 1
c = 1
w = 8
max(x,y) = x < y ? y : x
min(x,y) = x < y ? x : y
fun(x,y) = \
  min(min(max(abs(x)-b,0)**2 + max(abs(y)-(a+b+2*c),0)**2 - c**2, \
  max(abs(x)-(a+b+2*c),0)**2 + max(abs(y)-b,0)**2 - c**2), \
  max((abs(x)-(b+c))**2 + (abs(y)-(b+c))**2 - c**2, \
  c**2 - (abs(x)-(b+2*c))**2 - (abs(y)-(b+2*c))**2))
set xrange [-w:w]
set yrange [-w:w]
set size ratio -1
set samples 512
set isosamples 512
set contour base
set cntrparam levels discrete 0.0
unset key
unset surface
set table 'fun.dat'
splot fun(x,y)
unset table
plot 'fun.dat' w l lw 1.5 lc rgb "red"

(a = 2, b = 1, c = 1)


(a = 4, b = 0.5, c = 0.5)


(a = 0, b = 0, c = 2)


(a = 0, b = 2, c = 4/3)


(a = 2, b = 0, c = 4/3)


( Mathematical softwares used: Graph, gnuplot )


Related posts:

No comments:

Post a Comment