POV-Ray : Newsgroups : povray.newusers : Coupla "newb" questions... : Re: Coupla "newb" questions... Server Time
29 Jul 2024 12:21:48 EDT (-0400)
  Re: Coupla "newb" questions...  
From: Thomas de Groot
Date: 9 Jan 2006 02:59:43
Message: <43c217ef@news.povray.org>
"Bob Hughes" <omniverse@charter%net> schreef in bericht
news:43c20d85$1@news.povray.org...
>
> I can only manage a loose description of what takes place and how it is
> doing it, mimicking the Help wording, so I'd rather not try. ;)  Someone
> else might have insights into using it in #while loops so I'll leave that
up
> to another person, if anyone else replies.
>

This is a trace example taken from my last scene. It is essentially
identical to the examples in the POV documentation, but you may try it,
changing some parameters to your own conveniences of course. It is rather
self-explanatory I think.

//================= start code ============================
#declare Spacing = 0.25;

#declare PosX = -10;

#while (PosX < 10)

  #declare PosZ = -30;

  #while (PosZ < 10)

    // trace function
    #declare Norm = <0, 0, 0>;
    #declare Start = <PosX+(Spacing*rand(Seed)), MaxBox.y+1,
PosZ+(Spacing*rand(Seed))>;
    #declare Pos = trace (
                  Cliff,       // object to test
                  Start,       // starting point
                  -y,          // direction
                  Norm );      // normal


    #if (Norm.x != 0 | Norm.y != 0 | Norm.z != 0)   // if intersection is
found, normal differs from 0
      #if ((vdot(Norm, y)>0.9) /*& (Pos.y > 1.0)*/) // criteria for placing
trees: steep (0.1) to flat (0.9); and above certain level

        object {AlienTree
          scale RRand(0.01, 0.03, Seed)
          rotate RRand(0, 360, Seed)*y
          translate Pos
        }

      #end //end of vdot() & Pos.y
    #end //end of Norm

    #declare PosZ=PosZ+Spacing;
  #end //end of while Z

  #declare PosX=PosX+Spacing;
#end //end of while X

//================= end code ============================


Thomas


Post a reply to this message

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