# 図2 s2 曲面の X-Y 面 TMP="tmp$$" TMP="tmp" trap 'rm -f $TMP; exit 0' 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 /usr/bin/awk ' BEGIN { PI = atan2(0, -1) PI2 = atan2(0, -1) * 2 a = 25 b = 10 k1 = sqrt(1 / 1.0 + 1) #k1 = -k1 N = 0 Ns = 3 Np = 20 pmin = 0 #-PI / 2 pmax = pmin + PI2 * 3 / 4 # s2 線 for (t = 0; t <= PI; t += PI / Ns) { p1 = pmin p2 = pmax dp = (p2 - p1) / 50 / PI for (p = pmin; p <= pmax; p += dp) { xyz2(a, b, k1, p, t, 0) print x, y >"'"$TMP"'" } printf "\n\n" >"'"$TMP"'" } printf "\n\n" >"'"$TMP"'" # q2 線 for (p = pmin; p <= pmax; p += PI / Np) { for (t = 0; t <= PI * 1.01; t += PI / Ns / 10) { xyz2(a, b, k1, p, t, 0) print x, y >"'"$TMP"'" } printf "\n\n" >"'"$TMP"'" } # 上端面 xyz2(a, 0, k1, pmax, 0, p0) if (k1 * x < 0) { for (t = 0; t <= PI2; t += PI / Ns / 10) { xyz2(a, b, k1, pmax, t, 0) print x, y >"'"$TMP"'" } } printf "\n\n" >"'"$TMP"'" # 下端面 xyz2(a, 0, k1, pmin, 0, p0) if (k1 * x < 0) { for (t = 0; t <= PI2; t += PI / Ns / 10) { xyz2(a, b, k1, pmin, t, 0) print x, y >"'"$TMP"'" } } printf "\n\n" >"'"$TMP"'" exit 0 } END { print "set size square 0.5" print "set nokey" print "set noxtics" print "set noytics" print "set noborder" print "set xzeroaxis" print "set yzeroaxis" print "plot \"'"$TMP"'\" with lines lc \"red\"" print "" exit 0 } function xyz2(a, b, k1, p, t, p0, x1, y1, z1) { ex = cos(p) * cos(t) - 1 / k1 * sin(p) * sin(t) ey = sin(p) * cos(t) + 1 / k1 * cos(p) * sin(t) ez = -sqrt(k1^2 - 1) / k1 * sin(t) x1 = a * cos(p) y1 = a * sin(p) z1 = a * k1 / sqrt(k1 * k1 - 1) * (p - p0) x = x1 - b * ex y = y1 - b * ey z = z1 - b * ez } ' | gnuplot -persist