POV-Ray : Newsgroups : povray.general : Math Stuff Help Needed - Please : Re: Math Stuff Help Needed - Please Server Time
12 Aug 2024 19:27:50 EDT (-0400)
  Re: Math Stuff Help Needed - Please  
From: Nieminen Mika
Date: 15 Feb 1999 08:11:02
Message: <36c81ce6.0@news.povray.org>
Stephen Lavedas <swl### [at] virginiaedu> wrote:
: Take a look at my indented version.

  It could be better. Your indentation style has some lack of logic.
  The general rule is: every block is indented.

: #declare HalfDome_1 = 
: union {

  Here the entire union is a block so it should be indented with respect
to the #declare, ie:

#declare HalfDome_1 =
  union {
    ...
  }

: #declare aa = 0;

  The block inside the union is also a block, so it should be indented:

#declare HalfDome_1 =
  union {
    #declare aa = 0;
    ...
  }

:    #while  (aa < 90)

  This #while is not an independent block with respect to the #declare, so
it can't be indented. It's part of the same block.

#declare HalfDome_1 =
  union {
    #declare aa = 0;
    #while (aa < 90)
      ...
    #end
    ...
  }

:       #declare bb = 0;
:       #while  (bb < 45)

  Here you made it right. So sometimes you indent in one way and sometimes
in the other. There's no logic there.

:          box{
:               ...
:             }       

  A block closing parenthesis should be indented at the same depth as the
block itself, ie:

    box {
      ...
    }

  Another style of placing the opening parenthesis is:

    box
    { ...
      ...
    }

(I like this one more)

  So my version would be:

#declare HalfDome_1=
  union
  { #declare aa=0;
    #while(aa<90)
      #declare bb=0;
      #while(bb<45)
        box
        { -.5,.5
          scale<.05,1.5,1.5> translate z*-40 rotate z*-2*bb
          scale<1,1,1.6+pi/90*-bb> rotate y*2*aa translate y*.75
        }
        #declare bb=bb+1;
      #end
      #declare aa=aa+1;
    #end
  }

-- 
main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
*_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*- Warp -*/


Post a reply to this message

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