POV-Ray

The Persistence of Vision Raytracer (POV-Ray).

This is the legacy Bug Tracking System for the POV-Ray project. Bugs listed here are being migrated to our github issue tracker. Please refer to that for new reports or updates to existing ones on this system.

Tasklist

FS#127 - Expandable arrays

Attached to Project: POV-Ray
Opened by Mike H (SharkD) - Wednesday, 09 June 2010, 23:43 GMT
Last edited by William F Pokorny (wfpokorny) - Friday, 20 January 2017, 15:55 GMT
Task Type Feature Request
Category Backend → Parser/SDL
Status Tracked on GitHub
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version 3.70 beta 37a
Due in Version Future release
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Currently, arrays are of a fixed size. You can’t add or remove items to/from an array. I think it would like arrays to be expandable with no fixed and pre-determined size.

This task depends upon

Comment by Grimbert Jérôme (Le_Forgeron) - Thursday, 10 June 2010, 12:04 GMT

Re-allocation on assignment ?
dimension_size() & dimensions() might suggest that the basic support is already there.

Biggest issue might be that multiple dimensions arrays are so far assumed to be regular in size over indexes.
(a 2D is a rectangle, 3D a box, and so on). Most variable size multi-dimension arrays usually consider that they are just holder of N-1 D arrays...

Removing element from array ? how do you make such thing ?

To resume: why not get extension on assignemnt, but as array are not "empty" structure, it might cost a lot for multiple dimensions. (that's only a few millions cycles...)
Removal, I do not understand.

Comment by Christoph Lipka (clipka) - Friday, 18 June 2010, 20:44 GMT

Note that items can be removed from an array by using "#undef Foo[Bar]".

Comment by Mike H (SharkD) - Sunday, 20 June 2010, 00:21 GMT

Ah, didn't realize you could undef them.

You still get a warning if you don't set the array size initially.

Comment by Thorsten Fröhlich (thorsten) - Sunday, 20 June 2010, 08:17 GMT

A little known detail about POV-Ray's arrays is that they can also contain arrays of different elements. That is, you can do things like this:
#declare foo = array[2];
#declare foo[0] = array[2];
#declare foo[1] = array[7];
#declare foo[0][0] = 2;
#declare foo[1][6] = sphere{1,1}

The idea behind this is that an array can only contain elements of the same type, but a two dimensional array is just an array of arrays. And each of these arrays can be of any type. It is quite possible to build complex structures out of this.

As such, it also is not correct that POV-Ray's arrays need to be the same size in every dimension! What follows is that one can actually build trees out of POV-Ray's arrays, among other structures.

Comment by Richard Callwood III (Cousin_Ricky) - Tuesday, 08 October 2013, 12:43 GMT

Have you seen macro Resize_Array() in arrays.inc?

Comment by Christoph Lipka (clipka) - Monday, 11 November 2013, 00:09 GMT

While Resize_Array() can get the job done, it takes an awful lot of time as the array grows.

Comment by William F Pokorny (wfpokorny) - Friday, 20 January 2017, 15:55 GMT
  • Field changed: Status (New → Tracked on GitHub)

Now tracked on github as issue #197.

Loading...