# vector question

10 messages
Open this post in threaded view
|

## vector question

 I know I can add two vectors to produce a longer vector, and I can multiply or divide all the elements in a vector by a factor, but how can I add a number to all elements of a vector (presumably creating a new vector as a result)? David
Open this post in threaded view
|

## Re: vector question

 I think you would need a componentwise add operator which openscad dosen't have.
Open this post in threaded view
|

## Re: vector question

 a = [1,2,3] + [1,1,1]; echo(a);ECHO: [2, 3, 4]On 27 June 2012 12:08, Giles Bathgate wrote: I think you would need a componentwise add operator which openscad dosen't have. _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscad
Open this post in threaded view
|

## Re: vector question

 In reply to this post by Giles Bathgate-2 On Wednesday 27 Jun 2012, Giles Bathgate wrote: > I think you would need a componentwise add operator which openscad dosen't > have. OK, another approach, is there a way to access elements of a vector other than for?  Or can I use for to cycle round creating a new vector? David
Open this post in threaded view
|

## Re: vector question

 You can probably access elements sequentially with a recursive function but I don't know any way to add new elements to a vector or concatenate 2.On 27 June 2012 12:22, David Goodenough wrote: On Wednesday 27 Jun 2012, Giles Bathgate wrote: > I think you would need a componentwise add operator which openscad dosen't > have. OK, another approach, is there a way to access elements of a vector other than for?  Or can I use for to cycle round creating a new vector? David _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscad
Open this post in threaded view
|

## Re: vector question

 I know I can add two vectors to produce a longer vector  How do you do that? On 27 June 2012 12:34, nop head wrote: You can probably access elements sequentially with a recursive function but I don't know any way to add new elements to a vector or concatenate 2. On 27 June 2012 12:22, David Goodenough wrote: On Wednesday 27 Jun 2012, Giles Bathgate wrote: > I think you would need a componentwise add operator which openscad dosen't > have. OK, another approach, is there a way to access elements of a vector other than for?  Or can I use for to cycle round creating a new vector? David _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscad
Open this post in threaded view
|

## Re: vector question

Open this post in threaded view
|