外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
mshtaでソリッド図形の円を描く
:mshtaでソリッド図形の円を描く
@echo off
set w=%1
if defined w (
echo ^%1> %~dpn0.txt
) else (
if exist %~dpn0.txt (
for /f "tokens=*" %%a in (%~dpn0.txt) do set w=%%a
)
)
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 #c 扁平率(0.1~10.0) w =
REM #e
<script>
ENV = new ActiveXObject("WScript.Shell").Environment("Process")
w = ENV("w") ? ENV("w") * 1.0 : 1
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
r = sqrt( (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))
d = hk * PI / 180
red = 0; green = 128; b = 128
rgb = red + green * 256 + b * 256 * 256
g.WriteLine("lc10 " + rgb)
g.WriteLine(["sc", x1, y1, r, w, d, 0, PI * 2, 100].join(" "))
}
}
close()
</script>