|
|
In article <3E2### [at] alphalinkcomau>, Edward Coffey
<eco### [at] alphalinkcomau> wrote:
> I assume when you say "any array[x][y][z]" you mean that you don't want
> to hardcode the dimensions of the array into your program. If I'm wrong
> about that, the answer is straightforward, declare your function with
> the dimensions of the array hardcoded:
> void fn(int ar[5][5][5]);
> On the other hand, you may want more flexibility, so read on.
Indeed :( Flexibility is key. I thought it would be a simple command
I'm missing, so I'll clarify what it is I need to do. I'm basically
using C++ to parse instead of POV for obvious speed problems. I
wouldn't know the first thing about patching POV, but writing a simple
script with output isn't a problem. This said, I basically specify the
initial conditions of a three-dimensional array of vectors or floats (I
have the vector struct thing under control) and let it fly. A crucial
part is the interpolation of a vector or float at an arbitrary point
within the array. This will need to be done thousands of times to say
the least, so yes, flexibility is crucial.
> 1. Use a vector of vectors of vectors of your datatype. This will eat up
> lots of memory, probably be slow, and not give you most of the benefits
> of the vector class anyway.
Vector of vectors of vectors? I wouldn't know quite how to do that,
but that doesn't sound like too much of an issue.
> 2. Do as you say, passing in the base pointer of your array to the
> function, you will also need to pass in the dimensions of the array, as
> ...
> compiler will need to be washed thoroughly in warm soapy water after
> processing code like this.
With plenty of carefully written max() statements for safeguard, I
might try this since it sounds like it might be necessary. Maybe
*(array + coords(a,b,c)) will get the job done. Still a little
unsettling though.
> 3. The right way. Write your own three dimensional array class
> ...
> Here's somewhere to help you get started:
> http://<site deceased>/articles/2000/0012/0012c/0012c.htm?topic=articles
I'll take a look as soon as I have time. I know *of* the overload and
class idea, but that'll also take a little work to iron out. I miss
plain old, slow POV...
> > (Also, why does the line, double N = 1/3; give me .333...?
>
> What would you expect it to give you?
Whoops, I meant *doesn't*, as Warp pointed out, but I understand now.
I guess that's why all those POV codes had a 'superfluous' 1.0 instead
of 1 (with a period to end the sentence but not to confuse the meaning
of what I said).
Thanks for all your help. You too, Warp. I just didn't have time to
reply to both messages tonight.
- Ricky
Post a reply to this message
|
|