POV-Ray : Newsgroups : povray.binaries.images : Amalthea, now with brightness 1 and assumed_gamma 1.5 : Re: Amalthea, now with brightness 1 and assumed_gamma 1.5 Server Time
31 Jul 2024 18:19:56 EDT (-0400)
  Re: Amalthea, now with brightness 1 and assumed_gamma 1.5  
From: clipka
Date: 9 May 2009 08:55:00
Message: <web.4a057cb8e9ba10c2d7f7e4230@news.povray.org>
=?ISO-8859-1?Q?J=F6rg_=27Yadgar=27_Bleimann?= <yaz### [at] gmxde> wrote:
> So I corrected my mesh2 code... but than ran into another
> problem - Mesh face index out of range after 634404 faces! Why?
> I calculated the vertices to be left out to 2 * (800-1) = 1598;
> as the rows of faces are connected at the ends, the corresponding number
> of faces to be removed should be 2 * 800 = 1600... so the overall number
> of vertices should be 318402 rather than 320000, the overall number of
> faces 636800 rather than 638400!

I see the following errors in your code.

I note that you chose your poles to occupy vertices 0 and 636799, respectively;
the rows of vertices in between should therefore occupy vertices 1 through 800,
801 through 1600, 1601 through 2400, etc.

>      face_indices
>      {
>        636800
>        #declare fa=0;
>        #declare a=0;
>        #while (a<399)
>          #declare b=0;
>          #while (b<800)
>            #switch (a)
>              #case (0)
>                <0, b, b+1>

The sequence of vectors you need is <0,1,2>, <0,2,3>, <0,3,4>, ..., <0,800,1>;
to this end, the formula should be:

  <0, 1+b, 1+mod(b+1,800)>

>                #declare fa=fa+1;
>              #break
>              #range (1, 398)
>                <a*800+b, a*800+mod(b+1,800), (a+1)*800+b>,
>                <(a+1)*800+b, (a+1)*800+mod(b+1,800), a*800+mod(b+1,800)>

The sequence of vectors you actually need here is:

  <1,2,801>, <801,2,802>  // a = 1, b = 0
  <2,3,802>, <802,3,803>  // a = 1, b = 1
  <3,4,803>, <803,4,804>  // a = 1, b = 2
  ...
  <800,1,1600>, <1600,1,801>  // a = 1, b = 799
  <801,802,1601>, <1601,802,1602>  // a = 2, b = 0
  ...

(Note that I swapped the second triangle's vertices, to get the same "direction
of rotation" for both triangles; this is important if you want to define
separate inside and outside textures.)

So the formula should be:

  <1+(a-1)*800+b, 1+(a-1)*800+mod(b+1,800), 1+a*800+b>,
  <1+a*800+b, 1+(a-1)*800+mod(b+1,800), 1+a*800+mod(b+1,800)>

>                #declare fa=fa+2;
>              #break
>              #case (399)

This doesn't make sense. In the #while loop, you specified that a<399, and now
you check for a=399.

>                <a*800+b, a*800+mod(b+1,800), 636799>

This formula has the same problem as the two above; I'll leave it as an
excercise to you to figure out the correct formula for this one ;)

>                #declare fa=fa+1;
>              #break
>            #end
>            #warning str(fa, 6, 0)
>            #declare b=b+1;
>          #end
>          #declare a=a+1;
>        #end
>      }


Post a reply to this message

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