However when i switch from the original code to the new code the values returned are incorrect.

So can anybody see an error in my logic, or can anybody see an alternate method?

Please bear in mind that i am unable to change the size of the array or put a different structure in place as the code that assigns it values isn't mine (although i do have the source)

Thanks in advance

04-14-2009, 06:07 PM

emceenugget

why do you have all of this "+ 1" stuff? looks like that could be a problem.

04-14-2009, 06:47 PM

thorne_

the +1 is so that you won't get 'x' * 0 which would surely prove a bigger problem as anything time zero is zero!!

As any of the original index's can be 0, this seemed the logical route!

Maybe i'm wrong .. ..

04-14-2009, 07:07 PM

emceenugget

oops, i didnt even notice you were multiplying everything together. i just saw a bunch of +1's.

yeah, you're gonna need to rethink the math behind getting the correct index. just draw out a smaller example (2d or 3d), figure out the math behind it, and scale it up to whatever degree you want. i'm sure there's resources all over the internet to help you out.