外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
パワーシェルで2点間の距離を計算する(ptdist)
:パワーシェルで2点間の距離を計算する(ptdist)
@echo off
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 #e
#!ここから more +n %0 の n 行目:最初の行は 0 行
function hypot ($x,$y)
{
[math]::sqrt($x*$x+$y*$y)
}
$hp = @(); foreach ($i in 0..2) { $hp += 0 }
(gc jwc_temp.txt) | foreach {
switch -regex -case ($_)
{
'^hp([12])-?\s+(\S+)\s+(\S+)' { $hp[$matches[1]]=$matches[2,3] }
}
}
&{
$1,$2,$3,$4 = ($hp[1]+$hp[2] | foreach { [double] $_ })
"h#2点間の距離 L = $([math]::round( (hypot ($3-$1) ($4-$2)), 3))"
} | sc jwc_temp.txt
#ここまで powershell は 文末に必ず空白行を置いてください