POV-Ray : Newsgroups : povray.text.scene-files : Eyeball code. Server Time
29 Jul 2024 00:28:50 EDT (-0400)
  Eyeball code. (Message 11 to 20 of 40)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Samuel Benge
Subject: Re: Eyeball code.
Date: 20 Jun 1999 12:47:01
Message: <376D1B72.8798CD89@aol.com>
O.k. I think everyone is making their point here. I may even properly indent my
code next time I send some.....

SamuelT

STB### [at] aolcom

Nieminen Mika wrote:

>   Did you even try to understand how the texture was done? If yes, how many
> minutes did you spend on that?
>   Try the same thing with a properly indented code.


Post a reply to this message

From: Ken
Subject: Re: Eyeball code.
Date: 20 Jun 1999 12:58:58
Message: <376D1DA8.EB9F2E94@pacbell.net>
Samuel Benge wrote:
> 
> O.k. I think everyone is making their point here. I may even properly indent my
> code next time I send some.....
> 
> SamuelT

Traitor !

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Bob
Subject: Re: Eyeball code.
Date: 21 Jun 1999 01:23:12
Message: <376DCC40.578CA3BB@aol.com>
Well, indented or not, I've gotten this eye script with it line wrapped pretty
drastically because of the many continuous lines without spaces to break them down
when
it was being posted I'm guessing or at least because of the auto-wrapping feature
setting in Netscape was not of a length compatible to this specific pov scene file.
Nothing quite like a vector that's been split apart.
Btw, wish you more favorable postings in the future Samuel.

Samuel Benge wrote:
> 
> O.k. I think everyone is making their point here. I may even properly indent my
> code next time I send some.....
> 
> SamuelT
> 
> STB### [at] aolcom
> 
> Nieminen Mika wrote:
> 
> >   Did you even try to understand how the texture was done? If yes, how many
> > minutes did you spend on that?
> >   Try the same thing with a properly indented code.

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/homepage.htm
 mailto://inversez@aol.com?Subject=PoV-News


Post a reply to this message

From: Morpheus Dreamlord
Subject: Re: Eyeball code.
Date: 21 Jun 1999 01:42:01
Message: <376DD09C.A71EE933@excite.com>
Don't blame ya, I hate indented code, have a ultra edit macro to remove
all indent and double spaces..saves shitloads of space too.

(one wonders  - I know pov ignores space/tab, but it still has to "see"
them to ignore them.... does that slow it a tiny bit?)


Ken wrote:
> 
> David Cook wrote:
> >
> > Sorry Ken, I was making a wry comment about Samuel's code style. Have a boo
> > and I think you'll get it.
> 
>   Actually his non indented code looks perfectly natural to me. It drives
> other people nuts though especialy people with a programming background.
> 
> --
> Ken Tyler
> 
> mailto://tylereng@pacbell.net

-- 

Politicians - It seems to me that the worst of them could convince me
that horse shit tastes like honey-cake; the best of them would leave
me believing that I alone in all the world had failed
to enjoy its flavour.

The individual is more important then the state!


Post a reply to this message

From: Nieminen Mika
Subject: Re: Eyeball code.
Date: 21 Jun 1999 02:52:35
Message: <376de133@news.povray.org>
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 -*/


Post a reply to this message

From: Ken
Subject: Re: Eyeball code.
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

From: Nieminen Mika
Subject: Re: Eyeball code.
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

From: Ken
Subject: Re: Eyeball code.
Date: 21 Jun 1999 06:09:50
Message: <376E0F25.530F1EF0@pacbell.net>
Nieminen Mika wrote:

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

The biggest problem then lies with the fact that there is no agreement
as to what constitutes "proper" indentation. No one seems to be able
to agree on that either.

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Nieminen Mika
Subject: Re: Eyeball code.
Date: 21 Jun 1999 09:40:24
Message: <376e40c8@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote:
: The biggest problem then lies with the fact that there is no agreement
: as to what constitutes "proper" indentation. No one seems to be able
: to agree on that either.

  A "proper" indentation is one which allows you to easyly see where does
a block start and where does it end without having to search through the
entire code (ie. you can just skip the majority of the code if you only
want to see where does the block end). This is speacially important with
nested blocks. You only need 3 or 4 levels of nesting for the non-indented
code to be almost completely unreadable.
  This same indentation of nested blocks is also used in other places than
programming, for example the html lists (see for example the povVFAQ page).
The indentation of blocks makes it easy to "parse" the contents of the
text. You can easyly see the "title" of each block and choose the block
you want.
  This same principle applies to code (povray or whatever). The command
at the beginning of a block is the "title" of that block (for example
"#while" or "sphere"). If you are not interested in that block you can
easyly skip it and go to the next block.
  Now, this skipping is very hard if you can't see where does the block end.
It's extremely tedious to search through the entire text to see where does
the next block begin.
  Just imagine a newspaper with _all_ its text without titles, blocks,
columns, newlines, empty lines, etc. Searching for certain news could be
extremely tedious. The same applies to pov-code.

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

From: Bob
Subject: Re: Eyeball code.
Date: 21 Jun 1999 14:54:28
Message: <376E8A61.62D873EC@aol.com>
Some people comment the ends of those blocks, ie.

union {
 sphere {0,1}
 box {-1,1}
} //union

to make certain of where things are, but that is a bit of overkill if the script has
been written out nicely enough to see what's what. Hey, here's a thought. What if
POV-Ray could see these in a parse (oops, yeah it does already) and write into your
file
this sort of thing automatically. Switchable of course for the dislikers of extra
wasted
space.

Nieminen Mika wrote:
> 
> Ken <tyl### [at] pacbellnet> wrote:
> : The biggest problem then lies with the fact that there is no agreement
> : as to what constitutes "proper" indentation. No one seems to be able
> : to agree on that either.

Bob here again, writes:
Remember, there's the POV-Ray code setting in the CodeMax editor. No choice there,
love
it or leave it (or further edit what it gives you, my personal favorite).

>   A "proper" indentation is one which allows you to easyly see where does
> a block start and where does it end without having to search through the
> entire code (ie. you can just skip the majority of the code if you only
> want to see where does the block end). This is speacially important with
> nested blocks. You only need 3 or 4 levels of nesting for the non-indented
> code to be almost completely unreadable.
>   This same indentation of nested blocks is also used in other places than
> programming, for example the html lists (see for example the povVFAQ page).
> The indentation of blocks makes it easy to "parse" the contents of the
> text. You can easyly see the "title" of each block and choose the block
> you want.
>   This same principle applies to code (povray or whatever). The command
> at the beginning of a block is the "title" of that block (for example
> "#while" or "sphere"). If you are not interested in that block you can
> easyly skip it and go to the next block.
>   Now, this skipping is very hard if you can't see where does the block end.
> It's extremely tedious to search through the entire text to see where does
> the next block begin.
>   Just imagine a newspaper with _all_ its text without titles, blocks,
> columns, newlines, empty lines, etc. Searching for certain news could be
> extremely tedious. The same applies to pov-code.
> 

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/homepage.htm
 mailto://inversez@aol.com?Subject=PoV-News


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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