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:24:33 EDT (-0400)
  Re: Amalthea, now with brightness 1 and assumed_gamma 1.5  
From: clipka
Date: 9 May 2009 10:50:00
Message: <web.4a05969de9ba10c2d7f7e4230@news.povray.org>
=?ISO-8859-1?Q?J=F6rg_=27Yadgar=27_Bleimann?= <yaz### [at] gmxde> wrote:
> Meanwhile, I changed the code:

Boy, you and your moon mesh are a hopeless case :P

Let's see what we can do. First, let's re-compute all the values...

You have 2 poles, and "loops" of 800 vertices each, numbered a=1 through a=398,
i.e. 398 distinct loops (for later reference, I'll identify the vertex loops by
their corresponding "a" value, i.e. "loop 1" through "loop 398").

According to my calculation, that makes a total of 318402 vertices, fitting your
results.

(Make a mental note here that the very first loop - loop 1 - occupies vertex
indices 1 through 800, loop 2 occopies indices 801 through 1600, and so on.)

Now to the faces: They're arranged in belts. Two of them - those at the poles -
have 800 triangles each. The remaining ones, having 1600 triangles each,
connect two vertex loop pairs each, starting with loops (1;2), through
(397;398) - or, more generally, (a;a+1) with a=1 through a=397. Therefore
obviously, you have a total of 397 such "full" belts, and 2 "half" belts at the
poles.

As a result, you should have a total of 636800 triangles.

Okay, looks like you got *that* part of the math right in the first place :P

Therefore, your code must still be bogus somewhere, as it doesn't fit this bill;
let's see:

>      face_indices
>      {
>        635200

This should be 636800, as you correctly assumed earlier.

>        #declare fa=0;
>        #declare a=0;
>        #while (a<398)

As demonstrated above, you have "full" belts of triangles ranging from a=1
through a=397, so your final "polar" belt should correspond to a=398.
Therefore, this should be "#while (a<=398)" or "#while (a<399)".

This is where you lost those 1600 triangles.

>          #declare b=0;
>          #while (b<800)
>            #switch (a)
>              #case (0)
>                <0, a+1+b, a+1+mod(b+1,800)>
>                #declare fa=fa+1;
>              #break
>              #range (1, 396)

This should of course be "#range (1, 397)".

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

Look carefully at the sequence this generates for a=1:

  <801,802,1601>, <1601,1602,802>,
  <802,803,1602>, <1602,1603,803>,
  ...

These are all "loop 2" and "loop 3" vertex indices; loop 1 is connected on one
side to the pole, but you forgot to also connect it to loop 2 (which explains
the gaping hole you saw around the pole). The correct formula should be (as
already suggested in my previous post):

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

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

Of course this should be "#case (398)" instead.

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

And this formula should be

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

That should fit your bill again at last.


Post a reply to this message

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