Hello,

This code:

\startMPcode
  u = 2cm; % unit length;
  xmax = 1.5 ; ymax = 1.5 ; % axes parameters
  path circle; circle = fullcircle scaled 2u; draw circle withcolor blue;
  x = -1.0 ; % any value between -1 and 1
  len = 3u; % tangent length
  t = (acos x)/45 ; % point-node of fullcircle corresponding to x
  pair I; I = point t of circle ;
  if (x <> 0.0) and (abs(x) <> 1.0): draw origin -- I ; fi ;
  % tangent on the upper part of circle
  pair v ; v = unitvector I rotated 90 ;
  draw I - 0.5len*v -- I + 0.5len*v  withcolor red ;
  draw I withpen pencircle scaled 3bp;
  drawarrow (-xmax*u, 0) -- (xmax*u, 0) ; % horizontal axis
  drawarrow (0, -ymax*u) -- (0, ymax*u) ; % vertical axis
  label.bot(btex $x$ etex, (xmax*u, 0)) ;
\stopMPcode

Should draw a circle with a tangent at x = -1 parallel to y.  However, the 
point of tangency is shown at approximately x = 1, y = 0.01 or so.  I got the 
code from a metapost example:

u = 2cm; % unit length;
xmax = 1.5 ; ymax = 1.5 ; % axes parameters
beginfig(1);
  path circle; circle = fullcircle scaled 2u; draw circle withcolor blue ;
  x = -1.0 ; % any value between -1 and 1
  len = 3u; % tangent length
  t = (acos x)/45 ; % point-node of fullcircle corresponding to x
  pair I; I = point t of circle ;
  if (x <> 0) and (abs(x) <> 1): draw origin -- I ; fi ;
  % tangent on the upper part of circle
  pair v ; v = unitvector I rotated 90 ;
  draw I - 0.5len*v -- I + 0.5len*v  withcolor red ;
  draw I withpen pencircle scaled 3bp;
  drawarrow (-xmax*u, 0) -- (xmax*u, 0) ; % horizontal axis
  drawarrow (0, -ymax*u) -- (0, ymax*u) ; % vertical axis
  label.bot(btex $x$ etex, (xmax*u, 0)) ;
endfig;
end;

The original code generates the expected output when run using:

 mpost --mem=metafun --numbersystem="double" tangent.mp

What do I need to get ConTeXt to compile this code corretly?

Thanks,
Roger
mtx-context     | ConTeXt Process Management 1.06
mtx-context     |
mtx-context     | main context file: 
/usr/home/rmason/tex/texmf-context/tex/context/base/mkiv/context.mkiv
mtx-context     | current version: 2025.02.28 18:12
mtx-context     | main context file: 
/usr/home/rmason/tex/texmf-context/tex/context/base/mkxl/context.mkxl
mtx-context     | current version: 2025.02.28 18:12
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to