外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
pythonでソリッド図形の円環を描く
:pythonでソリッド図形の円環を描く
@echo off
if not exist %~dpn0.py (
for /f "delims=:" %%n in ('findstr /n "^#!" %0') do (
more +%%n %0 > %~dpn0.py
)
)
set c=%*
if defined c call:set %c%
if exist %~dpn0.txt (
for /f "tokens=*" %%a in (%~dpn0.txt) do call:set %%a
)
if not defined w set w=1
if not defined r2 set r2=0.5
if defined c (
echo %w% %r2% > %~dpn0.txt
)
copy jwc_temp.txt myfiles > nul
python %~dpn0.py > jwc_temp.txt
goto:eof
REM #jww
REM #1-%d 中心点を指示してください
REM #2%d 円周上の点を指示してください
REM #c 扁平率(0.1~10.0) w, 内円半径比 r2/r =
REM #e
:set
if not defined w set w=%1
if not defined r2 set r2=%2
goto:eof
#!この次の行からプログラムを書いてください
# coding: shift_jis
import sys,re,os
from math import *
try :
f = open("myfiles", "r")
for line in f:
F = line.split()
if re.compile("^hk").search(line): hk = float(F[1])
if re.compile("^hp1").search(line): p1 = F[1:3]
if re.compile("^hp2").search(line): p2 = F[1:3]
f.close()
except :
sys.exit()
r, g, b = (0, 128, 128)
x1, y1, x2, y2 = map(float, p1 + p2)
r1 = hypot(x2 - x1, y2 - y1)
w = float(os.environ['w'])
d = hk * pi / 180
r2 = r1 * float(os.environ['r2'])
print("lc10 %s" % (r + 256 * g + 256 * 256 * b))
print("so %s %s %s %s %s %s %s %s" % (x1, y1, r1, w, d, 0, 2 * pi, r2))