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.

Attached to Project: POV-Ray
Opened by Mike H - 2010-06-09
Last edited by William F Pokorny - 2017-01-20

FS#127 - Expandable arrays

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.

Grimbert Jérôme commented on 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.

Admin
Christoph Lipka commented on Friday, 18 June 2010, 20:44 GMT

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

Mike H commented on 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.

Thorsten Fröhlich commented on 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.

Richard Callwood III commented on Tuesday, 08 October 2013, 12:43 GMT

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

Admin
Christoph Lipka commented on 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.

William F Pokorny commented on Friday, 20 January 2017, 15:55 GMT

Now tracked on github as issue #197.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing