POV-Ray : Newsgroups : povray.binaries.images : Am I just too stupid for programming?!? Server Time
31 Jul 2024 18:19:44 EDT (-0400)
  Am I just too stupid for programming?!? (Message 1 to 9 of 9)  
From: Jörg 'Yadgar' Bleimann
Subject: Am I just too stupid for programming?!?
Date: 20 Apr 2009 05:33:02
Message: <49ec414e@news.povray.org>
High!

Now I'm rid of the clippings... but then, I noticed an ugly gap in 
Phobos' surface (see attachment). I thought this might be because of not 
having connected the ends of each stripe of mesh faces (corresponding to 
lines in the original map image), so I changed my code:

   face_indices
   {
     638398 // added (399-1)*2 = 796
     #declare a=0;
     #while (a<399)
       #declare b=0;
       #while (b<800) // runs now to 800 rather than 799
         <a*800+b, a*800+b+1, (a+1)*800+b>, // line 313
         #if (b=799 & a=398)
           <319999, 319200, 318400> // last triangle
         #else
           <(a+1)*800+b, (a+1)*800+b+1, a*800+b+1>,
         #end
         #declare b=b+1;
       #end
       #declare a=a+1;
     #end
   }

...but all I get is the error message

"Parse Error: No matching } in 'face_indices', < found instead" (in line 
313)!!!

See you in Khyberspace!

Yadgar


Post a reply to this message

From: scott
Subject: Re: Am I just too stupid for programming?!?
Date: 20 Apr 2009 05:39:15
Message: <49ec42c3$1@news.povray.org>
>   face_indices
>   {
>     638398 // added (399-1)*2 = 796
>     #declare a=0;
>     #while (a<399)
>       #declare b=0;
>       #while (b<800) // runs now to 800 rather than 799
>         <a*800+b, a*800+b+1, (a+1)*800+b>, // line 313
>         #if (b=799 & a=398)
>           <319999, 319200, 318400> // last triangle
>         #else
>           <(a+1)*800+b, (a+1)*800+b+1, a*800+b+1>,
>         #end
>         #declare b=b+1;
>       #end
>       #declare a=a+1;
>     #end
>   }
>
> ...but all I get is the error message
>
> "Parse Error: No matching } in 'face_indices', < found instead" (in line 
> 313)!!!

You are trying to add more indices than you have told POV at the top. 
399*800*2 is 638400, but you told POV you are only having 638398 index 
vectors.


Post a reply to this message

From: clipka
Subject: Re: Am I just too stupid for programming?!?
Date: 20 Apr 2009 05:50:01
Message: <web.49ec44d439d56e6b1a1b9caf0@news.povray.org>
=?ISO-8859-1?Q?J=F6rg_=27Yadgar=27_Bleimann?= <yaz### [at] gmxde> wrote:
> Now I'm rid of the clippings... but then, I noticed an ugly gap in
> Phobos' surface (see attachment).

No, I don't see attachment :P

> I thought this might be because of not
> having connected the ends of each stripe of mesh faces (corresponding to
> lines in the original map image), so I changed my code:
>
>    face_indices
>    {
>      638398 // added (399-1)*2 = 796

With a running from 0 to 398, this should be 399*2 = 798 (because you use 399
distinctive values for a)...

>      #declare a=0;
>      #while (a<399)
>        #declare b=0;
>        #while (b<800) // runs now to 800 rather than 799
>          <a*800+b, a*800+b+1, (a+1)*800+b>, // line 313
>          #if (b=799 & a=398)
>            <319999, 319200, 318400> // last triangle
>          #else
>            <(a+1)*800+b, (a+1)*800+b+1, a*800+b+1>,

.... and there should be some modulus operations in the vector building
statements, so wherever you have b+1, you should really have mod(b+1,800).

>          #end
>          #declare b=b+1;
>        #end
>        #declare a=a+1;
>      #end
>    }
>
> ...but all I get is the error message
>
> "Parse Error: No matching } in 'face_indices', < found instead" (in line
> 313)!!!

POV-Ray expects less vectors in the face_indices block than you supplied.


Post a reply to this message

From: Warp
Subject: Re: Am I just too stupid for programming?!?
Date: 20 Apr 2009 05:52:54
Message: <49ec45f6$1@news.povray.org>

>   face_indices
>   {
>     638398 // added (399-1)*2 = 796

  The nice thing about povray SDL is that you can write math. No need to
precalculate anything. Thus you can write:

  face_indices
  {
    399*800

>         #if (b=799 & a=398)
>           <319999, 319200, 318400> // last triangle
>         #else
>           <(a+1)*800+b, (a+1)*800+b+1, a*800+b+1>,
>         #end

  There's no need to do that. Instead of all that, just use:

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

  (Note no comma at the end.)

  The SDL is flexible about commas. Use that fact to your advantage.


Post a reply to this message

From: clipka
Subject: Re: Am I just too stupid for programming?!?
Date: 20 Apr 2009 06:15:00
Message: <web.49ec4a9939d56e6b1a1b9caf0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:

> >   face_indices
> >   {
> >     638398 // added (399-1)*2 = 796
>
>   The nice thing about povray SDL is that you can write math. No need to
> precalculate anything. Thus you can write:
>
>   face_indices
>   {
>     399*800

But if you do, you better have the math right:

  face_indices
  {
    399*800*2

because Yadgar is creating two faces per loop.


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Am I just too stupid for programming?!?
Date: 20 Apr 2009 07:27:01
Message: <49ec5c05@news.povray.org>
clipka wrote:

> No, I don't see attachment :P

Here it is:


Post a reply to this message


Attachments:
Download '2009-04-20 phobos, take 2.jpg' (14 KB)

Preview of image '2009-04-20 phobos, take 2.jpg'
2009-04-20 phobos, take 2.jpg


 

From: Jörg 'Yadgar' Bleimann
Subject: Re: Am I just too stupid for programming?!?
Date: 20 Apr 2009 07:42:03
Message: <49ec5f8b@news.povray.org>
High!

Warp wrote:
>   There's no need to do that. Instead of all that, just use:
> 
>           <(a+1)*800+b, (a+1)*800+b+1, a*800+b+1>
> 
>   (Note no comma at the end.)
> 
>   The SDL is flexible about commas. Use that fact to your advantage.

It still doesn't work either, still the same error message... and, yes, 
I also used mod(b, 800)!

Here is the current version:

mesh2 // Phobos
{
   vertex_vectors
   {
     320000
     #declare a=0;
     #while (a<400)
       #declare b=0;
       #while (b<800)
         #declare redval=eval_pigment(PhobosRelief, <(0.5+b)*(1/800), 
(0.5+a)*(1/400), 0>).red * (14-8.1);
         #declare greenval=eval_pigment(PhobosRelief, <(0.5+b)*(1/800), 
(0.5+a)*(1/400), 0>).green * ((14-8.1)/255);
 
((8.1+redval+greenval)*<sin(radians(b*(360/800)))*cos(radians(-90+a*(180/400))), 
sin(radians(-90+a*(180/400))), 
cos(radians(b*(360/800)))*cos(radians(-90+a*(180/400)))>)/sc
         #declare b=b+1;
       #end
       #declare a=a+1;
     #end
   }
   face_indices
   {
     638400
     #declare a=0;
     #while (a<399)
       #declare b=0;
       #while (b<800)
         <a*800+mod(b,800), a*800+mod(b+1,800), (a+1)*800+mod(b,800)>
         <(a+1)*800+mod(b,800), (a+1)*800+mod(b+1,800), a*800+mod(b+1,800)>
         #end
         #declare b=b+1;
       #end
       #declare a=a+1;
     #end
   }
   texture
   {
     pigment { color rgb 0.3 }
     finish { F_Standard_Planetary_Surface }
   }
   rotate y*clock
   translate Pos_Phobos/sc

}

See you in Khyberspace!

Yadgar


Post a reply to this message

From: Warp
Subject: Re: Am I just too stupid for programming?!?
Date: 20 Apr 2009 08:10:27
Message: <49ec6633$1@news.povray.org>

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

  Btw, since b is always smaller than 800, "mod(b,800)" is exactly
identical to just "b". (Where it does make a difference is in
"mod(b+1,800)".)


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Am I just too stupid for programming?!?
Date: 20 Apr 2009 08:35:02
Message: <49ec6bf6@news.povray.org>
High!

I must have placed one #end statement too much within my nested loop - I 
removed it, and now it runs! At least the meridional gap is (almost) 
gone, but as you can see in the latest image below, Christoph was right 
in assuming that altering the scaling divisor won't help in the long run!

Onward to the next issue... the bounding problem!

See you in Khyberspace!

Yadgar

Now playing: We Are The Refugees (Ian Cussick)


Post a reply to this message


Attachments:
Download '2009-04-20 phobos, take 5.jpg' (12 KB)

Preview of image '2009-04-20 phobos, take 5.jpg'
2009-04-20 phobos, take 5.jpg


 

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