[OS X TeX] circle using metapost

Franck Pastor franck.pastor at skynet.be
Sat Mar 23 12:10:35 EDT 2013


Le 23 mars 2013 à 16:45, NMPOST7 a écrit :

> Dear All,
> 
> having gone through quite a few tutorials and explanations, I am finally back in
> the mailing list.
> 
> All I need to do it metapost is draw a circle  at a particular coordinate (x,y)
> with a diameter of n.
> 
> The code is clear to me. However, I need to specify the coordinates and the
> diameter.
> 
> draw fullcircle scaled 50;
> 
> Thanks
> 
> BR
> suren


Not sure if it is exactly what you want, but it must be something like that… For a circle of diametre d = 3cm and center c = (1cm, 2cm) :

%unit
u = 1cm ; 
% center c and diameter d
pair c ; c = u*(1, 2) ;
d = 3u;
% the circle
beginfig(1) ;
	draw fullcircle scaled d  shifted c;
endfig ;
end.

You can choose to turn it into a macro, of course:

def do_my_circle(expr c, d) = 
	draw fullcircle scaled d  shifted c 
enddef ;
u = 1cm ;
beginfig(1) ;
	do_my_circle(u*(1, 2), 3u) ;
endfig ;
end.

HTH,

Franck Pastor





More information about the MacOSX-TeX mailing list