POV-Ray : Newsgroups : povray.advanced-users : Directly accessing array value in array of arrays (Part 2) : Re: Directly accessing array value in array of arrays (Part 2) Server Time
18 Apr 2024 19:36:54 EDT (-0400)
  Re: Directly accessing array value in array of arrays (Part 2)  
From: clipka
Date: 27 Aug 2018 05:56:48
Message: <5b83cae0$1@news.povray.org>
Am 27.08.2018 um 01:22 schrieb Bald Eagle:
> I tracked down my old thread, but no help.
> 
>
http://news.povray.org/povray.advanced-users/thread/%3Cweb.58e6aa331b66056880403a200%40news.povray.org%3E/
> 
> I have a 2D array, and I want to have that array be a collection of other 2D
> arrays.
> 
> Is that allowed?

Yes, absolutely - although I've heard rumors that /someone/ just
discovered a bug that may cause a crash instead of a parse error if
arrays of arrays are used and mistakes are made ;)

> How do I access, or more importantly assign, uninitialized "internal" 2D array
> elements?
> 
> #declare Array1 = array [4][4];
> 
> #declare Array2 = array [4][4];
> 
> Partially fill Array 2 with some values.
> 
> #declare Array1 [2][3] = Array2;

Perfectly fine there.

As a side note, it might be worth mentioning that `Array1[2][3]` now
holds a /copy/ of `Array2`, not a reference.

> So far so good - but now I need to get to the "array formerly known as Array2 ",
> element [0][2] which is INSIDE of Array1 [2][3]
> 
> #declare Array1[2][3][0][2] = somevalue makes the POV-Ray parser cry.

I doubt that's what you're actually seeing, because that exact construct
works perfectly fine here.


Post a reply to this message

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