file = "epi4.mod"
f = open(file)
lines = []
while str = f.gets
if /^L/ =~ str
v = str.chop.split; n = v[1].to_i
arc = []
n.times do
u = f.gets.chop.split
x = u[0].to_f; y = u[1].to_f
arc << [x,y]
end
v = f.gets.chop.split
lines << [v[1].to_i,arc] if arc.size > 1
end
end
f.close
out_arrow = "epi4.arrow"; out = open(out_arrow,"w")
dd = 0.2
lines.each do |num,arc|
x2 = arc[-1][0]; y2 = arc[-1][1]
x1 = arc[-2][0]; y1 = arc[-2][1]
if y1 == y2
if x1 < x2
deg = 0; xx = x2 - dd; yy = y1
else
deg = 180; xx = x2 + dd; yy = y1
end
else
if y1 < y2
deg = 90; xx = x1; yy = y2 - dd
else
deg = 270; xx = x1; yy = y2 + dd
end
end
out.printf "%.4f %.4f %d 0.3\n",xx,yy,deg
end
out.close
最終更新:2007年07月03日 20:09