[metapost] arrowhead weirdness
Peter Rolf
indiego at gmx.net
Mon Aug 18 14:54:21 CEST 2008
Oliver Buerschaper schrieb:
>> You only have half of 'ahangle' as angle in the subdividing right
>> triangles.
>>
>> ahlength := 2u/sin(.5ahangle);
>
> Arrg … that's what I didn't take into account.
>
>> But changing your source at this point still doesn't work here.
>
> Neither does it work here … for the record: using mptopdf 1.3.2 (mpost
> 0.993) in both cases here's my original version:
>
> ---
> beginfig(1);
> u := 0.5cm;
> path p;
> p := origin--(5u,0);
> ahlength := 2u/sind(ahangle);
> pickup pencircle scaled u;
> drawarrow p;
> draw p yshifted u withpen pencircle scaled 0.1bp withcolor red;
> draw p yshifted u/2 withpen pencircle scaled 0.1bp withcolor red;
> undraw p withpen pencircle scaled 0.1bp;
> undraw arrowhead p withpen pencircle scaled 0.1bp;
> endfig;
>
>
> end;
> ---
>
> with this output
>
>
>
>
> and here's the one with the corrected angle:
>
> ---
> beginfig(1);
> u := 0.5cm;
> path p;
> p := origin--(5u,0);
p := origin--(10u,0);
> ahlength := 2u/sind(ahangle/2);
> pickup pencircle scaled u;
> drawarrow p;
> draw p yshifted u withpen pencircle scaled 0.1bp withcolor red;
> draw p yshifted u/2 withpen pencircle scaled 0.1bp withcolor red;
draw p yshifted 1.5u withpen pencircle scaled 0.1bp withcolor red;
draw p yshifted 2u withpen pencircle scaled 0.1bp withcolor red;
> undraw p withpen pencircle scaled 0.1bp;
> undraw arrowhead p withpen pencircle scaled 0.1bp;
> endfig;
>
>
> end;
> ---
>
> Now this I don't understand at all:
>
>
>
>
> By the way, changing ahangle/2 into 0.5ahangle doesn't help either.
>
> Any suggestions?
>
Look at the (dizzying) definition of arrowhead. It seems that the
intersection point can not be found correctly in case of a very small
path p.
Best wishes, Peter
More information about the metapost
mailing list