POV-Ray : Newsgroups : povray.text.scene-files : Eyeball code. : Re: Eyeball code. Server Time
29 Jul 2024 02:25:31 EDT (-0400)
  Re: Eyeball code.  
From: Ken
Date: 21 Jun 1999 03:31:04
Message: <376DE9F5.3A327D2D@pacbell.net>
Nieminen Mika wrote:
> 
> Morpheus Dreamlord <mor### [at] excitecom> wrote:
> : I hate indented code
> 
>   I wonder why.
> 
>   I understand if someone doesn't care if the code is indented or not, but
> I really don't understand why anyone can hate it. It's like hating the way
> the netscape news reader indents the articles and the responses or hating
> the way the newspaper arrange their pages (when the alternative is that
> everything is in one wrapping line).
>   I also wonder how can anyone understand the unindented code.
>   Since I like to show examples about this, here is one again:
> 
> #ifdef(Im) #declare a=zr*zr; #declare b=zi*zi; #declare zi=2*zr*zi+Im;
> #declare zr=a-b+Re; #declare n=n+1; #if(n<9 & a+b<4) #include "obfmand.pov"
> #else sphere {<Re,n/20,Im>,.05 pigment{rgb <n/9,0,0>} finish{specular .5}}
> #debug substr(c,n,1) #declare Re=Re+.05; #end #else #declare c=" .,-=OXM#"
> #declare Im=-1; #while(Im<=1) #declare Re=-2; #while(Re<=1) #declare zr=Re;
> #declare zi=Im; #declare n=0; #include "obfmand.pov" #end #debug "\n" #declare
> Im=Im+.05; #end camera { location <-3,5,-5> look_at -x*.5 angle 35 }
> light_source { <100,100,0> 1 } #end
> 
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/

 Your example is a bit extremist to say the least. I think what most of
the non indenting crowd argues their case for is not so much single line
parameters as much as it is the use of large spaces preceding the code for
that line. Taking the following simple example to illustrate what I am
saying:

I find this example unnaceptable and would reformat it every time:

 #declare R = 0; 
    #while ( R < 5 )

       #declare I = 0; 
         #while ( I < 5 )

           sphere 
                  {
                    < R, 0, I >,
                                .05 
                     pigment
                             { 
                                rgb < 1, 1, 1 > 
                          } 
                        finish
                               {
                                 specular .5
                           }
                       }

                 #declare R = R + 1;   
            #end

       #declare I = I + 1; 
  #end  

While I find the following two perfectly acceptable:

 #declare R = 0; 
   #while (R < 5)
 #declare  I = 0; 
   #while (I < 5)
   sphere {<R,0,I>,.05 pigment{rgb<1,1,1>}finish{specular .5}}
 #declare  R = R + 1;   
     #end
 #declare  I = I + 1; 
     #end  

or

 #declare R = 0; #while (R < 5)
 #declare I = 0; #while (I < 5)
   sphere {<R,0,I>,.05 pigment{rgb<1,1,1>}finish{specular .5}}
 #declare R = R + 1; #end
 #declare I = I + 1; #end  

 While for my own scenes as the complexity has grown they most often are
now formated like this example:

 #declare   R = 0; 
   #while ( R < 5)
 #declare   I = 0; 
   #while ( I < 5)
   sphere { <R,0,I>, .05 
  pigment { rgb <1,1,1> }
   finish { specular .5 }
          }
 #declare   R = R + 1;   
     #end
 #declare   I = I + 1; 
     #end  

  I guess it really doesn't matter since pov will read it no matter
how you do it within limits but I find my first example frustrating
to read because of the enourmous paper space it consumes. When trouble
shooting I like to see as much of my code on screen at one time as
I possibly can as opposed to scrolling up and down to view more of it.
My second two examples fit into the same space as the single first
example does and I could fit 3 of the third example into the same
space as the first.

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

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