POV-Ray : Newsgroups : povray.general : Suggestion: array functions Server Time
8 Aug 2024 14:23:24 EDT (-0400)
  Suggestion: array functions (Message 1 to 10 of 16)  
Goto Latest 10 Messages Next 6 Messages >>>
From: Peter Popov
Subject: Suggestion: array functions
Date: 12 Feb 2001 07:15:03
Message: <uuhf8tot4cqub4e7vaj2r3r1r602q373cq@4ax.com>
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] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Warp
Subject: Re: Suggestion: array functions
Date: 12 Feb 2001 07:37:31
Message: <3a87d90a@news.povray.org>
Peter Popov <pet### [at] vipbg> 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

From: Ron Parker
Subject: Re: Suggestion: array functions
Date: 12 Feb 2001 08:18:04
Message: <slrn98fokd.14u.ron.parker@fwi.com>
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

From: Peter Popov
Subject: Re: Suggestion: array functions
Date: 12 Feb 2001 12:00:37
Message: <pi5g8tomd1pl9jfjeqlroctekhf356vtnj@4ax.com>
On 12 Feb 2001 08:18:04 -0500, ron### [at] povrayorg (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] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Ryan Constantine
Subject: Re: Suggestion: array functions
Date: 12 Feb 2001 12:03:55
Message: <3A88177A.E2AB391C@ucdavis.edu>
>   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

From: Ron Parker
Subject: Re: Suggestion: array functions
Date: 12 Feb 2001 12:08:55
Message: <slrn98g654.183.ron.parker@fwi.com>
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

From: Geoff Wedig
Subject: Re: Suggestion: array functions
Date: 12 Feb 2001 12:45:11
Message: <3a882126@news.povray.org>
Peter Popov <pet### [at] vipbg> 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

From: Peter Popov
Subject: Re: Suggestion: array functions
Date: 13 Feb 2001 16:23:22
Message: <rd9j8tsd9hcidq7fr6eehc6ueniv5tfq8k@4ax.com>
On 12 Feb 2001 12:45:11 -0500, Geoff Wedig
<wed### [at] darwinepbicwruedu> 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] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Warp
Subject: Re: Suggestion: array functions
Date: 14 Feb 2001 05:27:53
Message: <3a8a5da9@news.povray.org>
Ron Parker <ron### [at] povrayorg> 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

From: Warp
Subject: Re: Suggestion: array functions
Date: 14 Feb 2001 05:30:59
Message: <3a8a5e63@news.povray.org>
Ron Parker <ron### [at] povrayorg> 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

Goto Latest 10 Messages Next 6 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.