外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
tclshでソリッド図形の円環を描く
:tclshでソリッド図形の円環を描く
@echo off
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
)
for /f "delims=:" %%n in ('findstr /n "^#!" %0') do (
copy jwc_temp.txt myfiles > nul
more +%%n %0 | tclsh - > 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
#!この次の行からプログラムを書いてください
set tcl_precision 16; #文字列を数値演算するとき有効桁数 16 (デフォルト 12)
set PI [expr acos(-1)]
set w $env(w)
set r2 $env(r2)
set f [open myfiles]
foreach 0 [split [read $f] \n] {
lassign $0 1 2 3
switch -regexp -- $0 {
^hk { set hk $2 }
^hp1 { set p1 "$2 $3" }
^hp2 { set p2 "$2 $3" }
}
}
close $f
lassign "$p1 $p2" x1 y1 x2 y2
set r 0; set g 128; set b 128
puts "lc10 [expr $r + 256 * $g + 256 * 256 * $b]"
set r [expr hypot($x2 - $x1, $y2 - $y1)]
set d [expr $hk * $PI / 180]
puts "so $x1 $y1 $r $w $d 0 [expr 2 * $PI] [expr $r * $r2]"