[NTG-context] metafun question getting XY

Hans Hagen pragma at wxs.nl
Mon Aug 16 15:45:26 CEST 2004


Floris van Manen wrote:

>if i define a path
>
>q := (w0,w0)--(w0,ww0)--(w2,ww1)--(w3,ww2)--(w3,w0)--cycle ;
>
>and then pass this path as a parameter to a function
>
>test( q ) ;
>
>
>then within that function i can step through the 'list of points'.
>
>def test( expr a  ) =
> for i = 1 upto (length(a)-2):
>  dotlabel.bot ("" , (point i of a)  );
> endfor ;
>enddef;
>
>
>but how could i extract from each point the X and the Y value to
>construct the lines like this.
>
> for i = 1 upto (length(a)-2):
>  z1 = (point i of a) ;
>  draw (0,y1)--(100,y1) ;
> endfor;
>
>  
>
xpart point i of a ; 
ypart point i of a ; 

Hans 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------



More information about the ntg-context mailing list