[NTG-context] METAPOST -- specifying an unknown point coordinate by giving the angle from another known point

Nicola nvitacolonna at gmail.com
Fri Feb 26 22:42:31 CET 2010


In article 
<771da05a1002251718l55669a0co770b5a78bed84e4b at mail.gmail.com>,
 James Fisher <jameshfisher at gmail.com> wrote:

> This isn't specifically a ConTeXt question, but via it I've run into a
> seemingly simple problem in METAPOST that I just can't solve.  I'm
> trying to draw a parallelogram by specifying: (1) the length of sides
> parallel to the x-axis; (2) the total height of the figure; (3) one of
> the interior angles. 

Curiously enough, nobody has posted a solution that uses 'whatever', so 
here it is:

z0 = origin;        % bottom left
z1 = (5,0);         % bottom right
y3 = y2 = 10;
z3 = z0 + whatever*dir(87); % z3 is obtained by starting at z0 and
                            % moving along dir(87)
z2-z1 = whatever*(z3-z0);   % The line z1--z2 is parallel to z0--z3

That is, what you were trying to achieve:

angle(z3-z0) = dir(87);

can be written instead:

z3 - z0 = whatever*dir(87);

Nicola



More information about the ntg-context mailing list