
경로의 지정된 길이를 따라 점으로 쌍을 정의할 수 있습니까?
예를 들면
beginfig
u=2cm;
path x;
x=(0,0)..u*dir(225);
%v= a point along a fraction of the length of x in a specific direction
endfig
답변1
그만큼~을 따라MetaPost의 Metafun 형식으로 정의된 연산자는 점을 경로의 일부로 지정합니다.
beginfig(1);
u=2cm;
path x; x=(0,0)..u*dir(225); draw x;
pair v; v = point .3 along x;
dotlabel.lrt(btex v etex, v);
endfig;
end.
플래그 를 사용하여 컴파일하려면 mem
: mpost --mem=metafun yourfile.mp
. 결과:
대안으로 mp-tool.mpii
프로그램 시작 시 패키지를 로드할 수 있습니다(그러나 그러면 투명성과 같은 Metafun의 전체 기능을 활용할 수 없습니다).
input mp-tool.mpii;
또는 형식을 고수하려면 연산자를 직접 plain
정의할 수도 있습니다 along
. 이는 다음과 같이 정의되어 있습니다.메타펀 매뉴얼, p. 61:
primarydef pct along pat =
(arctime (pct * (arclength pat)) of pat) of pat
enddef;
Metafun 형식(설명서, idem p. 61 참조)에서도~에차원이 있는 점의 위치를 지정하는 연산자가 정의되었습니다.
primarydef len on pat =
(arctime len of pat) of pat
enddef;
우리 프로그램에 적용하면 동일한 결과를 위해 다음과 같이 사용됩니다.
beginfig(1);
u=2cm;
path x; x=(0,0)..u*dir(225); draw x;
pair v; v = point .6cm on x;
dotlabel.lrt(btex v etex, v);
endfig;
end.