外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
パワーシェルでソリッド図形の円環を描く
:パワーシェルでソリッド図形の円環を描く
@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 (
more +%%n %0 | powershell -command -
)
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
#!ここから more +n %0 の n 行目:最初の行は 0 行
function hypot ($x,$y)
{
[math]::sqrt($x*$x+$y*$y)
}
$w = [double] $env:w
$r2 = [double] $env:r2
gc jwc_temp.txt | %{
if ($_ -match "^hk") { $hk = [double] $_.substring(3) }
if ($_ -match "^hp1-") { $p1 = [regex]::split($_,' +')[1,2] }
if ($_ -match "^hp2") { $p2 = [regex]::split($_,' +')[1,2] }
}
&{
$x1,$y1,$x2,$y2 = $($p1+$p2 | %{ [double] $_ })
$r,$g,$b = 0,128,128
"lc10 $($r+$g*256+$b*256*256)"
$r = hypot ($x2-$x1) ($y2-$y1)
"so $p1 $r $w $($hk*[math]::pi/180) 0 $([math]::pi*2) $($r*$r2)"
} | sc jwc_temp.txt
#ここまで powershell は 文末に必ず空白行を置いてください