how to transform array to sequence - vector3d



Dear Mario,

thanks for your helpful advice. I will learn much from your attached code. 

PS: the new vector function of package DRAW works very fine: now I am able to plot
oriented individual coordinate systems etc. in 3D, which help students to better study
geometric situations.

hth Wolfgang


"Mario Rodriguez" <biomates at telefonica.net> schrieb:
> > (Despite of the very new function vector in package draw.lisp, version 1.9 from Mario, I
> > have the following question.)
> > 
> > 1. If I define a simple user function vector3d as follows:
> > 
> > vector3d(a,b) :=  block( 
> >                   points_joined = true,
> >                   point_type = 6, point_size=1,
> >                   points([a,b]),
> >                   point_type = 9, point_size=2,
> >                   points([b]) )$
> > 
> > and call
> > 
> > vector3d([1,2,3],[2,4,1]);
> > 
> > .. so the function gives back the last entry 'points_joined = false' as return value
> > (which results in an error), but I need the *whole* sequence of commands inside block as
> > return value.
> > 
> 
> Make vector3d to return a list,
> 
> vector3d(a,b) :=  [points_joined = true,
>                    point_type = 6, point_size=1,
>                    points([a,b]),
>                    point_type = 9, point_size=2,
>                    points([b]) ]$
> apply('draw3d,vector3d([1,2,3],[2,4,1]));
> 
> 
> 
> 
> 
> > 2. Similar, to define a line in 3D and to plot it I try:
> > 
> > Line : [2,3,0]+t*[1,-2,1];
> > draw3d( parametric(Line ,t,-2,2) )
> > 
> > .. but instead of   [2+t,3-2t,t] 
> > I need the sequence  2+t,3-2t,t  as return value resp. as input for parametric().
> > 
> 
> Line : [2,3,0]+t*[1,-2,1]$
> draw3d( apply(parametric,append(Line,[t,-2,2])));
> 
> 
> append(Line,[t,-2,2]) 
>      => [t + 2, 3 - 2 t, t, t, - 2, 2]
> 
> apply(parametric,append(Line,[t,-2,2]))
>      => parametric(t + 2, 3 - 2 t, t, t, - 2, 2)
> 
> which is what draw3d needs as an argument.
> 
> hth
> 
> 
> -- 
> Mario Rodriguez Riotorto
> www.biomates.net