POV-Ray : Newsgroups : povray.advanced-users : Use Slope pattern for Planting distribution? : Re: Use Slope pattern for Planting distribution? Server Time
6 Oct 2024 13:43:19 EDT (-0400)
  Re: Use Slope pattern for Planting distribution?  
From: Thomas de Groot
Date: 13 Dec 2006 03:05:32
Message: <457fb44c$1@news.povray.org>
In fact, It is such a small piece of code, that I can post it here below.

Thomas

//=======================================================================================
// -------- Placing the trees -------------
#debug "Placing trees...\n"

#declare Spacing = 1;
#declare Cnt = 0;


#declare PosX = -15;

#while (PosX < 15)

  #declare PosZ = -25;

  #while (PosZ < 15)

    // trace function
    #declare Norm = <0, 0, 0>;
    #declare Start = <PosX+(rand(Seed)-0.5)*Spacing, 
UpperBound+Isoscale.y+1, PosZ+(rand(Seed2)-0.5)*Spacing>;
    #declare Pos = trace (
                          Landscape,       // 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.5) & (Pos.y < 5.5))     // criteria for placing 
trees: not too steep and not too high
        object {
          //Tree (0.5+rand(Seed)*0.02)
          TREE
          scale RRand(1.0, 2.5, Seed)
          rotate RRand(0, 360, Seed2)*y
          translate Pos
        }
        #declare Cnt = Cnt+1;
      #end
    #end

    #declare PosZ = PosZ+Spacing;

  #end

  #declare PosX = PosX+Spacing;
#end
#debug concat("Placed ", str(Cnt,0,0), " Trees\n")

#end
//=======================================================================================


Post a reply to this message

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