外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
gccでソリッド図形の円環を描く
:gccでソリッド図形の円環を描く
@echo off
if not exist %~dpn0.exe (
for /f "delims=:" %%n in ('findstr /n "^#!" %0') do (
more +%%n %0 > %~dpn0.c
gcc -Os %~dpn0.c -o %~dpn0.exe -s
)
)
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
)
%~dpn0
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
#!この次の行からプログラムを書いてください
#include "jw.h"
int main(void)
{
FILE *f;
char S_[256], *F[20];
double x1, y1, x2, y2, r1, hk, d;
int r, g, b;
double w = atof(getenv("w"));
double r2 = atof(getenv("r2"));
if ( (f = fopen("jwc_temp.txt", "r")) != NULL) {
while (fgets(S_, 256, f) != NULL) {
split(chomp(S_), F);
if (strncmp(S_, "hk", 2) == 0) hk = atof(F[1]);
if (strncmp(S_, "hp1", 3) == 0) { x1 = atof(F[1]); y1 = atof(F[2]); }
if (strncmp(S_, "hp2", 3) == 0) { x2 = atof(F[1]); y2 = atof(F[2]); }
}
} else {
exit(MISSING_JWC_TEMP_TXT);
}
fclose(f);
d = rad(hk);
r = 0; g = 128; b = 128;
r1 = hypot(x2 - x1, y2 - y1);
f = fopen("jwc_temp.txt", "w");
fprintf(f, "lc10 %d\n", r + 256 * g + 256 * 256 * b);
fprintf(f, "so %.15g %.15g %.15g %.15g %.15g %.15g %.15g %.15g\n", x1, y1, r1, w, d, 0.0, 2 * PI, r1 * r2);
fclose(f);
return 0;
}