外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
tclshで2点間の距離を計算する(ptdist)
:tclshで2点間の距離を計算する(ptdist)
@echo off
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 #e
#!この次の行からプログラムを書いてください
set tcl_precision 16; #文字列を数値演算するとき有効桁数 16 (デフォルト 12)
set f [open myfiles]
foreach 0 [split [read $f] \n] {
lassign $0 1 2 3
switch -regexp -- $0 {
^hp1 { set p1 "$2 $3" }
^hp2 { set p2 "$2 $3"
lassign "$p1 $p2" x1 y1 x2 y2
puts [format "h#2点間の距離 L = %.03f" [expr hypot($x2 - $x1, $y2 - $y1)]]
}
}
}
close $f