메타포스트

메타포스트
MetaPost
패러다임명령형, 조판
설계자존 D. 호비
개발자Taco Hoekwater, Luigi Scarso
발표일1994년 (1994)
최근 버전1.8
최근 버전 출시일2013년 6월 17일(11년 전)(2013-06-17)
미리보기 버전2.0rc2
미리보기 버전 출시일2018년 2월 19일(7년 전)(2018-02-19)
자료형 체계, 동적, 스트롱
운영 체제크로스 플랫폼
라이선스LGPL
웹사이트tug.org/metapost
영향을 받은 언어
메타폰트

메타포스트(MetaPost)는 메타포스트 프로그래밍 언어 그 자체 또는 해당 프로그래밍 언어의 인터프리터를 모두 가리킨다. 이 둘은 도널드 커누스메타폰트 언어와 인터프리터에서 파생한 것이다. 메타포스트는 기하학/대수적 기술로부터 벡터 그래픽 다이어그램을 생성한다. 이 언어는 선, 곡선, 점, 기하학 변형을 조작하기 위한 메타폰트의 선언 문법을 공유한다.

예시

[편집]

다음은 단일 파일 example.mp을 메타포스트 인터프리터로 처리(리눅스의 mpost 명령어를 통해)할 때의 예시이다. 이때 3개의 eps 파일(example.1, example.2, example.3)이 생성된다. 이것들은 오른쪽 사진으로 시각화되어 있다.

예시 출력
transform pagecoords; pagecoords:=identity scaled 10mm shifted (100mm,150mm); beginfig (1)     fill ((0,0)--(2,0)--(2,1)--(1,1)--(1,2)--(0,2)--cycle)         transformed pagecoords withcolor green;     draw ((2,0)..(2,1)..(1,1)..(1,2)..(0,2))         transformed pagecoords;     drawarrow ((0,0)--(2,2)) transformed pagecoords; endfig; beginfig (2)     draw (for i=0 upto 7: dir (135i)-- endfor cycle)         transformed pagecoords; endfig; pagecoords:=identity scaled 15mm shifted (100mm,150mm); beginfig (3);     % declare paths to be used     path p[],p[]t;     % set up points by defining relationships     z1=(0,0);   z2=z1+2up;     z3=z1+whatever*dir (60)=z2+whatever*dir (-50);     z4=z3+(-1.5,-.5);     z5=z1+dir (135);     z0=whatever[z1,z2]=whatever[z3,z4];     % set up paths     p0=fullcircle yscaled .5 rotated 45 shifted z0 ;     p1=z2---z4..z0..z3---z1;     p2=p1 cutbefore p0 cutafter p0;     p3=p0 cutbefore p1 cutafter p1;     p4=p2---p3---cycle;     % define transformed versions of paths and points     for i=0 upto 4: p[i]t=p[i] transformed pagecoords; endfor     for i=0 upto 5: z[i]t=z[i] transformed pagecoords; endfor     % do some drawing     fill p4t withcolor (1,1,0.2);     draw z1t---z2t withcolor .5white;     draw z3t---z4t withcolor .5white;     pickup pencircle;     draw p0t dashed withdots scaled .3;     draw p1t dashed evenly;     draw p2t withcolor blue;     draw p3t withcolor red;     label.lrt (btex $z_0$ etex, z0t);     label.llft (btex $z_1$ etex, z1t);     label.top (btex $z_2$ etex, z2t);     label.rt (btex $z_3$ etex, z3t);     label.llft (btex $z_4$ etex, z4t);     for i=0 upto 4:         drawdot z[i]t withpen pencircle scaled 2;     endfor endfig; bye 

같이 보기

[편집]

외부 링크

[편집]