POV-Ray : Newsgroups : povray.text.scene-files : Eyeball code. : Re: Eyeball code. Server Time
29 Jul 2024 02:27:38 EDT (-0400)
  Re: Eyeball code.  
From: Nieminen Mika
Date: 21 Jun 1999 06:04:05
Message: <376e0e15@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote:
: I find this example unnaceptable and would reformat it every time:

  I find it unacceptable too because it's badly indented. For example the
#end statements are not indented at the same level with the #while
statements thus making it difficult to see which #end goes with which
#while. Also the { and } are badly indented. It's rather difficult to see
what block they are defining. There's also too much white space.
  Indentation should be done well. With my indentation style that would
have been:

#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  

  Some people like to indent with four spaces instead of two in order to
more clearly see the different blocks. That's absolutely ok. Actually I
probably will change to that style soon.
  Indentation makes the code clearer assuming that you make the indentation
correctly.

: 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  

  With this indentation style it's extremely difficult to distinguish the
different blocks. This example is rather simple so that you can see the
two nested blocks, but add a couple of #if and #switch statements inside and
between the while loops and it will make it a lot more unclear.
  Also you have your sphere code in just one line, which is not always
possible.

:   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.

  Indentation seldom adds newlines but only spaces at the beginning of
the lines, so with properly indented code you will se exactly as much code
is with your style.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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