1. More trouble with sequences
- Posted by Lmailles <Lmailles at AOL.COM> Feb 27, 1998
- 601 views
I hate to keep criticising the language structure, but I think that the sequence operations ought really to go one stage further. Suppose I have a sequence of co-ordinates sequence coords coords={{1,2},{50,20},{40,100} ... } I want to scale them coords=coords*2 or in PP coords =* 2 I want to scale them from a different origin... sequence origin origin={320,240} --middle of screen coords=(coords-origin)*2+origin but this does *not* work, I have to do origin=repeat(origin,length(coords)) coords=(coords-origin)*2+origin The same also applies if I want to stretch my co-ordinates : coords=coords*{2,1} --Stretch factor 2 parallel to x-axis. Not legal code Presumably there is some reason why this is excluded Rob ? Daniel
2. Re: More trouble with sequences
- Posted by Mike Burrell <mikpos at SOFTHOME.NET> Feb 27, 1998
- 610 views
Lmailles wrote: > I want to scale them from a different origin... > > sequence origin > origin={320,240} --middle of screen > > coords=(coords-origin)*2+origin > > but this does *not* work, I have to do > > origin=repeat(origin,length(coords)) > coords=(coords-origin)*2+origin > > The same also applies if I want to stretch my co-ordinates : > coords=coords*{2,1} --Stretch factor 2 parallel to x-axis. Not legal code > > Presumably there is some reason why this is excluded Rob ? god damn are you every lazy :) in pp: with each point in coords do point = (point - origin) * 2 + origin end with with each point in coords do point = point * {2, 1} end with -- . m i k e b u r r e l l . . http://mikpos.home.ml.org . . mikpos at softhome.net .