外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
mshtaでソリッド図形の矩形を描く
:mshtaでソリッド図形の矩形を描く
@echo off
if exist jwc_temp.txt (
copy jwc_temp.txt myfiles > nul
mshta %~f0 < myfiles > jwc_temp.txt
)
goto:eof
REM #jww
REM #1-%d 矩形の始点を指示してください
REM #2%d 対頂点を指示してください
REM #e
<script>
hp = []
with (new ActiveXObject("Scripting.FileSystemObject")) {
f = GetStandardStream(0) //stdin
g = GetStandardStream(1) //stdout
while (! f.AtEndOfStream) {
F = ($_ = f.ReadLine()).split(/\s+/)
if (/^hk/i .test($_)) { hk = F[1] } //hk 軸角
if (/^hp\d+/i .test($_)) { hp[F[0].match(/\d+/)] = F.slice(1, 3) }
}
f.close()
with (Math) {
x1 = hp[1][0] * 1.0; y1 = hp[1][1] * 1.0
x2 = hp[2][0] * 1.0; y2 = hp[2][1] * 1.0
co = cos(hk * PI / 180)
si = sin(hk * PI / 180)
ww = (x2 - x1) * co + (y2 - y1) * si
hh = - (x2 - x1) * si + (y2 - y1) * co
p3 = [x1 - hh * si, y1 + hh * co]
p4 = [x1 + ww * co, y1 + ww * si]
}
r = 0; green = 128; b = 128
rgb = r + green * 256 + b * 256 * 256
g.WriteLine("lc10 " + rgb)
g.WriteLine(["sl", hp[1], p3, hp[2], p4].join(" ").replace(/,/g, " "))
}
close()
</script>