 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Arrays are a very useful addition to POV but there are some
restrictions imposed by the current implementation. Therefore I
suggest that a set of functions to operate with arrays be added to POV
(well, to some unofficial version at the moment, since the feature
list of 3.5 is locked):
pop Removes the last element of an array, and returns its value
push Adds one or more elements to the end of an array
reverse Reverses the direction of an array.
sort Sorts an array in place
shift Removes the first element from an array and returns its value
unshift Adds one or more elements to the beginning of an array
slice Extracts a section of an array and returns it as a new array
splice Adds and/or removes elements from an array
What do you people (esp. the program-oriented folk) think about these?
Would they be useful? If so, would any kind soul care to patch them
in? :))
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vip bg
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Peter Popov <pet### [at] vip bg> wrote:
: pop Removes the last element of an array, and returns its value
: push Adds one or more elements to the end of an array
: reverse Reverses the direction of an array.
: sort Sorts an array in place
: shift Removes the first element from an array and returns its value
: unshift Adds one or more elements to the beginning of an array
: slice Extracts a section of an array and returns it as a new array
: splice Adds and/or removes elements from an array
: What do you people (esp. the program-oriented folk) think about these?
: Would they be useful? If so, would any kind soul care to patch them
: in? :))
The upcoming pov3.5 will be using C++ and the standard deque class could be
used to make most of those automatically and fast.
--
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Mon, 12 Feb 2001 14:14:44 +0200, Peter Popov wrote:
>sort Sorts an array in place
This one might be a bit of an issue. Not everything that can be put in
an array can be sorted. In fact, most things that can be put in an array
are unsortable.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 12 Feb 2001 08:18:04 -0500, ron### [at] povray org (Ron Parker)
wrote:
>On Mon, 12 Feb 2001 14:14:44 +0200, Peter Popov wrote:
>>sort Sorts an array in place
>
>This one might be a bit of an issue. Not everything that can be put in
>an array can be sorted. In fact, most things that can be put in an array
>are unsortable.
Well, floats, vectors (component by component) and strings can. This
would still be a big bonus.
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vip bg
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> The upcoming pov3.5 will be using C++ and the standard deque class could be
> used to make most of those automatically and fast.
are you sure? i thought the total rewrite wasn't scheduled until
version 4? isn't 3.5 just going to be the official version of megapov,
still written in C?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Mon, 12 Feb 2001 09:03:54 -0800, Ryan Constantine wrote:
>> The upcoming pov3.5 will be using C++ and the standard deque class could be
>> used to make most of those automatically and fast.
>
>are you sure?
He's seen the source code, so I'd guess he's sure. Except that STL isn't
portable enough yet for even the supported platforms.
>i thought the total rewrite wasn't scheduled until version 4?
True.
>isn't 3.5 just going to be the official version of megapov,
False, though there are some features in common between the two.
>still written in C?
False. Most of it still looks like C, but it will require a C++ compiler.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Peter Popov <pet### [at] vip bg> wrote:
> Arrays are a very useful addition to POV but there are some
> restrictions imposed by the current implementation. Therefore I
> suggest that a set of functions to operate with arrays be added to POV
> (well, to some unofficial version at the moment, since the feature
> list of 3.5 is locked):
> <list snipped>
> What do you people (esp. the program-oriented folk) think about these?
> Would they be useful? If so, would any kind soul care to patch them
> in? :))
This would be *heaven*. I have been working with arrays a lot as of late,
and it would be really nice to be able to do these sorts of things. For
example, I've been doing clipping algorithms (clipping a shape defined by 2d
points to some other shape defined by 2d points), and it'd be really nice to
be able to splice sections together, remove invalid points, etc. To do this
now, it is necessary to first count how many points will be in the new
array, then contruct it, then transfer it to the old array. Ugly code, and
slow too.
So, are you volunteering to add this? ;)
Geoff
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 12 Feb 2001 12:45:11 -0500, Geoff Wedig
<wed### [at] darwin epbi cwru edu> wrote:
>So, are you volunteering to add this? ;)
Actually, no <blush>. I am quite busy at the Uni and when I eventually
have to resurrect whatever programming skills I might have left, I
will need all the time I have to work on my bachelor's project. Sorry.
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vip bg
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Ron Parker <ron### [at] povray org> wrote:
: Except that STL isn't portable enough yet for even the supported platforms.
Which platform/compiler doesn't support basic STL?
(I understand that perhaps not every compiler supports the newest features
of the STL, such as stream iterators and string iterators, but I think that
most support the basic data containers such as vector and deque.)
--
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Ron Parker <ron### [at] povray org> wrote:
: This one might be a bit of an issue. Not everything that can be put in
: an array can be sorted. In fact, most things that can be put in an array
: are unsortable.
Then we have to be able to add a less-than-comparison operator to any
declarable object... :)
Of course for that operator to be useful it should be able to extract
data from the object itself (such as its coordinates or whatever).
By the way, sorting an array of numerical values can be done easy and
fast with a proper macro. Several array sorting macros (including mine) have
been posted here in other threads.
--
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |