|
![](/i/fill.gif) |
Katherina nous apporta ses lumieres en ce 2007/08/08 05:03:
>
> I'm new at Povray.
>
> I use the following code in order to find intersection of 30 planes and 19
> quadratics, plane normals and points are given in 2-dimensional array p and
> q, coefficients of quadratics given in 2-dimensional array qq.
>
> But I got the following error message: in qq[j]: "array subscript out of
> range"
>
> Maybe it is trivial but I didn't understand why? Can somebody help me?
>
> #declare i=0;
> #declare j=0;
>
>
> #while (i<31)
>
>
> intersection{
>
> plane
> {<p[i][0],p[i][1],p[i][2]>,p[i][0]*q[i][0]+p[i][1]*q[i][1]+p[i][2]*q[i][2]
> }
>
>
> quadric
> {
>
>
<qq[j][2],qq[j][4],qq[j][6]>,<qq[j][7],qq[j][8],qq[j][9]>,<qq[j][1],qq[j][3],qq[j][5]>,qq[j][0]
>
> }
>
> }
>
>
> #declare i=i+1;
>
> #if (j<20)
> #declare j=j+1;
> #end
>
> #end
>
>
After the last time your test on "j" succeede, j = 20. Your array's last element
is 19, you want to access element 20 whitch don't exist.
Solution:
Use 2 successive #while loops. The first one been only for the planes, the
second only for the quadrics.
The order of the elements of the intersection have no impact: All components
after the first are intersected from the first one.
--
Alain
-------------------------------------------------
You know you've been raytracing too long when you were ever dragged out of a
theater for yelling "Cheap rasterized graphics!!!" in the middle of Toy Story.
Stephan Ahonen
Post a reply to this message
|
![](/i/fill.gif) |