POV-Ray : Newsgroups : povray.binaries.images : tree creation : Re: tree creation Server Time
5 Nov 2024 14:21:18 EST (-0500)
  Re: tree creation  
From: Tail Kinker
Date: 17 Aug 2006 08:33:06
Message: <44e46202@news.povray.org>
Lawrence W wrote:

>> If you know the coordinates of each point of the trunk, you don'tneed to
>> rotate cylinders.  Cylinders do not need to be created vertical. Just
>> specify the start and end coordinates and you are done.
>>
>> -tgq
> 
> That's exactly my goal, but also the crux of my problem.  How am I going to
> track the start and end coordinates?

I tackled this same problem a few years back.  My solution was to use a 
recursive call.

global_settings {
    assumed_gamma 1
    }

light_source {
    <1000, 1000, 1000>
    color rgb 1
    spotlight
    point_at 0
    radius 1
    falloff 5
    }

camera {
    location <120, 40, 0>
    look_at <0, 30, 0>
    }

plane {
    y, 0
    pigment {
       rgb <0, 0.3, 0>
       }
    }

#macro bloblike (lrad, srad, length)
    union {
       sphere {
       	 0, lrad
	 }
       sphere {
       	 <0, length, 0>, srad
	 }
       cone {
       	 0, lrad
	 <0, length, 0>, srad
	 }
       }
#end

#macro bloblike_run (number, cnt, lrad, length, bend, twist)
    #local srad = lrad * 0.9;
    #if (number = 1)
       object {
	 bloblike (lrad, srad, length)	
	 }
    #else
       union {
	 bloblike_run (number - 1, cnt, srad, length, bend, twist)
       	 object {
	    bloblike (lrad, srad, length)
	    }
	 rotate <bend, twist, 0>
	 #if (number != cnt)
	    translate <0, length, 0>
	 #end
	 }
    #end
#end

object {
    bloblike_run (10, 10, 4, 8, 7, 6)
    pigment {
       rgb <0.4, 0.2, 0>
       }
    }


Post a reply to this message


Attachments:
Download 'tree.jpg' (31 KB)

Preview of image 'tree.jpg'
tree.jpg


 

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